@jsenv/ast 5.1.1 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/ast",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "Parse and transform HTML,CSS and JS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"test": "node --conditions=development ./scripts/test.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/parser": "7.22.
|
|
36
|
+
"@babel/parser": "7.22.16",
|
|
37
37
|
"@jsenv/urls": "2.2.1",
|
|
38
38
|
"acorn": "8.10.0",
|
|
39
39
|
"acorn-import-assertions": "1.9.0",
|
|
40
40
|
"acorn-walk": "8.2.0",
|
|
41
41
|
"parse5": "7.1.2",
|
|
42
|
-
"postcss": "8.4.
|
|
42
|
+
"postcss": "8.4.29",
|
|
43
43
|
"postcss-value-parser": "4.2.0"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -53,12 +53,12 @@ export const applyBabelPlugins = async ({
|
|
|
53
53
|
...(options.parserPlugins || []),
|
|
54
54
|
].filter(Boolean),
|
|
55
55
|
},
|
|
56
|
+
plugins: babelPlugins,
|
|
57
|
+
...options,
|
|
56
58
|
generatorOpts: {
|
|
57
59
|
compact: false,
|
|
58
60
|
...(options.generatorOpts || {}),
|
|
59
61
|
},
|
|
60
|
-
plugins: babelPlugins,
|
|
61
|
-
...options,
|
|
62
62
|
};
|
|
63
63
|
try {
|
|
64
64
|
if (ast) {
|
|
@@ -12,9 +12,10 @@ export const isNewWorkerCall = (node) => {
|
|
|
12
12
|
node.callee.name === "Worker"
|
|
13
13
|
);
|
|
14
14
|
};
|
|
15
|
-
export const analyzeNewWorkerCall = (node, { isJsModule, onUrl }) => {
|
|
15
|
+
export const analyzeNewWorkerCall = (node, { isJsModule, isNodeJs, onUrl }) => {
|
|
16
16
|
analyzeWorkerCallArguments(node, {
|
|
17
17
|
isJsModule,
|
|
18
|
+
isNodeJs,
|
|
18
19
|
onUrl,
|
|
19
20
|
referenceSubtype: "new_worker_first_arg",
|
|
20
21
|
expectedSubtype: "worker",
|
package/src/js/parse_js_urls.js
CHANGED
|
@@ -55,6 +55,7 @@ export const parseJsUrls = ({
|
|
|
55
55
|
isJsModule = false,
|
|
56
56
|
isWebWorker = false,
|
|
57
57
|
inlineContent = true,
|
|
58
|
+
isNodeJs = false,
|
|
58
59
|
} = {}) => {
|
|
59
60
|
const jsUrls = [];
|
|
60
61
|
if (ast === undefined) {
|
|
@@ -134,7 +135,7 @@ export const parseJsUrls = ({
|
|
|
134
135
|
analyzeImportMetaResolveCall(node, { onUrl });
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
137
|
-
if (isServiceWorkerRegisterCall(node)) {
|
|
138
|
+
if (!isNodeJs && isServiceWorkerRegisterCall(node)) {
|
|
138
139
|
analyzeServiceWorkerRegisterCall(node, {
|
|
139
140
|
isJsModule,
|
|
140
141
|
onUrl,
|
|
@@ -177,11 +178,12 @@ export const parseJsUrls = ({
|
|
|
177
178
|
if (isNewWorkerCall(node)) {
|
|
178
179
|
analyzeNewWorkerCall(node, {
|
|
179
180
|
isJsModule,
|
|
181
|
+
isNodeJs,
|
|
180
182
|
onUrl,
|
|
181
183
|
});
|
|
182
184
|
return;
|
|
183
185
|
}
|
|
184
|
-
if (isNewSharedWorkerCall(node)) {
|
|
186
|
+
if (!isNodeJs && isNewSharedWorkerCall(node)) {
|
|
185
187
|
analyzeNewSharedWorkerCall(node, {
|
|
186
188
|
isJsModule,
|
|
187
189
|
onUrl,
|