@jsenv/core 38.4.20 → 39.0.0
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/dist/jsenv_core.js +26 -28
- package/package.json +6 -6
package/dist/jsenv_core.js
CHANGED
|
@@ -9141,15 +9141,15 @@ const JS_QUOTE_REPLACEMENTS = {
|
|
|
9141
9141
|
* ```js
|
|
9142
9142
|
* const file = "./style.css"
|
|
9143
9143
|
* const type = "css"
|
|
9144
|
-
* import(file, {
|
|
9144
|
+
* import(file, { with: { type }})
|
|
9145
9145
|
* ```
|
|
9146
9146
|
* Jsenv could throw an error when it knows some browsers in runtimeCompat
|
|
9147
|
-
* do not support import
|
|
9147
|
+
* do not support import attributes
|
|
9148
9148
|
* But for now (as it is simpler) we let the browser throw the error
|
|
9149
9149
|
*/
|
|
9150
9150
|
|
|
9151
9151
|
|
|
9152
|
-
const
|
|
9152
|
+
const jsenvPluginImportAttributes = ({
|
|
9153
9153
|
json = "auto",
|
|
9154
9154
|
css = "auto",
|
|
9155
9155
|
text = "auto",
|
|
@@ -9172,17 +9172,17 @@ const jsenvPluginImportAssertions = ({
|
|
|
9172
9172
|
} else {
|
|
9173
9173
|
const { importTypeAttributeNode } = reference.astInfo;
|
|
9174
9174
|
const content = reference.ownerUrlInfo.content;
|
|
9175
|
-
const
|
|
9176
|
-
"
|
|
9177
|
-
importTypeAttributeNode.start - "
|
|
9175
|
+
const withKeywordStart = content.indexOf(
|
|
9176
|
+
"with",
|
|
9177
|
+
importTypeAttributeNode.start - " with { ".length,
|
|
9178
9178
|
);
|
|
9179
|
-
const
|
|
9179
|
+
const withKeywordEnd = content.indexOf(
|
|
9180
9180
|
"}",
|
|
9181
9181
|
importTypeAttributeNode.end,
|
|
9182
9182
|
);
|
|
9183
9183
|
magicSource.remove({
|
|
9184
|
-
start:
|
|
9185
|
-
end:
|
|
9184
|
+
start: withKeywordStart,
|
|
9185
|
+
end: withKeywordEnd + 1,
|
|
9186
9186
|
});
|
|
9187
9187
|
}
|
|
9188
9188
|
};
|
|
@@ -10161,7 +10161,7 @@ const analyzeConstructableStyleSheetUsage = (urlInfo) => {
|
|
|
10161
10161
|
// import('./' + moduleName)
|
|
10162
10162
|
return false;
|
|
10163
10163
|
}
|
|
10164
|
-
if (
|
|
10164
|
+
if (hasImportTypeCssAttribute(node)) {
|
|
10165
10165
|
return node;
|
|
10166
10166
|
}
|
|
10167
10167
|
if (hasCssModuleQueryParam(source)) {
|
|
@@ -10174,7 +10174,7 @@ const analyzeConstructableStyleSheetUsage = (urlInfo) => {
|
|
|
10174
10174
|
if (hasCssModuleQueryParam(source)) {
|
|
10175
10175
|
return source;
|
|
10176
10176
|
}
|
|
10177
|
-
if (
|
|
10177
|
+
if (hasImportTypeCssAttribute(node)) {
|
|
10178
10178
|
return node;
|
|
10179
10179
|
}
|
|
10180
10180
|
return false;
|
|
@@ -10236,22 +10236,20 @@ const hasCssModuleQueryParam = (node) => {
|
|
|
10236
10236
|
);
|
|
10237
10237
|
};
|
|
10238
10238
|
|
|
10239
|
-
const
|
|
10240
|
-
const
|
|
10241
|
-
|
|
10242
|
-
);
|
|
10243
|
-
return Boolean(importAssertionsDescriptor.type === "css");
|
|
10239
|
+
const hasImportTypeCssAttribute = (node) => {
|
|
10240
|
+
const importAttributes = getImportAttributes(node);
|
|
10241
|
+
return Boolean(importAttributes.type === "css");
|
|
10244
10242
|
};
|
|
10245
10243
|
|
|
10246
|
-
const
|
|
10247
|
-
const
|
|
10248
|
-
if (
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10244
|
+
const getImportAttributes = (importNode) => {
|
|
10245
|
+
const importAttributes = {};
|
|
10246
|
+
if (importNode.attributes) {
|
|
10247
|
+
importNode.attributes.forEach((importAttributeNode) => {
|
|
10248
|
+
importAttributes[importAttributeNode.key.name] =
|
|
10249
|
+
importAttributeNode.value.value;
|
|
10252
10250
|
});
|
|
10253
10251
|
}
|
|
10254
|
-
return
|
|
10252
|
+
return importAttributes;
|
|
10255
10253
|
};
|
|
10256
10254
|
|
|
10257
10255
|
const babelPluginNewStylesheetInjector = (
|
|
@@ -11111,7 +11109,7 @@ const jsenvPluginCssTranspilation = () => {
|
|
|
11111
11109
|
|
|
11112
11110
|
|
|
11113
11111
|
const jsenvPluginTranspilation = ({
|
|
11114
|
-
|
|
11112
|
+
importAttributes = true,
|
|
11115
11113
|
css = true, // TODO
|
|
11116
11114
|
// build sets jsModuleFallback: false during first step of the build
|
|
11117
11115
|
// and re-enable it in the second phase (when performing the bundling)
|
|
@@ -11119,8 +11117,8 @@ const jsenvPluginTranspilation = ({
|
|
|
11119
11117
|
jsModuleFallback = true,
|
|
11120
11118
|
babelHelpersAsImport = true,
|
|
11121
11119
|
}) => {
|
|
11122
|
-
if (
|
|
11123
|
-
|
|
11120
|
+
if (importAttributes === true) {
|
|
11121
|
+
importAttributes = {};
|
|
11124
11122
|
}
|
|
11125
11123
|
if (jsModuleFallback === true) {
|
|
11126
11124
|
jsModuleFallback = {};
|
|
@@ -11132,8 +11130,8 @@ const jsenvPluginTranspilation = ({
|
|
|
11132
11130
|
}),
|
|
11133
11131
|
jsenvPluginAsJsModule(),
|
|
11134
11132
|
...(jsModuleFallback ? [jsenvPluginJsModuleFallback()] : []),
|
|
11135
|
-
...(
|
|
11136
|
-
? [
|
|
11133
|
+
...(importAttributes
|
|
11134
|
+
? [jsenvPluginImportAttributes(importAttributes)]
|
|
11137
11135
|
: []),
|
|
11138
11136
|
|
|
11139
11137
|
...(css ? [jsenvPluginCssTranspilation()] : []),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "39.0.0",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
66
66
|
"@jsenv/abort": "4.3.0",
|
|
67
|
-
"@jsenv/ast": "6.0
|
|
67
|
+
"@jsenv/ast": "6.1.0",
|
|
68
68
|
"@jsenv/filesystem": "4.7.2",
|
|
69
69
|
"@jsenv/humanize": "1.1.3",
|
|
70
70
|
"@jsenv/importmap": "1.2.1",
|
|
71
71
|
"@jsenv/integrity": "0.0.1",
|
|
72
|
-
"@jsenv/js-module-fallback": "1.3.
|
|
72
|
+
"@jsenv/js-module-fallback": "1.3.17",
|
|
73
73
|
"@jsenv/node-esm-resolution": "1.0.2",
|
|
74
74
|
"@jsenv/plugin-bundling": "2.6.12",
|
|
75
75
|
"@jsenv/plugin-minification": "1.5.4",
|
|
76
|
-
"@jsenv/plugin-supervisor": "1.4.
|
|
77
|
-
"@jsenv/plugin-transpilation": "1.
|
|
76
|
+
"@jsenv/plugin-supervisor": "1.4.12",
|
|
77
|
+
"@jsenv/plugin-transpilation": "1.4.0",
|
|
78
78
|
"@jsenv/runtime-compat": "1.3.0",
|
|
79
79
|
"@jsenv/server": "15.2.8",
|
|
80
80
|
"@jsenv/sourcemap": "1.2.10",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@babel/eslint-parser": "7.24.7",
|
|
87
|
-
"@babel/plugin-syntax-import-
|
|
87
|
+
"@babel/plugin-syntax-import-attributes": "7.24.7",
|
|
88
88
|
"@babel/plugin-syntax-optional-chaining-assign": "7.24.7",
|
|
89
89
|
"@jsenv/assert": "./packages/independent/assert/",
|
|
90
90
|
"@jsenv/core": "./",
|