@jsenv/core 40.12.10 → 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/build.js +17 -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 +17 -14
- package/package.json +1 -1
- 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 +17 -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 {
|
|
@@ -7931,12 +7931,15 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7931
7931
|
return null;
|
|
7932
7932
|
}
|
|
7933
7933
|
return injectImportMetaCss(urlInfo, {
|
|
7934
|
+
importFrom: urlInfo.context.build
|
|
7935
|
+
? importMetaCssBuildClientFileUrl
|
|
7936
|
+
: importMetaCssDevClientFileUrl,
|
|
7937
|
+
importName: urlInfo.context.build
|
|
7938
|
+
? "installImportMetaCssBuild"
|
|
7939
|
+
: "installImportMetaCssDev",
|
|
7934
7940
|
importAs: urlInfo.context.build
|
|
7935
|
-
? "
|
|
7936
|
-
: "
|
|
7937
|
-
specifier: urlInfo.context.build
|
|
7938
|
-
? importMetaCssBuildFileUrl
|
|
7939
|
-
: importMetaCssClientFileUrl,
|
|
7941
|
+
? "__installImportMetaCssBuild__"
|
|
7942
|
+
: "__installImportMetaCssDev__",
|
|
7940
7943
|
});
|
|
7941
7944
|
},
|
|
7942
7945
|
},
|
|
@@ -7974,21 +7977,21 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
7974
7977
|
};
|
|
7975
7978
|
};
|
|
7976
7979
|
|
|
7977
|
-
const injectImportMetaCss = (urlInfo, {
|
|
7980
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
7978
7981
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
7979
7982
|
parentUrl: urlInfo.url,
|
|
7980
7983
|
type: "js_import",
|
|
7981
7984
|
expectedType: "js_module",
|
|
7982
|
-
specifier,
|
|
7985
|
+
specifier: importFrom,
|
|
7983
7986
|
});
|
|
7984
7987
|
let importVariableName;
|
|
7985
7988
|
let importBeforeFrom;
|
|
7986
|
-
if (importAs !==
|
|
7987
|
-
importBeforeFrom = `{
|
|
7989
|
+
if (importAs !== importName) {
|
|
7990
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
7988
7991
|
importVariableName = importAs;
|
|
7989
7992
|
} else {
|
|
7990
|
-
importBeforeFrom = `{
|
|
7991
|
-
importVariableName =
|
|
7993
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
7994
|
+
importVariableName = importName;
|
|
7992
7995
|
}
|
|
7993
7996
|
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
7994
7997
|
|
|
@@ -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 {
|
|
@@ -7972,12 +7972,15 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7972
7972
|
return null;
|
|
7973
7973
|
}
|
|
7974
7974
|
return injectImportMetaCss(urlInfo, {
|
|
7975
|
+
importFrom: urlInfo.context.build
|
|
7976
|
+
? importMetaCssBuildClientFileUrl
|
|
7977
|
+
: importMetaCssDevClientFileUrl,
|
|
7978
|
+
importName: urlInfo.context.build
|
|
7979
|
+
? "installImportMetaCssBuild"
|
|
7980
|
+
: "installImportMetaCssDev",
|
|
7975
7981
|
importAs: urlInfo.context.build
|
|
7976
|
-
? "
|
|
7977
|
-
: "
|
|
7978
|
-
specifier: urlInfo.context.build
|
|
7979
|
-
? importMetaCssBuildFileUrl
|
|
7980
|
-
: importMetaCssClientFileUrl,
|
|
7982
|
+
? "__installImportMetaCssBuild__"
|
|
7983
|
+
: "__installImportMetaCssDev__",
|
|
7981
7984
|
});
|
|
7982
7985
|
},
|
|
7983
7986
|
},
|
|
@@ -8015,21 +8018,21 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
8015
8018
|
};
|
|
8016
8019
|
};
|
|
8017
8020
|
|
|
8018
|
-
const injectImportMetaCss = (urlInfo, {
|
|
8021
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
8019
8022
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
8020
8023
|
parentUrl: urlInfo.url,
|
|
8021
8024
|
type: "js_import",
|
|
8022
8025
|
expectedType: "js_module",
|
|
8023
|
-
specifier,
|
|
8026
|
+
specifier: importFrom,
|
|
8024
8027
|
});
|
|
8025
8028
|
let importVariableName;
|
|
8026
8029
|
let importBeforeFrom;
|
|
8027
|
-
if (importAs !==
|
|
8028
|
-
importBeforeFrom = `{
|
|
8030
|
+
if (importAs !== importName) {
|
|
8031
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
8029
8032
|
importVariableName = importAs;
|
|
8030
8033
|
} else {
|
|
8031
|
-
importBeforeFrom = `{
|
|
8032
|
-
importVariableName =
|
|
8034
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
8035
|
+
importVariableName = importName;
|
|
8033
8036
|
}
|
|
8034
8037
|
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
8035
8038
|
|
package/package.json
CHANGED
|
@@ -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 {
|
|
@@ -51,12 +51,15 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
return injectImportMetaCss(urlInfo, {
|
|
54
|
+
importFrom: urlInfo.context.build
|
|
55
|
+
? importMetaCssBuildClientFileUrl
|
|
56
|
+
: importMetaCssDevClientFileUrl,
|
|
57
|
+
importName: urlInfo.context.build
|
|
58
|
+
? "installImportMetaCssBuild"
|
|
59
|
+
: "installImportMetaCssDev",
|
|
54
60
|
importAs: urlInfo.context.build
|
|
55
|
-
? "
|
|
56
|
-
: "
|
|
57
|
-
specifier: urlInfo.context.build
|
|
58
|
-
? importMetaCssBuildFileUrl
|
|
59
|
-
: importMetaCssClientFileUrl,
|
|
61
|
+
? "__installImportMetaCssBuild__"
|
|
62
|
+
: "__installImportMetaCssDev__",
|
|
60
63
|
});
|
|
61
64
|
},
|
|
62
65
|
},
|
|
@@ -94,21 +97,21 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
94
97
|
};
|
|
95
98
|
};
|
|
96
99
|
|
|
97
|
-
const injectImportMetaCss = (urlInfo, {
|
|
100
|
+
const injectImportMetaCss = (urlInfo, { importFrom, importName, importAs }) => {
|
|
98
101
|
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
99
102
|
parentUrl: urlInfo.url,
|
|
100
103
|
type: "js_import",
|
|
101
104
|
expectedType: "js_module",
|
|
102
|
-
specifier,
|
|
105
|
+
specifier: importFrom,
|
|
103
106
|
});
|
|
104
107
|
let importVariableName;
|
|
105
108
|
let importBeforeFrom;
|
|
106
|
-
if (importAs && importAs !==
|
|
107
|
-
importBeforeFrom = `{
|
|
109
|
+
if (importAs && importAs !== importName) {
|
|
110
|
+
importBeforeFrom = `{ ${importName} as ${importAs} }`;
|
|
108
111
|
importVariableName = importAs;
|
|
109
112
|
} else {
|
|
110
|
-
importBeforeFrom = `{
|
|
111
|
-
importVariableName =
|
|
113
|
+
importBeforeFrom = `{ ${importName} } }`;
|
|
114
|
+
importVariableName = importName;
|
|
112
115
|
}
|
|
113
116
|
let prelude = `import ${importBeforeFrom} from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
114
117
|
|