routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
const require_context = require('../../context-DwbtaXxf.cjs');
|
||||
const require_webpack_like = require('../../webpack-like-BAQNtVsj.cjs');
|
||||
const require_context$1 = require('../../context-Df-kn6rn.cjs');
|
||||
|
||||
//#region src/webpack/loaders/load.ts
|
||||
async function load(source, map) {
|
||||
const callback = this.async();
|
||||
const { plugin } = this.query;
|
||||
let id = this.resource;
|
||||
if (!plugin?.load || !id) return callback(null, source, map);
|
||||
if (id.startsWith(plugin.__virtualModulePrefix)) id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
const context = require_context$1.createContext$1(this);
|
||||
const { handler } = require_context.normalizeObjectHook("load", plugin.load);
|
||||
const res = await handler.call(Object.assign({}, require_context$1.createBuildContext$1({
|
||||
addWatchFile: (file) => {
|
||||
this.addDependency(file);
|
||||
},
|
||||
getWatchFiles: () => {
|
||||
return this.getDependencies();
|
||||
}
|
||||
}, this._compiler, this._compilation, this), context), require_webpack_like.normalizeAbsolutePath(id));
|
||||
if (res == null) callback(null, source, map);
|
||||
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
|
||||
else callback(null, res, map);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
module.exports = load;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { LoaderContext } from "webpack";
|
||||
|
||||
//#region src/webpack/loaders/load.d.ts
|
||||
declare function load(this: LoaderContext<any>, source: string, map: any): Promise<void>;
|
||||
|
||||
//#endregion
|
||||
export { load as default };
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { LoaderContext } from "webpack";
|
||||
|
||||
//#region src/webpack/loaders/load.d.ts
|
||||
declare function load(this: LoaderContext<any>, source: string, map: any): Promise<void>;
|
||||
|
||||
//#endregion
|
||||
export { load as default };
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { normalizeObjectHook } from "../../context-D49cMElb.js";
|
||||
import { normalizeAbsolutePath } from "../../webpack-like-CSbnjTNU.js";
|
||||
import { createBuildContext, createContext } from "../../context-BZKy5Nsn.js";
|
||||
|
||||
//#region src/webpack/loaders/load.ts
|
||||
async function load(source, map) {
|
||||
const callback = this.async();
|
||||
const { plugin } = this.query;
|
||||
let id = this.resource;
|
||||
if (!plugin?.load || !id) return callback(null, source, map);
|
||||
if (id.startsWith(plugin.__virtualModulePrefix)) id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
|
||||
const context = createContext(this);
|
||||
const { handler } = normalizeObjectHook("load", plugin.load);
|
||||
const res = await handler.call(Object.assign({}, createBuildContext({
|
||||
addWatchFile: (file) => {
|
||||
this.addDependency(file);
|
||||
},
|
||||
getWatchFiles: () => {
|
||||
return this.getDependencies();
|
||||
}
|
||||
}, this._compiler, this._compilation, this), context), normalizeAbsolutePath(id));
|
||||
if (res == null) callback(null, source, map);
|
||||
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
|
||||
else callback(null, res, map);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { load as default };
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
const require_context = require('../../context-DwbtaXxf.cjs');
|
||||
const require_context$1 = require('../../context-Df-kn6rn.cjs');
|
||||
|
||||
//#region src/webpack/loaders/transform.ts
|
||||
async function transform(source, map) {
|
||||
const callback = this.async();
|
||||
const { plugin } = this.query;
|
||||
if (!plugin?.transform) return callback(null, source, map);
|
||||
const context = require_context$1.createContext$1(this);
|
||||
const { handler, filter } = require_context.normalizeObjectHook("transform", plugin.transform);
|
||||
if (!filter(this.resource, source)) return callback(null, source, map);
|
||||
try {
|
||||
const res = await handler.call(Object.assign({}, require_context$1.createBuildContext$1({
|
||||
addWatchFile: (file) => {
|
||||
this.addDependency(file);
|
||||
},
|
||||
getWatchFiles: () => {
|
||||
return this.getDependencies();
|
||||
}
|
||||
}, this._compiler, this._compilation, this), context), source, this.resource);
|
||||
if (res == null) callback(null, source, map);
|
||||
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
|
||||
else callback(null, res, map);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) callback(error);
|
||||
else callback(new Error(String(error)));
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
module.exports = transform;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { LoaderContext } from "webpack";
|
||||
|
||||
//#region src/webpack/loaders/transform.d.ts
|
||||
declare function transform(this: LoaderContext<any>, source: string, map: any): Promise<void>;
|
||||
|
||||
//#endregion
|
||||
export { transform as default };
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { LoaderContext } from "webpack";
|
||||
|
||||
//#region src/webpack/loaders/transform.d.ts
|
||||
declare function transform(this: LoaderContext<any>, source: string, map: any): Promise<void>;
|
||||
|
||||
//#endregion
|
||||
export { transform as default };
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import { normalizeObjectHook } from "../../context-D49cMElb.js";
|
||||
import { createBuildContext, createContext } from "../../context-BZKy5Nsn.js";
|
||||
|
||||
//#region src/webpack/loaders/transform.ts
|
||||
async function transform(source, map) {
|
||||
const callback = this.async();
|
||||
const { plugin } = this.query;
|
||||
if (!plugin?.transform) return callback(null, source, map);
|
||||
const context = createContext(this);
|
||||
const { handler, filter } = normalizeObjectHook("transform", plugin.transform);
|
||||
if (!filter(this.resource, source)) return callback(null, source, map);
|
||||
try {
|
||||
const res = await handler.call(Object.assign({}, createBuildContext({
|
||||
addWatchFile: (file) => {
|
||||
this.addDependency(file);
|
||||
},
|
||||
getWatchFiles: () => {
|
||||
return this.getDependencies();
|
||||
}
|
||||
}, this._compiler, this._compilation, this), context), source, this.resource);
|
||||
if (res == null) callback(null, source, map);
|
||||
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
|
||||
else callback(null, res, map);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) callback(error);
|
||||
else callback(new Error(String(error)));
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { transform as default };
|
||||
Reference in New Issue
Block a user