mirror of https://github.com/webpack/webpack.git
Compare commits
5 Commits
6f04d305c0
...
cdab7e1729
Author | SHA1 | Date |
---|---|---|
|
cdab7e1729 | |
|
b6c781a0f1 | |
|
daa38aa735 | |
|
018160e44d | |
|
573528e410 |
|
@ -314,7 +314,8 @@
|
|||
"Kumar",
|
||||
"spacek",
|
||||
"thelarkinn",
|
||||
"behaviour"
|
||||
"behaviour",
|
||||
"systemvars"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"/Author.+/",
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn fix:special` to update
|
||||
*/
|
||||
|
||||
export interface DotenvPluginOptions {
|
||||
/**
|
||||
* Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).
|
||||
*/
|
||||
allowEmptyValues?: boolean;
|
||||
/**
|
||||
* Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.
|
||||
*/
|
||||
defaults?: boolean | string;
|
||||
/**
|
||||
* Allows your variables to be "expanded" for reusability within your .env file.
|
||||
*/
|
||||
expand?: boolean;
|
||||
/**
|
||||
* The path to your environment variables. This same path applies to the .env.example and .env.defaults files.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The prefix to use before the name of your env variables.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
|
||||
*/
|
||||
safe?: boolean | string;
|
||||
/**
|
||||
* Set to true if you would rather load all system variables as well (useful for CI purposes).
|
||||
*/
|
||||
systemvars?: boolean;
|
||||
}
|
|
@ -0,0 +1,341 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Natsu @xiaoxiaojx
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const createSchemaValidation = require("./util/create-schema-validation");
|
||||
const { isAbsolute, join } = require("./util/fs");
|
||||
|
||||
/** @typedef {import("./Compiler")} Compiler */
|
||||
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
||||
/** @typedef {import("../declarations/plugins/DotenvPlugin").DotenvPluginOptions} DotenvPluginOptions */
|
||||
|
||||
const DEFAULT_PATH = "./.env";
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
path: DEFAULT_PATH,
|
||||
prefix: "process.env."
|
||||
};
|
||||
|
||||
const LINE =
|
||||
/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
||||
|
||||
const PLUGIN_NAME = "DotenvPlugin";
|
||||
|
||||
const validate = createSchemaValidation(
|
||||
require("../schemas/plugins/DotenvPlugin.check"),
|
||||
() => require("../schemas/plugins/DotenvPlugin.json"),
|
||||
{
|
||||
name: "Dotenv Plugin",
|
||||
baseDataPath: "options"
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* @param {string} env environment variable value
|
||||
* @param {Record<string, string>} vars variables object
|
||||
* @returns {string} interpolated value
|
||||
*/
|
||||
const interpolate = (env, vars) => {
|
||||
const matches = env.match(/\$([a-zA-Z0-9_]+)|\${([a-zA-Z0-9_]+)}/g) || [];
|
||||
|
||||
for (const match of matches) {
|
||||
const key = match.replace(/\$|{|}/g, "");
|
||||
let variable = vars[key] || "";
|
||||
variable = interpolate(variable, vars);
|
||||
env = env.replace(match, variable);
|
||||
}
|
||||
|
||||
return env;
|
||||
};
|
||||
|
||||
/**
|
||||
* ported from https://github.com/motdotla/dotenv/blob/master/lib/main.js#L49
|
||||
* @param {string|Buffer} src the source content to parse
|
||||
* @returns {Record<string, string>} parsed environment variables object
|
||||
*/
|
||||
function parse(src) {
|
||||
const obj = /** @type {Record<string, string>} */ ({});
|
||||
|
||||
// Convert buffer to string
|
||||
let lines = src.toString();
|
||||
|
||||
// Convert line breaks to same format
|
||||
lines = lines.replace(/\r\n?/gm, "\n");
|
||||
|
||||
let match;
|
||||
while ((match = LINE.exec(lines)) !== null) {
|
||||
const key = match[1];
|
||||
|
||||
// Default undefined or null to empty string
|
||||
let value = match[2] || "";
|
||||
|
||||
// Remove whitespace
|
||||
value = value.trim();
|
||||
|
||||
// Check if double quoted
|
||||
const maybeQuote = value[0];
|
||||
|
||||
// Remove surrounding quotes
|
||||
value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
|
||||
|
||||
// Expand newlines if double quoted
|
||||
if (maybeQuote === '"') {
|
||||
value = value.replace(/\\n/g, "\n");
|
||||
value = value.replace(/\\r/g, "\r");
|
||||
}
|
||||
|
||||
// Add to object
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses objects like before, but with defaults!
|
||||
* @param {string} src the original src
|
||||
* @param {string=} defaultSrc the new-and-improved default source
|
||||
* @returns {Record<string, string>} the parsed results
|
||||
*/
|
||||
const mergeParse = (src, defaultSrc = "") => {
|
||||
const parsedSrc = parse(src);
|
||||
const parsedDefault = parse(defaultSrc);
|
||||
|
||||
return { ...parsedDefault, ...parsedSrc };
|
||||
};
|
||||
|
||||
// ported from https://github.com/mrsteele/dotenv-webpack
|
||||
class DotenvPlugin {
|
||||
/**
|
||||
* @param {DotenvPluginOptions=} options options object
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
validate(options);
|
||||
this.config = { ...DEFAULT_OPTIONS, ...options };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
/** @type {string[] | undefined} */
|
||||
let fileDependenciesCache;
|
||||
|
||||
compiler.hooks.beforeCompile.tapAsync(PLUGIN_NAME, (_params, callback) => {
|
||||
const inputFileSystem = /** @type {InputFileSystem} */ (
|
||||
compiler.inputFileSystem
|
||||
);
|
||||
const context = compiler.context;
|
||||
|
||||
this.gatherVariables(
|
||||
inputFileSystem,
|
||||
context,
|
||||
(err, variables, fileDependencies) => {
|
||||
if (err) return callback(err);
|
||||
const definitions = this.formatVariables(variables || {});
|
||||
const DefinePlugin = compiler.webpack.DefinePlugin;
|
||||
|
||||
new DefinePlugin(definitions).apply(compiler);
|
||||
fileDependenciesCache = fileDependencies;
|
||||
|
||||
callback();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
||||
compilation.fileDependencies.addAll(fileDependenciesCache || []);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem the input file system
|
||||
* @param {string} context the compiler context
|
||||
* @param {(err: Error | null, variables?: Record<string, string>, fileDependencies?: string[]) => void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
gatherVariables(inputFileSystem, context, callback) {
|
||||
const { safe, allowEmptyValues } = /** @type {DotenvPluginOptions} */ (
|
||||
this.config
|
||||
);
|
||||
const vars = /** @type {Record<string, string>} */ (this.initializeVars());
|
||||
|
||||
this.getEnvs(inputFileSystem, context, (err, result) => {
|
||||
if (err) return callback(err);
|
||||
if (!result) {
|
||||
return callback(new Error("Failed to get environment variables"));
|
||||
}
|
||||
|
||||
const { env, blueprint, fileDependencies } = result;
|
||||
|
||||
try {
|
||||
for (const key of Object.keys(blueprint)) {
|
||||
const value = Object.prototype.hasOwnProperty.call(vars, key)
|
||||
? vars[key]
|
||||
: env[key];
|
||||
|
||||
const isMissing =
|
||||
typeof value === "undefined" ||
|
||||
value === null ||
|
||||
(!allowEmptyValues && value === "");
|
||||
|
||||
if (safe && isMissing) {
|
||||
throw new Error(`Missing environment variable: ${key}`);
|
||||
} else {
|
||||
vars[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// add the leftovers
|
||||
if (safe) {
|
||||
for (const key of Object.keys(env)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(vars, key)) {
|
||||
vars[key] = env[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback(null, vars, fileDependencies);
|
||||
} catch (error) {
|
||||
callback(error instanceof Error ? error : new Error(String(error)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initializeVars() {
|
||||
const config = /** @type {DotenvPluginOptions} */ (this.config);
|
||||
if (config.systemvars) {
|
||||
const vars = /** @type {Record<string, string>} */ ({});
|
||||
for (const key in process.env) {
|
||||
if (process.env[key] !== undefined) {
|
||||
vars[key] = /** @type {string} */ (process.env[key]);
|
||||
}
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
return /** @type {Record<string, string>} */ ({});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {InputFileSystem} inputFileSystem the input file system
|
||||
* @param {string} context the compiler context
|
||||
* @param {(err: Error | null, result?: {env: Record<string, string>, blueprint: Record<string, string>, fileDependencies: string[]}) => void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getEnvs(inputFileSystem, context, callback) {
|
||||
const { path, safe, defaults } = /** @type {DotenvPluginOptions} */ (
|
||||
this.config
|
||||
);
|
||||
|
||||
const loadPromises = [];
|
||||
/** @type {string[]} */
|
||||
const loadFiles = [];
|
||||
|
||||
const resolvedMainEnvFile = this.resolvePath(
|
||||
/** @type {string} */ (path),
|
||||
inputFileSystem,
|
||||
context
|
||||
);
|
||||
loadPromises.push(this.loadFile(inputFileSystem, resolvedMainEnvFile));
|
||||
loadFiles.push(resolvedMainEnvFile);
|
||||
if (defaults) {
|
||||
const defaultsFile =
|
||||
defaults === true ? `${path || DEFAULT_PATH}.defaults` : defaults;
|
||||
const resolvedDefaultsFile = this.resolvePath(
|
||||
/** @type {string} */ (defaultsFile),
|
||||
inputFileSystem,
|
||||
context
|
||||
);
|
||||
loadPromises.push(this.loadFile(inputFileSystem, resolvedDefaultsFile));
|
||||
loadFiles.push(resolvedDefaultsFile);
|
||||
} else {
|
||||
loadPromises.push(Promise.resolve(""));
|
||||
}
|
||||
if (safe) {
|
||||
const safeFile = safe === true ? `${path || DEFAULT_PATH}.example` : safe;
|
||||
const resolvedSafeFile = this.resolvePath(
|
||||
/** @type {string} */ (safeFile),
|
||||
inputFileSystem,
|
||||
context
|
||||
);
|
||||
loadPromises.push(this.loadFile(inputFileSystem, resolvedSafeFile));
|
||||
loadFiles.push(resolvedSafeFile);
|
||||
} else {
|
||||
loadPromises.push(Promise.resolve(""));
|
||||
}
|
||||
|
||||
Promise.all(loadPromises)
|
||||
.then(([envContent, defaultsContent, safeContent]) => {
|
||||
const env = mergeParse(envContent || "", defaultsContent || "");
|
||||
let blueprint = env;
|
||||
if (safeContent) {
|
||||
blueprint = mergeParse(safeContent || "");
|
||||
}
|
||||
callback(null, { env, blueprint, fileDependencies: loadFiles });
|
||||
})
|
||||
.catch((err) => {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a file with proper path resolution
|
||||
* @param {InputFileSystem} fs the input file system
|
||||
* @param {string} file the file to load
|
||||
* @returns {Promise<string>} the content of the file
|
||||
*/
|
||||
loadFile(fs, file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(file, "utf8", (err, content) => {
|
||||
if (err) reject(err);
|
||||
resolve(content || "");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file the file to load
|
||||
* @param {InputFileSystem} inputFileSystem the input file system
|
||||
* @param {string} context the compiler context for resolving relative paths
|
||||
* @returns {string} the resolved path
|
||||
*/
|
||||
resolvePath(file, inputFileSystem, context) {
|
||||
return isAbsolute(file) ? file : join(inputFileSystem, context, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Record<string, string>} variables variables object
|
||||
* @returns {Record<string, string>} formatted data
|
||||
*/
|
||||
formatVariables(variables) {
|
||||
const { expand, prefix } = /** @type {DotenvPluginOptions} */ (this.config);
|
||||
const formatted = Object.keys(variables).reduce((obj, key) => {
|
||||
const v = variables[key];
|
||||
const vKey = `${prefix}${key}`;
|
||||
let vValue;
|
||||
if (expand) {
|
||||
if (v.slice(0, 2) === "\\$") {
|
||||
vValue = v.slice(1);
|
||||
} else if (v.indexOf("\\$") > 0) {
|
||||
vValue = v.replace(/\\\$/g, "$");
|
||||
} else {
|
||||
vValue = interpolate(v, variables);
|
||||
}
|
||||
} else {
|
||||
vValue = v;
|
||||
}
|
||||
|
||||
obj[vKey] = JSON.stringify(vValue);
|
||||
|
||||
return obj;
|
||||
}, /** @type {Record<string, string>} */ ({}));
|
||||
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DotenvPlugin;
|
|
@ -15,59 +15,46 @@ const browserslist = require("browserslist");
|
|||
// [[C:]/path/to/config][:env]
|
||||
const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
|
||||
|
||||
/**
|
||||
* @typedef {object} BrowserslistHandlerConfig
|
||||
* @property {string=} configPath
|
||||
* @property {string=} env
|
||||
* @property {string=} query
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string | null | undefined} input input string
|
||||
* @param {string} context the context directory
|
||||
* @returns {BrowserslistHandlerConfig} config
|
||||
*/
|
||||
const parse = (input, context) => {
|
||||
if (!input) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (path.isAbsolute(input)) {
|
||||
const [, configPath, env] = inputRx.exec(input) || [];
|
||||
return { configPath, env };
|
||||
}
|
||||
|
||||
const config = browserslist.findConfig(context);
|
||||
|
||||
if (config && Object.keys(config).includes(input)) {
|
||||
return { env: input };
|
||||
}
|
||||
|
||||
return { query: input };
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string | null | undefined} input input string
|
||||
* @param {string} context the context directory
|
||||
* @returns {string[] | undefined} selected browsers
|
||||
*/
|
||||
const load = (input, context) => {
|
||||
const { configPath, env, query } = parse(input, context);
|
||||
// browserslist:path-to-config
|
||||
// browserslist:path-to-config:env
|
||||
if (input && path.isAbsolute(input)) {
|
||||
const [, configPath, env] = inputRx.exec(input) || [];
|
||||
|
||||
// if a query is specified, then use it, else
|
||||
// if a path to a config is specified then load it, else
|
||||
// find a nearest config
|
||||
const config =
|
||||
query ||
|
||||
(configPath
|
||||
? browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
})
|
||||
: browserslist.loadConfig({ path: context, env }));
|
||||
const config = browserslist.loadConfig({
|
||||
config: configPath,
|
||||
env
|
||||
});
|
||||
|
||||
if (!config) return;
|
||||
return browserslist(config);
|
||||
return browserslist(config, { env });
|
||||
}
|
||||
|
||||
const env = input || undefined;
|
||||
|
||||
const config = browserslist.loadConfig({
|
||||
path: context,
|
||||
env
|
||||
});
|
||||
|
||||
// browserslist
|
||||
// browserslist:env
|
||||
if (config) {
|
||||
try {
|
||||
return browserslist(config, { env, throwOnMissing: true });
|
||||
} catch (_err) {
|
||||
// Nothing, no `env` was found in browserslist, maybe input is `queries`
|
||||
}
|
||||
}
|
||||
|
||||
// browserslist:query
|
||||
if (env) {
|
||||
return browserslist(env);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1326,8 +1326,13 @@ const applyOutputDefaults = (
|
|||
if (tp.importScripts) return "array-push";
|
||||
throw new Error(
|
||||
"For the selected environment is no default script chunk format available:\n" +
|
||||
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
|
||||
`CommonJs exports can be chosen when 'require' or node builtins are available.\n${
|
||||
`${
|
||||
tp.module
|
||||
? "Module ('module') can be chosen when ES modules are available (please set 'experiments.outputModule' and 'output.module' to `true`)"
|
||||
: ""
|
||||
}\n` +
|
||||
"JSONP Array push ('array-push') can be chosen when 'document' or 'importScripts' is available.\n" +
|
||||
`CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${
|
||||
helpMessage
|
||||
}`
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ const getBrowserslistTargetHandler = memoize(() =>
|
|||
* @returns {string} default target
|
||||
*/
|
||||
const getDefaultTarget = (context) => {
|
||||
const browsers = getBrowserslistTargetHandler().load(null, context);
|
||||
const browsers = getBrowserslistTargetHandler().load(undefined, context);
|
||||
return browsers ? "browserslist" : "web";
|
||||
};
|
||||
|
||||
|
|
|
@ -232,6 +232,9 @@ module.exports = mergeExports(fn, {
|
|||
get DynamicEntryPlugin() {
|
||||
return require("./DynamicEntryPlugin");
|
||||
},
|
||||
get DotenvPlugin() {
|
||||
return require("./DotenvPlugin");
|
||||
},
|
||||
get EntryOptionPlugin() {
|
||||
return require("./EntryOptionPlugin");
|
||||
},
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
"@webassemblyjs/wasm-parser": "^1.14.1",
|
||||
"acorn": "^8.15.0",
|
||||
"acorn-import-phases": "^1.0.3",
|
||||
"browserslist": "^4.24.5",
|
||||
"browserslist": "^4.26.3",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.17.3",
|
||||
"es-module-lexer": "^1.2.1",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn fix:special` to update
|
||||
*/
|
||||
declare const check: (options: import("../../declarations/plugins/DotenvPlugin").DotenvPluginOptions) => boolean;
|
||||
export = check;
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn fix:special` to update
|
||||
*/
|
||||
"use strict";function e(r,{instancePath:t="",parentData:s,parentDataProperty:o,rootData:a=r}={}){let n=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("allowEmptyValues"!==t&&"defaults"!==t&&"expand"!==t&&"path"!==t&&"prefix"!==t&&"safe"!==t&&"systemvars"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.allowEmptyValues){const t=l;if("boolean"!=typeof r.allowEmptyValues)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.defaults){let t=r.defaults;const s=l,o=l;let a=!1;const f=l;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===n?n=[e]:n.push(e),l++}var p=f===l;if(a=a||p,!a){const e=l;if(l===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===n?n=[e]:n.push(e),l++}}else{const e={params:{type:"string"}};null===n?n=[e]:n.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===n?n=[r]:n.push(r),l++,e.errors=n,!1}l=o,null!==n&&(o?n.length=o:n=null),i=s===l}else i=!0;if(i){if(void 0!==r.expand){const t=l;if("boolean"!=typeof r.expand)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i){if(void 0!==r.path){let t=r.path;const s=l;if(l===s){if("string"!=typeof t)return e.errors=[{params:{type:"string"}}],!1;if(t.length<1)return e.errors=[{params:{}}],!1}i=s===l}else i=!0;if(i){if(void 0!==r.prefix){let t=r.prefix;const s=l;if(l===s){if("string"!=typeof t)return e.errors=[{params:{type:"string"}}],!1;if(t.length<1)return e.errors=[{params:{}}],!1}i=s===l}else i=!0;if(i){if(void 0!==r.safe){let t=r.safe;const s=l,o=l;let a=!1;const p=l;if("boolean"!=typeof t){const e={params:{type:"boolean"}};null===n?n=[e]:n.push(e),l++}var f=p===l;if(a=a||f,!a){const e=l;if(l===e)if("string"==typeof t){if(t.length<1){const e={params:{}};null===n?n=[e]:n.push(e),l++}}else{const e={params:{type:"string"}};null===n?n=[e]:n.push(e),l++}f=e===l,a=a||f}if(!a){const r={params:{}};return null===n?n=[r]:n.push(r),l++,e.errors=n,!1}l=o,null!==n&&(o?n.length=o:n=null),i=s===l}else i=!0;if(i)if(void 0!==r.systemvars){const t=l;if("boolean"!=typeof r.systemvars)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0}}}}}}}}return e.errors=n,0===l}module.exports=e,module.exports.default=e;
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"title": "DotenvPluginOptions",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"allowEmptyValues": {
|
||||
"description": "Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"defaults": {
|
||||
"description": "Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"expand": {
|
||||
"description": "Allows your variables to be \"expanded\" for reusability within your .env file.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"path": {
|
||||
"description": "The path to your environment variables. This same path applies to the .env.example and .env.defaults files.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"prefix": {
|
||||
"description": "The prefix to use before the name of your env variables.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"safe": {
|
||||
"description": "If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"systemvars": {
|
||||
"description": "Set to true if you would rather load all system variables as well (useful for CI purposes).",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
extends browserslist-config-mycompany
|
|
@ -0,0 +1 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
production: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: `browserslist:${path.join(__dirname, ".browserslistrc")}:production`,
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
extends browserslist-config-mycompany1
|
|
@ -0,0 +1 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany1"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
// We are in tests, so 'process.env.NODE_ENV' has the 'test' value (browserslist respects the 'process.env.NODE_ENV' value)
|
||||
test: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: `browserslist:${path.join(__dirname, ".browserslistrc")}`,
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"browserslist": {
|
||||
"development": [
|
||||
"last 1 version"
|
||||
],
|
||||
"production": [
|
||||
"ie 9"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist:production",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"browserslist": [
|
||||
"extends browserslist-config-mycompany2"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootPath = path.resolve(__dirname, "../../../../");
|
||||
const rootNodeModules = path.resolve(rootPath, "./node_modules");
|
||||
const browserslistPackage = path.resolve(
|
||||
rootNodeModules,
|
||||
"browserslist-config-mycompany2"
|
||||
);
|
||||
const content = `
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
// We are in tests, so 'process.env.NODE_ENV' has the 'test' value (browserslist respects the 'process.env.NODE_ENV' value)
|
||||
test: [
|
||||
'ie 9',
|
||||
]
|
||||
}
|
||||
`;
|
||||
const browserslistFile = path.resolve(browserslistPackage, "./index.js");
|
||||
|
||||
try {
|
||||
fs.mkdirSync(browserslistPackage);
|
||||
} catch (_err) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
fs.writeFileSync(browserslistFile, content);
|
||||
|
||||
module.exports = {
|
||||
afterExecute() {
|
||||
fs.unlinkSync(browserslistFile);
|
||||
fs.rmdirSync(browserslistPackage);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": false,
|
||||
"asyncFunction": false,
|
||||
"bigIntLiteral": false,
|
||||
"const": false,
|
||||
"destructuring": false,
|
||||
"document": true,
|
||||
"dynamicImport": false,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": false,
|
||||
"globalThis": false,
|
||||
"module": false,
|
||||
"nodePrefixForCoreModules": false,
|
||||
"optionalChaining": false,
|
||||
"templateLiteral": false,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": false,
|
||||
"nwjs": false,
|
||||
"web": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
it("should compile and run the test", function() {});
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"browserslist": {
|
||||
"development": [
|
||||
"last 1 version"
|
||||
],
|
||||
"production": [
|
||||
"ie 9"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "browserslist:maintained node versions",
|
||||
plugins: [
|
||||
(compiler) => {
|
||||
compiler.hooks.compilation.tap("Test", (compilation) => {
|
||||
expect(compilation.outputOptions.environment).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arrowFunction": true,
|
||||
"asyncFunction": true,
|
||||
"bigIntLiteral": true,
|
||||
"const": true,
|
||||
"destructuring": true,
|
||||
"document": false,
|
||||
"dynamicImport": true,
|
||||
"dynamicImportInWorker": false,
|
||||
"forOf": true,
|
||||
"globalThis": true,
|
||||
"module": true,
|
||||
"nodePrefixForCoreModules": true,
|
||||
"optionalChaining": true,
|
||||
"templateLiteral": true,
|
||||
}
|
||||
`);
|
||||
expect(compilation.options.externalsPresets).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"electron": false,
|
||||
"electronMain": false,
|
||||
"electronPreload": false,
|
||||
"electronRenderer": false,
|
||||
"node": true,
|
||||
"nwjs": false,
|
||||
"web": false,
|
||||
}
|
||||
`);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
MY_NODE_ENV=test
|
||||
API_URL=https://api.example.com
|
||||
DEBUG=true
|
||||
PORT=3000
|
||||
SECRET_KEY=my-secret-key
|
||||
EMPTY_VALUE=
|
||||
INTERPOLATED_VAR=$MY_NODE_ENV-mode
|
|
@ -0,0 +1,3 @@
|
|||
MY_NODE_ENV=development
|
||||
PORT=8080
|
||||
DEFAULT_VALUE=default-from-defaults
|
|
@ -0,0 +1,6 @@
|
|||
MY_NODE_ENV=
|
||||
API_URL=
|
||||
DEBUG=
|
||||
PORT=
|
||||
SECRET_KEY=
|
||||
REQUIRED_VAR=
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
it("should load basic .env variables", () => {
|
||||
expect(process.env.MY_NODE_ENV).toBe("test");
|
||||
expect(process.env.API_URL).toBe("https://api.example.com");
|
||||
expect(process.env.DEBUG).toBe("true");
|
||||
expect(process.env.PORT).toBe("3000");
|
||||
expect(process.env.SECRET_KEY).toBe("my-secret-key");
|
||||
expect(process.env.EMPTY_VALUE).toBe("");
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
it("should load from custom path", () => {
|
||||
// When using .env.example as path, values should be empty (as defined in .env.example)
|
||||
expect(process.env.MY_NODE_ENV).toBe("");
|
||||
expect(process.env.API_URL).toBe("");
|
||||
expect(process.env.DEBUG).toBe("");
|
||||
expect(process.env.PORT).toBe("");
|
||||
expect(process.env.SECRET_KEY).toBe("");
|
||||
expect(process.env.REQUIRED_VAR).toBe("");
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
it("should use custom prefix", () => {
|
||||
expect(MY_ENV.MY_NODE_ENV).toBe("test");
|
||||
expect(MY_ENV.API_URL).toBe("https://api.example.com");
|
||||
expect(MY_ENV.DEBUG).toBe("true");
|
||||
expect(MY_ENV.PORT).toBe("3000");
|
||||
expect(MY_ENV.SECRET_KEY).toBe("my-secret-key");
|
||||
|
||||
// process.env should not be defined with custom prefix
|
||||
expect(typeof process.env.MY_NODE_ENV).toBe("undefined");
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
it("should load variables with defaults", () => {
|
||||
// Main .env values should override defaults
|
||||
expect(process.env.MY_NODE_ENV).toBe("test");
|
||||
expect(process.env.PORT).toBe("3000");
|
||||
|
||||
// Default values should be used when not in main .env
|
||||
expect(process.env.DEFAULT_VALUE).toBe("default-from-defaults");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = [/Missing environment variable: /];
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
it("should expand variables when expand is true", () => {
|
||||
expect(process.env.INTERPOLATED_VAR).toBe("test-mode");
|
||||
expect(process.env.MY_NODE_ENV).toBe("test");
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
MY_NODE_ENV=test
|
||||
API_URL=https://api.example.com
|
||||
DEBUG=true
|
||||
PORT=3000
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
it("should include system variables when systemvars is true", () => {
|
||||
// System variables should be available (we can't predict exact values, but PATH should exist)
|
||||
expect(typeof process.env.PATH).toBe("string");
|
||||
expect(process.env.PATH.length).toBeGreaterThan(0);
|
||||
|
||||
// .env variables should also be loaded
|
||||
expect(process.env.MY_NODE_ENV).toBe("test");
|
||||
expect(process.env.API_URL).toBe("https://api.example.com");
|
||||
|
||||
// NODE_ENV might be set by the system/test environment
|
||||
// We just check that it exists as a system variable
|
||||
expect(typeof process.env.NODE_ENV).toBe("string");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = [[/Conflicting values for 'process.env.NODE_ENV'/]];
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
const DotenvPlugin = require("../../../../lib/DotenvPlugin");
|
||||
|
||||
/** @type {import("../../../../").Configuration[]} */
|
||||
module.exports = [
|
||||
{
|
||||
name: "basic",
|
||||
entry: "./basic",
|
||||
plugins: [new DotenvPlugin()]
|
||||
},
|
||||
{
|
||||
name: "with-defaults",
|
||||
entry: "./defaults",
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
defaults: true
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "with-expand",
|
||||
entry: "./expand",
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
expand: true
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "with-systemvars",
|
||||
entry: "./systemvars",
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
systemvars: true
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "custom-path",
|
||||
entry: "./custom-path",
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
path: "./.env.example"
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "custom-prefix",
|
||||
entry: "./custom-prefix",
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
prefix: "MY_ENV."
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "safe-mode-error",
|
||||
entry: "./basic", // Use existing entry file
|
||||
plugins: [
|
||||
new DotenvPlugin({
|
||||
path: "./incomplete.env",
|
||||
safe: "./.env.example"
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
|
@ -4336,6 +4336,109 @@ declare interface DllReferencePluginOptionsManifest {
|
|||
| "jsonp"
|
||||
| "system";
|
||||
}
|
||||
declare class DotenvPlugin {
|
||||
constructor(options?: DotenvPluginOptions);
|
||||
config: {
|
||||
/**
|
||||
* Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).
|
||||
*/
|
||||
allowEmptyValues?: boolean;
|
||||
/**
|
||||
* Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.
|
||||
*/
|
||||
defaults?: string | boolean;
|
||||
/**
|
||||
* Allows your variables to be "expanded" for reusability within your .env file.
|
||||
*/
|
||||
expand?: boolean;
|
||||
/**
|
||||
* The path to your environment variables. This same path applies to the .env.example and .env.defaults files.
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* The prefix to use before the name of your env variables.
|
||||
*/
|
||||
prefix: string;
|
||||
/**
|
||||
* If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
|
||||
*/
|
||||
safe?: string | boolean;
|
||||
/**
|
||||
* Set to true if you would rather load all system variables as well (useful for CI purposes).
|
||||
*/
|
||||
systemvars?: boolean;
|
||||
};
|
||||
apply(compiler: Compiler): void;
|
||||
gatherVariables(
|
||||
inputFileSystem: InputFileSystem,
|
||||
context: string,
|
||||
callback: (
|
||||
err: null | Error,
|
||||
variables?: Record<string, string>,
|
||||
fileDependencies?: string[]
|
||||
) => void
|
||||
): void;
|
||||
initializeVars(): Record<string, string>;
|
||||
getEnvs(
|
||||
inputFileSystem: InputFileSystem,
|
||||
context: string,
|
||||
callback: (
|
||||
err: null | Error,
|
||||
result?: {
|
||||
env: Record<string, string>;
|
||||
blueprint: Record<string, string>;
|
||||
fileDependencies: string[];
|
||||
}
|
||||
) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Load a file with proper path resolution
|
||||
*/
|
||||
loadFile(fs: InputFileSystem, file: string): Promise<string>;
|
||||
resolvePath(
|
||||
file: string,
|
||||
inputFileSystem: InputFileSystem,
|
||||
context: string
|
||||
): string;
|
||||
formatVariables(variables: Record<string, string>): Record<string, string>;
|
||||
}
|
||||
declare interface DotenvPluginOptions {
|
||||
/**
|
||||
* Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).
|
||||
*/
|
||||
allowEmptyValues?: boolean;
|
||||
|
||||
/**
|
||||
* Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.
|
||||
*/
|
||||
defaults?: string | boolean;
|
||||
|
||||
/**
|
||||
* Allows your variables to be "expanded" for reusability within your .env file.
|
||||
*/
|
||||
expand?: boolean;
|
||||
|
||||
/**
|
||||
* The path to your environment variables. This same path applies to the .env.example and .env.defaults files.
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* The prefix to use before the name of your env variables.
|
||||
*/
|
||||
prefix?: string;
|
||||
|
||||
/**
|
||||
* If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
|
||||
*/
|
||||
safe?: string | boolean;
|
||||
|
||||
/**
|
||||
* Set to true if you would rather load all system variables as well (useful for CI purposes).
|
||||
*/
|
||||
systemvars?: boolean;
|
||||
}
|
||||
declare class DynamicEntryPlugin {
|
||||
constructor(context: string, entry: () => Promise<EntryStaticNormalized>);
|
||||
context: string;
|
||||
|
@ -18916,6 +19019,7 @@ declare namespace exports {
|
|||
DllPlugin,
|
||||
DllReferencePlugin,
|
||||
DynamicEntryPlugin,
|
||||
DotenvPlugin,
|
||||
EntryOptionPlugin,
|
||||
EntryPlugin,
|
||||
EnvironmentPlugin,
|
||||
|
|
134
yarn.lock
134
yarn.lock
|
@ -995,13 +995,6 @@
|
|||
"@types/node" "*"
|
||||
jest-mock "30.2.0"
|
||||
|
||||
"@jest/expect-utils@30.1.2":
|
||||
version "30.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.1.2.tgz#88ea18040f707c9fadb6fd9e77568cae5266cee8"
|
||||
integrity sha512-HXy1qT/bfdjCv7iC336ExbqqYtZvljrV8odNdso7dWK9bSeHtLlvwWWC3YSybSPL03Gg5rug6WLCZAZFH72m0A==
|
||||
dependencies:
|
||||
"@jest/get-type" "30.1.0"
|
||||
|
||||
"@jest/expect-utils@30.2.0":
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.2.0.tgz#4f95413d4748454fdb17404bf1141827d15e6011"
|
||||
|
@ -1148,19 +1141,6 @@
|
|||
slash "^3.0.0"
|
||||
write-file-atomic "^5.0.1"
|
||||
|
||||
"@jest/types@30.0.5":
|
||||
version "30.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.5.tgz#29a33a4c036e3904f1cfd94f6fe77f89d2e1cc05"
|
||||
integrity sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==
|
||||
dependencies:
|
||||
"@jest/pattern" "30.0.1"
|
||||
"@jest/schemas" "30.0.5"
|
||||
"@types/istanbul-lib-coverage" "^2.0.6"
|
||||
"@types/istanbul-reports" "^3.0.4"
|
||||
"@types/node" "*"
|
||||
"@types/yargs" "^17.0.33"
|
||||
chalk "^4.1.2"
|
||||
|
||||
"@jest/types@30.2.0":
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.2.0.tgz#1c678a7924b8f59eafd4c77d56b6d0ba976d62b8"
|
||||
|
@ -2252,6 +2232,11 @@ base64-js@^1.3.1:
|
|||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||
|
||||
baseline-browser-mapping@^2.8.9:
|
||||
version "2.8.10"
|
||||
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.8.10.tgz#32eb5e253d633fa3fa3ffb1685fabf41680d9e8a"
|
||||
integrity sha512-uLfgBi+7IBNay8ECBO2mVMGZAc1VgZWEChxm4lv+TobGdG82LnXMjuNGo/BSSZZL4UmkWhxEHP2f5ziLNwGWMA==
|
||||
|
||||
big.js@^5.2.2:
|
||||
version "5.2.2"
|
||||
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
|
||||
|
@ -2284,14 +2269,15 @@ braces@^3.0.3:
|
|||
dependencies:
|
||||
fill-range "^7.1.1"
|
||||
|
||||
browserslist@^4.24.0, browserslist@^4.24.5, browserslist@^4.25.1:
|
||||
version "4.25.4"
|
||||
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.4.tgz#ebdd0e1d1cf3911834bab3a6cd7b917d9babf5af"
|
||||
integrity sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==
|
||||
browserslist@^4.24.0, browserslist@^4.25.1, browserslist@^4.26.3:
|
||||
version "4.26.3"
|
||||
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.26.3.tgz#40fbfe2d1cd420281ce5b1caa8840049c79afb56"
|
||||
integrity sha512-lAUU+02RFBuCKQPj/P6NgjlbCnLBMp4UtgTx7vNHd3XSIJF87s9a5rA3aH2yw3GS9DqZAUbOtZdCCiZeVRqt0w==
|
||||
dependencies:
|
||||
caniuse-lite "^1.0.30001737"
|
||||
electron-to-chromium "^1.5.211"
|
||||
node-releases "^2.0.19"
|
||||
baseline-browser-mapping "^2.8.9"
|
||||
caniuse-lite "^1.0.30001746"
|
||||
electron-to-chromium "^1.5.227"
|
||||
node-releases "^2.0.21"
|
||||
update-browserslist-db "^1.1.3"
|
||||
|
||||
bser@2.1.1:
|
||||
|
@ -2407,10 +2393,10 @@ camelcase@^6.3.0:
|
|||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
|
||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||
|
||||
caniuse-lite@^1.0.30001737:
|
||||
version "1.0.30001739"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001739.tgz#b34ce2d56bfc22f4352b2af0144102d623a124f4"
|
||||
integrity sha512-y+j60d6ulelrNSwpPyrHdl+9mJnQzHBr08xm48Qno0nSk4h3Qojh+ziv2qE6rXf4k3tadF4o1J/1tAbVm1NtnA==
|
||||
caniuse-lite@^1.0.30001737, caniuse-lite@^1.0.30001746:
|
||||
version "1.0.30001746"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001746.tgz#199d20f04f5369825e00ff7067d45d5dfa03aee7"
|
||||
integrity sha512-eA7Ys/DGw+pnkWWSE/id29f2IcPHVoE8wxtvE5JdvD2V28VTDPy1yEeo11Guz0sJ4ZeGRcm3uaTcAqK1LXaphA==
|
||||
|
||||
ccount@^2.0.0:
|
||||
version "2.0.1"
|
||||
|
@ -3048,10 +3034,10 @@ eastasianwidth@^0.2.0:
|
|||
resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
|
||||
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
|
||||
|
||||
electron-to-chromium@^1.5.211:
|
||||
version "1.5.211"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.211.tgz#749317bf9cf894c06f67980940cf8074e5eb08ca"
|
||||
integrity sha512-IGBvimJkotaLzFnwIVgW9/UD/AOJ2tByUmeOrtqBfACSbAw5b1G0XpvdaieKyc7ULmbwXVx+4e4Be8pOPBrYkw==
|
||||
electron-to-chromium@^1.5.211, electron-to-chromium@^1.5.227:
|
||||
version "1.5.228"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.228.tgz#38b849bc8714bd21fb64f5ad56bf8cfd8638e1e9"
|
||||
integrity sha512-nxkiyuqAn4MJ1QbobwqJILiDtu/jk14hEAWaMiJmNPh1Z+jqoFlBFZjdXwLWGeVSeu9hGLg6+2G9yJaW8rBIFA==
|
||||
|
||||
emittery@^0.13.1:
|
||||
version "0.13.1"
|
||||
|
@ -4862,16 +4848,6 @@ jest-config@30.2.0:
|
|||
slash "^3.0.0"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
jest-diff@30.1.2:
|
||||
version "30.1.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.1.2.tgz#8ff4217e5b63fef49a5b37462999d8f5299a4eb4"
|
||||
integrity sha512-4+prq+9J61mOVXCa4Qp8ZjavdxzrWQXrI80GNxP8f4tkI2syPuPrJgdRPZRrfUTRvIoUwcmNLbqEJy9W800+NQ==
|
||||
dependencies:
|
||||
"@jest/diff-sequences" "30.0.1"
|
||||
"@jest/get-type" "30.1.0"
|
||||
chalk "^4.1.2"
|
||||
pretty-format "30.0.5"
|
||||
|
||||
jest-diff@30.2.0, jest-diff@^30.2.0:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.2.0.tgz#e3ec3a6ea5c5747f605c9e874f83d756cba36825"
|
||||
|
@ -4949,16 +4925,6 @@ jest-leak-detector@30.2.0:
|
|||
"@jest/get-type" "30.1.0"
|
||||
pretty-format "30.2.0"
|
||||
|
||||
jest-matcher-utils@30.1.2:
|
||||
version "30.1.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.1.2.tgz#3f1b63949f740025aff740c6c6a1b653ae370fbb"
|
||||
integrity sha512-7ai16hy4rSbDjvPTuUhuV8nyPBd6EX34HkBsBcBX2lENCuAQ0qKCPb/+lt8OSWUa9WWmGYLy41PrEzkwRwoGZQ==
|
||||
dependencies:
|
||||
"@jest/get-type" "30.1.0"
|
||||
chalk "^4.1.2"
|
||||
jest-diff "30.1.2"
|
||||
pretty-format "30.0.5"
|
||||
|
||||
jest-matcher-utils@30.2.0:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.2.0.tgz#69a0d4c271066559ec8b0d8174829adc3f23a783"
|
||||
|
@ -4969,21 +4935,6 @@ jest-matcher-utils@30.2.0:
|
|||
jest-diff "30.2.0"
|
||||
pretty-format "30.2.0"
|
||||
|
||||
jest-message-util@30.1.0:
|
||||
version "30.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.1.0.tgz#653a9bb1a33306eddf13455ce0666ba621b767c4"
|
||||
integrity sha512-HizKDGG98cYkWmaLUHChq4iN+oCENohQLb7Z5guBPumYs+/etonmNFlg1Ps6yN9LTPyZn+M+b/9BbnHx3WTMDg==
|
||||
dependencies:
|
||||
"@babel/code-frame" "^7.27.1"
|
||||
"@jest/types" "30.0.5"
|
||||
"@types/stack-utils" "^2.0.3"
|
||||
chalk "^4.1.2"
|
||||
graceful-fs "^4.2.11"
|
||||
micromatch "^4.0.8"
|
||||
pretty-format "30.0.5"
|
||||
slash "^3.0.0"
|
||||
stack-utils "^2.0.6"
|
||||
|
||||
jest-message-util@30.2.0:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.2.0.tgz#fc97bf90d11f118b31e6131e2b67fc4f39f92152"
|
||||
|
@ -4999,15 +4950,6 @@ jest-message-util@30.2.0:
|
|||
slash "^3.0.0"
|
||||
stack-utils "^2.0.6"
|
||||
|
||||
jest-mock@30.0.5:
|
||||
version "30.0.5"
|
||||
resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.5.tgz#ef437e89212560dd395198115550085038570bdd"
|
||||
integrity sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==
|
||||
dependencies:
|
||||
"@jest/types" "30.0.5"
|
||||
"@types/node" "*"
|
||||
jest-util "30.0.5"
|
||||
|
||||
jest-mock@30.2.0:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.2.0.tgz#69f991614eeb4060189459d3584f710845bff45e"
|
||||
|
@ -5132,18 +5074,6 @@ jest-snapshot@30.2.0:
|
|||
semver "^7.7.2"
|
||||
synckit "^0.11.8"
|
||||
|
||||
jest-util@30.0.5:
|
||||
version "30.0.5"
|
||||
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.5.tgz#035d380c660ad5f1748dff71c4105338e05f8669"
|
||||
integrity sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==
|
||||
dependencies:
|
||||
"@jest/types" "30.0.5"
|
||||
"@types/node" "*"
|
||||
chalk "^4.1.2"
|
||||
ci-info "^4.2.0"
|
||||
graceful-fs "^4.2.11"
|
||||
picomatch "^4.0.2"
|
||||
|
||||
jest-util@30.2.0:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.2.0.tgz#5142adbcad6f4e53c2776c067a4db3c14f913705"
|
||||
|
@ -6317,10 +6247,10 @@ node-preload@^0.2.1:
|
|||
dependencies:
|
||||
process-on-spawn "^1.0.0"
|
||||
|
||||
node-releases@^2.0.19:
|
||||
version "2.0.19"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314"
|
||||
integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==
|
||||
node-releases@^2.0.19, node-releases@^2.0.21:
|
||||
version "2.0.21"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.21.tgz#f59b018bc0048044be2d4c4c04e4c8b18160894c"
|
||||
integrity sha512-5b0pgg78U3hwXkCM8Z9b2FJdPZlr9Psr9V2gQPESdGHqbntyFJKFW4r5TeWGFzafGY3hzs1JC62VEQMbl1JFkw==
|
||||
|
||||
nopt@3.x:
|
||||
version "3.0.6"
|
||||
|
@ -6799,15 +6729,6 @@ prettier@^3.6.0:
|
|||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393"
|
||||
integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==
|
||||
|
||||
pretty-format@30.0.5:
|
||||
version "30.0.5"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.5.tgz#e001649d472800396c1209684483e18a4d250360"
|
||||
integrity sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==
|
||||
dependencies:
|
||||
"@jest/schemas" "30.0.5"
|
||||
ansi-styles "^5.2.0"
|
||||
react-is "^18.3.1"
|
||||
|
||||
pretty-format@30.2.0, pretty-format@^30.0.0, pretty-format@^30.0.5:
|
||||
version "30.2.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.2.0.tgz#2d44fe6134529aed18506f6d11509d8a62775ebe"
|
||||
|
@ -8072,11 +7993,6 @@ unbox-primitive@^1.1.0:
|
|||
has-symbols "^1.1.0"
|
||||
which-boxed-primitive "^1.1.1"
|
||||
|
||||
undici-types@~7.10.0:
|
||||
version "7.10.0"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350"
|
||||
integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==
|
||||
|
||||
undici-types@~7.13.0:
|
||||
version "7.13.0"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.13.0.tgz#a20ba7c0a2be0c97bd55c308069d29d167466bff"
|
||||
|
|
Loading…
Reference in New Issue