Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parserOptions.importMetaContext option #15463

Merged
merged 1 commit into from Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions 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