initial commit

This commit is contained in:
Zoe
2023-01-03 09:29:04 -06:00
commit 7851137d88
12889 changed files with 2557443 additions and 0 deletions

5
node_modules/unplugin/dist/webpack/loaders/load.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { LoaderContext } from 'webpack';
declare function load(this: LoaderContext<any>, source: string, map: any): Promise<void>;
export { load as default };

109
node_modules/unplugin/dist/webpack/loaders/load.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/webpack/loaders/load.ts
var load_exports = {};
__export(load_exports, {
default: () => load
});
module.exports = __toCommonJS(load_exports);
// src/webpack/context.ts
var import_path = require("path");
var import_webpack_sources = __toESM(require("webpack-sources"));
var import_acorn = require("acorn");
function createContext(compilation) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(
(0, import_path.resolve)(process.cwd(), id)
);
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
compilation.emitAsset(
outFileName,
import_webpack_sources.default ? new import_webpack_sources.default.RawSource(
typeof emittedFile.source === "string" ? emittedFile.source : Buffer.from(emittedFile.source)
) : {
source: () => emittedFile.source,
size: () => emittedFile.source.length
}
);
}
},
getWatchFiles() {
return Array.from(
compilation.fileDependencies ?? compilation.compilationDependencies
);
}
};
}
// src/utils.ts
var import_path2 = require("path");
function normalizeAbsolutePath(path) {
if ((0, import_path2.isAbsolute)(path))
return (0, import_path2.normalize)(path);
else
return path;
}
// src/webpack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { unpluginName } = this.query;
const plugin = this._compiler?.$unpluginContext[unpluginName];
let id = this.resource;
if (!plugin?.load || !id)
return callback(null, source, map);
const context = {
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
};
if (id.startsWith(plugin.__virtualModulePrefix))
id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
const res = await plugin.load.call(
Object.assign(this._compilation && createContext(this._compilation), 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);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});

78
node_modules/unplugin/dist/webpack/loaders/load.mjs generated vendored Normal file
View File

@@ -0,0 +1,78 @@
// src/webpack/context.ts
import { resolve } from "path";
import sources from "webpack-sources";
import { Parser } from "acorn";
function createContext(compilation) {
return {
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(
resolve(process.cwd(), id)
);
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
compilation.emitAsset(
outFileName,
sources ? new sources.RawSource(
typeof emittedFile.source === "string" ? emittedFile.source : Buffer.from(emittedFile.source)
) : {
source: () => emittedFile.source,
size: () => emittedFile.source.length
}
);
}
},
getWatchFiles() {
return Array.from(
compilation.fileDependencies ?? compilation.compilationDependencies
);
}
};
}
// src/utils.ts
import { isAbsolute, normalize } from "path";
function normalizeAbsolutePath(path) {
if (isAbsolute(path))
return normalize(path);
else
return path;
}
// src/webpack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { unpluginName } = this.query;
const plugin = this._compiler?.$unpluginContext[unpluginName];
let id = this.resource;
if (!plugin?.load || !id)
return callback(null, source, map);
const context = {
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
};
if (id.startsWith(plugin.__virtualModulePrefix))
id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
const res = await plugin.load.call(
Object.assign(this._compilation && createContext(this._compilation), 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);
}
export {
load as default
};

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from 'webpack';
declare function transform(this: LoaderContext<any>, source: string, map: any): Promise<void>;
export { transform as default };

100
node_modules/unplugin/dist/webpack/loaders/transform.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/webpack/loaders/transform.ts
var transform_exports = {};
__export(transform_exports, {
default: () => transform
});
module.exports = __toCommonJS(transform_exports);
// src/webpack/context.ts
var import_path = require("path");
var import_webpack_sources = __toESM(require("webpack-sources"));
var import_acorn = require("acorn");
function createContext(compilation) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(
(0, import_path.resolve)(process.cwd(), id)
);
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
compilation.emitAsset(
outFileName,
import_webpack_sources.default ? new import_webpack_sources.default.RawSource(
typeof emittedFile.source === "string" ? emittedFile.source : Buffer.from(emittedFile.source)
) : {
source: () => emittedFile.source,
size: () => emittedFile.source.length
}
);
}
},
getWatchFiles() {
return Array.from(
compilation.fileDependencies ?? compilation.compilationDependencies
);
}
};
}
// src/webpack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
let unpluginName;
if (typeof this.query === "string") {
const query = new URLSearchParams(this.query);
unpluginName = query.get("unpluginName");
} else {
unpluginName = this.query.unpluginName;
}
const plugin = this._compiler?.$unpluginContext[unpluginName];
if (!plugin?.transform)
return callback(null, source, map);
const context = {
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
};
const res = await plugin.transform.call(Object.assign(this._compilation && createContext(this._compilation), 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);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});

View File

@@ -0,0 +1,69 @@
// src/webpack/context.ts
import { resolve } from "path";
import sources from "webpack-sources";
import { Parser } from "acorn";
function createContext(compilation) {
return {
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(
resolve(process.cwd(), id)
);
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
compilation.emitAsset(
outFileName,
sources ? new sources.RawSource(
typeof emittedFile.source === "string" ? emittedFile.source : Buffer.from(emittedFile.source)
) : {
source: () => emittedFile.source,
size: () => emittedFile.source.length
}
);
}
},
getWatchFiles() {
return Array.from(
compilation.fileDependencies ?? compilation.compilationDependencies
);
}
};
}
// src/webpack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
let unpluginName;
if (typeof this.query === "string") {
const query = new URLSearchParams(this.query);
unpluginName = query.get("unpluginName");
} else {
unpluginName = this.query.unpluginName;
}
const plugin = this._compiler?.$unpluginContext[unpluginName];
if (!plugin?.transform)
return callback(null, source, map);
const context = {
error: (error) => this.emitError(typeof error === "string" ? new Error(error) : error),
warn: (error) => this.emitWarning(typeof error === "string" ? new Error(error) : error)
};
const res = await plugin.transform.call(Object.assign(this._compilation && createContext(this._compilation), 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);
}
export {
transform as default
};