Skip to content

Commit

Permalink
add parserOptions.importMetaContext option
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Mar 3, 2022
1 parent 75383c9 commit 1dbc631
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
4 changes: 4 additions & 0 deletions declarations/WebpackOptions.d.ts
Expand Up @@ -2965,6 +2965,10 @@ export interface JavascriptParserOptions {
* Enable/disable evaluating import.meta.
*/
importMeta?: boolean;
/**
* Enable/disable evaluating import.meta.webpackContext.
*/
importMetaContext?: boolean;
/**
* Include polyfills or mocks for various node stuff.
*/
Expand Down
2 changes: 1 addition & 1 deletion schemas/WebpackOptions.check.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions schemas/WebpackOptions.json
Expand Up @@ -1624,6 +1624,10 @@
"description": "Enable/disable evaluating import.meta.",
"type": "boolean"
},
"importMetaContext": {
"description": "Enable/disable evaluating import.meta.webpackContext.",
"type": "boolean"
},
"node": {
"$ref": "#/definitions/Node"
},
Expand Down
52 changes: 52 additions & 0 deletions test/__snapshots__/Cli.basictest.js.snap
Expand Up @@ -1638,6 +1638,19 @@ Object {
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-auto-import-meta-context": Object {
"configs": Array [
Object {
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"path": "module.parser.javascript/auto.importMetaContext",
"type": "boolean",
},
],
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-auto-node": Object {
"configs": Array [
Object {
Expand Down Expand Up @@ -2202,6 +2215,19 @@ Object {
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-dynamic-import-meta-context": Object {
"configs": Array [
Object {
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"path": "module.parser.javascript/dynamic.importMetaContext",
"type": "boolean",
},
],
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-dynamic-node": Object {
"configs": Array [
Object {
Expand Down Expand Up @@ -2727,6 +2753,19 @@ Object {
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-esm-import-meta-context": Object {
"configs": Array [
Object {
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"path": "module.parser.javascript/esm.importMetaContext",
"type": "boolean",
},
],
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-esm-node": Object {
"configs": Array [
Object {
Expand Down Expand Up @@ -3197,6 +3236,19 @@ Object {
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-import-meta-context": Object {
"configs": Array [
Object {
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"path": "module.parser.javascript.importMetaContext",
"type": "boolean",
},
],
"description": "Enable/disable evaluating import.meta.webpackContext.",
"multiple": false,
"simpleType": "boolean",
},
"module-parser-javascript-node": Object {
"configs": Array [
Object {
Expand Down
12 changes: 11 additions & 1 deletion types.d.ts
Expand Up @@ -5508,6 +5508,11 @@ declare interface JavascriptParserOptions {
*/
importMeta?: boolean;

/**
* Enable/disable evaluating import.meta.webpackContext.
*/
importMetaContext?: boolean;

/**
* Include polyfills or mocks for various node stuff.
*/
Expand Down Expand Up @@ -9484,6 +9489,11 @@ declare interface ResolveContext {
* log function
*/
log?: (arg0: string) => void;

/**
* yield result, if provided plugins can return several results
*/
yield?: (arg0: ResolveRequest) => void;
}
declare interface ResolveData {
contextInfo: ModuleFactoryCreateDataContextInfo;
Expand Down Expand Up @@ -11932,7 +11942,7 @@ declare interface UserResolveOptions {
restrictions?: (string | RegExp)[];

/**
* Use only the sync constiants of the file system calls
* Use only the sync constraints of the file system calls
*/
useSyncFileSystemCalls?: boolean;

Expand Down

0 comments on commit 1dbc631

Please sign in to comment.