@jsenv/core 40.12.14 → 41.0.1
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
CHANGED
|
@@ -7677,10 +7677,15 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7677
7677
|
return null;
|
|
7678
7678
|
}
|
|
7679
7679
|
if (urlInfo.context.build) {
|
|
7680
|
-
const
|
|
7681
|
-
const
|
|
7682
|
-
|
|
7680
|
+
const packageName = urlInfo.packageName;
|
|
7681
|
+
const packageDirectoryUrl =
|
|
7682
|
+
urlInfo.packageDirectoryUrl || urlInfo.context.rootDirectoryUrl;
|
|
7683
|
+
const relativePathInPackage = urlInfo.originalUrl.slice(
|
|
7684
|
+
packageDirectoryUrl.length - 1,
|
|
7683
7685
|
);
|
|
7686
|
+
const relativeUrl = packageName
|
|
7687
|
+
? `${packageName}${relativePathInPackage}`
|
|
7688
|
+
: relativePathInPackage;
|
|
7684
7689
|
const { code } = await applyBabelPlugins({
|
|
7685
7690
|
babelPlugins: [
|
|
7686
7691
|
[babelPluginRewriteImportMetaCssAssignment, { relativeUrl }],
|
|
@@ -7690,6 +7695,10 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7690
7695
|
inputUrl: urlInfo.originalUrl,
|
|
7691
7696
|
outputUrl: urlInfo.generatedUrl,
|
|
7692
7697
|
});
|
|
7698
|
+
if (code === urlInfo.content) {
|
|
7699
|
+
// all assignments were already in array form (pre-built file) — nothing to do
|
|
7700
|
+
return null;
|
|
7701
|
+
}
|
|
7693
7702
|
return injectImportMetaCss(urlInfo, {
|
|
7694
7703
|
content: code,
|
|
7695
7704
|
importFrom: importMetaCssBuildClientFileUrl,
|
|
@@ -7731,6 +7740,10 @@ const babelPluginRewriteImportMetaCssAssignment = (
|
|
|
7731
7740
|
if (property.name !== "css") {
|
|
7732
7741
|
return;
|
|
7733
7742
|
}
|
|
7743
|
+
// already transformed (e.g. pre-built file): leave as-is
|
|
7744
|
+
if (right.type === "ArrayExpression") {
|
|
7745
|
+
return;
|
|
7746
|
+
}
|
|
7734
7747
|
path.node.right = t.arrayExpression([
|
|
7735
7748
|
right,
|
|
7736
7749
|
t.stringLiteral(relativeUrl),
|
|
@@ -7718,10 +7718,15 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7718
7718
|
return null;
|
|
7719
7719
|
}
|
|
7720
7720
|
if (urlInfo.context.build) {
|
|
7721
|
-
const
|
|
7722
|
-
const
|
|
7723
|
-
|
|
7721
|
+
const packageName = urlInfo.packageName;
|
|
7722
|
+
const packageDirectoryUrl =
|
|
7723
|
+
urlInfo.packageDirectoryUrl || urlInfo.context.rootDirectoryUrl;
|
|
7724
|
+
const relativePathInPackage = urlInfo.originalUrl.slice(
|
|
7725
|
+
packageDirectoryUrl.length - 1,
|
|
7724
7726
|
);
|
|
7727
|
+
const relativeUrl = packageName
|
|
7728
|
+
? `${packageName}${relativePathInPackage}`
|
|
7729
|
+
: relativePathInPackage;
|
|
7725
7730
|
const { code } = await applyBabelPlugins({
|
|
7726
7731
|
babelPlugins: [
|
|
7727
7732
|
[babelPluginRewriteImportMetaCssAssignment, { relativeUrl }],
|
|
@@ -7731,6 +7736,10 @@ const jsenvPluginImportMetaCss = () => {
|
|
|
7731
7736
|
inputUrl: urlInfo.originalUrl,
|
|
7732
7737
|
outputUrl: urlInfo.generatedUrl,
|
|
7733
7738
|
});
|
|
7739
|
+
if (code === urlInfo.content) {
|
|
7740
|
+
// all assignments were already in array form (pre-built file) — nothing to do
|
|
7741
|
+
return null;
|
|
7742
|
+
}
|
|
7734
7743
|
return injectImportMetaCss(urlInfo, {
|
|
7735
7744
|
content: code,
|
|
7736
7745
|
importFrom: importMetaCssBuildClientFileUrl,
|
|
@@ -7772,6 +7781,10 @@ const babelPluginRewriteImportMetaCssAssignment = (
|
|
|
7772
7781
|
if (property.name !== "css") {
|
|
7773
7782
|
return;
|
|
7774
7783
|
}
|
|
7784
|
+
// already transformed (e.g. pre-built file): leave as-is
|
|
7785
|
+
if (right.type === "ArrayExpression") {
|
|
7786
|
+
return;
|
|
7787
|
+
}
|
|
7775
7788
|
path.node.right = t.arrayExpression([
|
|
7776
7789
|
right,
|
|
7777
7790
|
t.stringLiteral(relativeUrl),
|
package/package.json
CHANGED
|
@@ -51,10 +51,15 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
if (urlInfo.context.build) {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
const packageName = urlInfo.packageName;
|
|
55
|
+
const packageDirectoryUrl =
|
|
56
|
+
urlInfo.packageDirectoryUrl || urlInfo.context.rootDirectoryUrl;
|
|
57
|
+
const relativePathInPackage = urlInfo.originalUrl.slice(
|
|
58
|
+
packageDirectoryUrl.length - 1,
|
|
57
59
|
);
|
|
60
|
+
const relativeUrl = packageName
|
|
61
|
+
? `${packageName}${relativePathInPackage}`
|
|
62
|
+
: relativePathInPackage;
|
|
58
63
|
const { code } = await applyBabelPlugins({
|
|
59
64
|
babelPlugins: [
|
|
60
65
|
[babelPluginRewriteImportMetaCssAssignment, { relativeUrl }],
|
|
@@ -64,6 +69,10 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
64
69
|
inputUrl: urlInfo.originalUrl,
|
|
65
70
|
outputUrl: urlInfo.generatedUrl,
|
|
66
71
|
});
|
|
72
|
+
if (code === urlInfo.content) {
|
|
73
|
+
// all assignments were already in array form (pre-built file) — nothing to do
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
67
76
|
return injectImportMetaCss(urlInfo, {
|
|
68
77
|
content: code,
|
|
69
78
|
importFrom: importMetaCssBuildClientFileUrl,
|
|
@@ -105,6 +114,10 @@ const babelPluginRewriteImportMetaCssAssignment = (
|
|
|
105
114
|
if (property.name !== "css") {
|
|
106
115
|
return;
|
|
107
116
|
}
|
|
117
|
+
// already transformed (e.g. pre-built file): leave as-is
|
|
118
|
+
if (right.type === "ArrayExpression") {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
108
121
|
path.node.right = t.arrayExpression([
|
|
109
122
|
right,
|
|
110
123
|
t.stringLiteral(relativeUrl),
|