@jsenv/core 40.12.9 → 40.12.11
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/build/browserslist_index/browserslist_index.js +14 -4
- package/dist/build/build.js +29 -14
- package/dist/client/import_meta_css/import_meta_css_build.js +2 -2
- package/dist/client/import_meta_css/{import_meta_css.js → import_meta_css_dev.js} +2 -2
- package/dist/start_dev_server/start_dev_server.js +30 -15
- package/package.json +3 -2
- package/src/plugins/import_meta_css/client/import_meta_css_build.js +1 -1
- package/src/plugins/import_meta_css/client/{import_meta_css.js → import_meta_css_dev.js} +1 -1
- package/src/plugins/import_meta_css/jsenv_plugin_import_meta_css.js +29 -14
package/dist/build/build.js
CHANGED
|
@@ -7906,9 +7906,9 @@ const jsenvPluginNodeRuntime = ({ runtimeCompat }) => {
|
|
|
7906
7906
|
|
|
7907
7907
|
|
|
7908
7908
|
const jsenvPluginImportMetaCss = () => {
|
|
7909
|
-
const
|
|
7910
|
-
.resolve("../client/import_meta_css/
|
|
7911
|
-
const
|
|
7909
|
+
const importMetaCssDevClientFileUrl = import.meta
|
|
7910
|
+
.resolve("../client/import_meta_css/import_meta_css_dev.js");
|
|
7911
|
+
const importMetaCssBuildClientFileUrl = import.meta
|
|
7912
7912
|
.resolve("../client/import_meta_css/import_meta_css_build.js");
|
|
7913
7913
|
|
|
7914
7914
|
return {
|
|
@@ -7930,12 +7930,17 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7930
7930
|
if (!usesImportMetaCss) {
|
|
7931
7931
|
return null;
|
|
7932
7932
|
}
|
|
7933
|
-
return injectImportMetaCss(
|
|
7934
|
-
urlInfo
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7933
|
+
return injectImportMetaCss(urlInfo, {
|
|
7934
|
+
importFrom: urlInfo.context.build
|
|
7935
|
+
? importMetaCssBuildClientFileUrl
|
|
7936
|
+
: importMetaCssDevClientFileUrl,
|
|
7937
|
+
importName: urlInfo.context.build
|
|
7938
|
+
? "installImportMetaCssBuild"
|
|
7939
|
+
: "installImportMetaCssDev",
|
|
7940
|
+
importAs: urlInfo.context.build
|
|
7941
|
+
? "__installImportMetaCssBuild__"
|
|
7942
|
+
: "__installImportMetaCssDev__",
|
|
7943
|
+
});
|
|
7939
7944
|
},
|
|
7940
7945
|
},
|
|
7941
7946
|
};
|
|
@@ -7972,17 +7977,25 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
7972
7977
|
};
|
|
7973
7978
|
};
|
|
7974
7979
|
|
|
7975
|
-
const injectImportMetaCss = (urlInfo,
|
|
7980
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
7976
7981
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
7977
7982
|
parentUrl: urlInfo.url,
|
|
7978
7983
|
type: "js_import",
|
|
7979
7984
|
expectedType: "js_module",
|
|
7980
|
-
specifier:
|
|
7985
|
+
specifier: importFrom,
|
|
7981
7986
|
});
|
|
7982
|
-
let
|
|
7983
|
-
let
|
|
7987
|
+
let importVariableName;
|
|
7988
|
+
let importBeforeFrom;
|
|
7989
|
+
if (importAs !== importName) {
|
|
7990
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
7991
|
+
importVariableName = importAs;
|
|
7992
|
+
} else {
|
|
7993
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
7994
|
+
importVariableName = importName;
|
|
7995
|
+
}
|
|
7996
|
+
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
7984
7997
|
|
|
7985
|
-
const remove =
|
|
7998
|
+
const remove = ${importVariableName}(import.meta);
|
|
7986
7999
|
if (import.meta.hot) {
|
|
7987
8000
|
import.meta.hot.dispose(() => {
|
|
7988
8001
|
remove();
|
|
@@ -7990,6 +8003,8 @@ if (import.meta.hot) {
|
|
|
7990
8003
|
}
|
|
7991
8004
|
|
|
7992
8005
|
`;
|
|
8006
|
+
|
|
8007
|
+
let content = urlInfo.content;
|
|
7993
8008
|
return {
|
|
7994
8009
|
content: `${prelude.replace(/\n/g, "")}${content}`,
|
|
7995
8010
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const installImportMetaCssBuild = (importMeta) => {
|
|
2
2
|
const stylesheet = new CSSStyleSheet({ baseUrl: importMeta.url });
|
|
3
3
|
|
|
4
4
|
let called = false;
|
|
@@ -19,4 +19,4 @@ const installImportMetaCss = (importMeta) => {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { installImportMetaCssBuild };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const installImportMetaCssDev = (importMeta) => {
|
|
2
2
|
let cssText = "";
|
|
3
3
|
let stylesheet = new CSSStyleSheet({ baseUrl: importMeta.url });
|
|
4
4
|
let adopted = false;
|
|
@@ -44,4 +44,4 @@ const installImportMetaCss = (importMeta) => {
|
|
|
44
44
|
return css.remove;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export {
|
|
47
|
+
export { installImportMetaCssDev };
|
|
@@ -7947,9 +7947,9 @@ const jsenvPluginNodeRuntime = ({ runtimeCompat }) => {
|
|
|
7947
7947
|
|
|
7948
7948
|
|
|
7949
7949
|
const jsenvPluginImportMetaCss = () => {
|
|
7950
|
-
const
|
|
7951
|
-
.resolve("../client/import_meta_css/
|
|
7952
|
-
const
|
|
7950
|
+
const importMetaCssDevClientFileUrl = import.meta
|
|
7951
|
+
.resolve("../client/import_meta_css/import_meta_css_dev.js");
|
|
7952
|
+
const importMetaCssBuildClientFileUrl = import.meta
|
|
7953
7953
|
.resolve("../client/import_meta_css/import_meta_css_build.js");
|
|
7954
7954
|
|
|
7955
7955
|
return {
|
|
@@ -7971,12 +7971,17 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7971
7971
|
if (!usesImportMetaCss) {
|
|
7972
7972
|
return null;
|
|
7973
7973
|
}
|
|
7974
|
-
return injectImportMetaCss(
|
|
7975
|
-
urlInfo
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7974
|
+
return injectImportMetaCss(urlInfo, {
|
|
7975
|
+
importFrom: urlInfo.context.build
|
|
7976
|
+
? importMetaCssBuildClientFileUrl
|
|
7977
|
+
: importMetaCssDevClientFileUrl,
|
|
7978
|
+
importName: urlInfo.context.build
|
|
7979
|
+
? "installImportMetaCssBuild"
|
|
7980
|
+
: "installImportMetaCssDev",
|
|
7981
|
+
importAs: urlInfo.context.build
|
|
7982
|
+
? "__installImportMetaCssBuild__"
|
|
7983
|
+
: "__installImportMetaCssDev__",
|
|
7984
|
+
});
|
|
7980
7985
|
},
|
|
7981
7986
|
},
|
|
7982
7987
|
};
|
|
@@ -8013,17 +8018,25 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
8013
8018
|
};
|
|
8014
8019
|
};
|
|
8015
8020
|
|
|
8016
|
-
const injectImportMetaCss = (urlInfo,
|
|
8021
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
8017
8022
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
8018
8023
|
parentUrl: urlInfo.url,
|
|
8019
8024
|
type: "js_import",
|
|
8020
8025
|
expectedType: "js_module",
|
|
8021
|
-
specifier:
|
|
8026
|
+
specifier: importFrom,
|
|
8022
8027
|
});
|
|
8023
|
-
let
|
|
8024
|
-
let
|
|
8025
|
-
|
|
8026
|
-
|
|
8028
|
+
let importVariableName;
|
|
8029
|
+
let importBeforeFrom;
|
|
8030
|
+
if (importAs !== importName) {
|
|
8031
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
8032
|
+
importVariableName = importAs;
|
|
8033
|
+
} else {
|
|
8034
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
8035
|
+
importVariableName = importName;
|
|
8036
|
+
}
|
|
8037
|
+
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
8038
|
+
|
|
8039
|
+
const remove = ${importVariableName}(import.meta);
|
|
8027
8040
|
if (import.meta.hot) {
|
|
8028
8041
|
import.meta.hot.dispose(() => {
|
|
8029
8042
|
remove();
|
|
@@ -8031,6 +8044,8 @@ if (import.meta.hot) {
|
|
|
8031
8044
|
}
|
|
8032
8045
|
|
|
8033
8046
|
`;
|
|
8047
|
+
|
|
8048
|
+
let content = urlInfo.content;
|
|
8034
8049
|
return {
|
|
8035
8050
|
content: `${prelude.replace(/\n/g, "")}${content}`,
|
|
8036
8051
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "40.12.
|
|
3
|
+
"version": "40.12.11",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
123
123
|
"eslint": "9.39.2",
|
|
124
124
|
"eslint-plugin-import-x": "4.16.2",
|
|
125
|
+
"eslint-plugin-react": "7.37.5",
|
|
125
126
|
"eslint-plugin-regexp": "3.1.0",
|
|
126
127
|
"globals": "17.4.0",
|
|
127
128
|
"open": "11.0.0",
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
"node": ">=20.8.0"
|
|
141
142
|
},
|
|
142
143
|
"volta": {
|
|
143
|
-
"node": "25.1
|
|
144
|
+
"node": "25.8.1",
|
|
144
145
|
"npm": "11.6.2"
|
|
145
146
|
},
|
|
146
147
|
"publishConfig": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
import { applyBabelPlugins } from "@jsenv/ast";
|
|
27
27
|
|
|
28
28
|
export const jsenvPluginImportMetaCss = () => {
|
|
29
|
-
const
|
|
30
|
-
.resolve("./client/
|
|
31
|
-
const
|
|
29
|
+
const importMetaCssDevClientFileUrl = import.meta
|
|
30
|
+
.resolve("./client/import_meta_css_dev.js");
|
|
31
|
+
const importMetaCssBuildClientFileUrl = import.meta
|
|
32
32
|
.resolve("./client/import_meta_css_build.js");
|
|
33
33
|
|
|
34
34
|
return {
|
|
@@ -50,12 +50,17 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
50
50
|
if (!usesImportMetaCss) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
return injectImportMetaCss(
|
|
54
|
-
urlInfo
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
return injectImportMetaCss(urlInfo, {
|
|
54
|
+
importFrom: urlInfo.context.build
|
|
55
|
+
? importMetaCssBuildClientFileUrl
|
|
56
|
+
: importMetaCssDevClientFileUrl,
|
|
57
|
+
importName: urlInfo.context.build
|
|
58
|
+
? "installImportMetaCssBuild"
|
|
59
|
+
: "installImportMetaCssDev",
|
|
60
|
+
importAs: urlInfo.context.build
|
|
61
|
+
? "__installImportMetaCssBuild__"
|
|
62
|
+
: "__installImportMetaCssDev__",
|
|
63
|
+
});
|
|
59
64
|
},
|
|
60
65
|
},
|
|
61
66
|
};
|
|
@@ -92,17 +97,25 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
92
97
|
};
|
|
93
98
|
};
|
|
94
99
|
|
|
95
|
-
const injectImportMetaCss = (urlInfo,
|
|
100
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
96
101
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
97
102
|
parentUrl: urlInfo.url,
|
|
98
103
|
type: "js_import",
|
|
99
104
|
expectedType: "js_module",
|
|
100
|
-
specifier:
|
|
105
|
+
specifier: importFrom,
|
|
101
106
|
});
|
|
102
|
-
let
|
|
103
|
-
let
|
|
107
|
+
let importVariableName;
|
|
108
|
+
let importBeforeFrom;
|
|
109
|
+
if (importAs && importAs !== importName) {
|
|
110
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
111
|
+
importVariableName = importAs;
|
|
112
|
+
} else {
|
|
113
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
114
|
+
importVariableName = importName;
|
|
115
|
+
}
|
|
116
|
+
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
104
117
|
|
|
105
|
-
const remove =
|
|
118
|
+
const remove = ${importVariableName}(import.meta);
|
|
106
119
|
if (import.meta.hot) {
|
|
107
120
|
import.meta.hot.dispose(() => {
|
|
108
121
|
remove();
|
|
@@ -110,6 +123,8 @@ if (import.meta.hot) {
|
|
|
110
123
|
}
|
|
111
124
|
|
|
112
125
|
`;
|
|
126
|
+
|
|
127
|
+
let content = urlInfo.content;
|
|
113
128
|
return {
|
|
114
129
|
content: `${prelude.replace(/\n/g, "")}${content}`,
|
|
115
130
|
};
|