@modern-js/runtime 0.0.0-next-20231103035405 → 0.0.0-next-20231103131234
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.
|
@@ -52,17 +52,6 @@ const checkIsInline = (chunk, enableInline) => {
|
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
const readAsset = async (chunk) => {
|
|
56
|
-
const fs = await Promise.resolve().then(() => __toESM(require("node:fs/promises")));
|
|
57
|
-
const path = await Promise.resolve().then(() => __toESM(require("node:path")));
|
|
58
|
-
let filepath;
|
|
59
|
-
if (process.env.NODE_ENV === "production") {
|
|
60
|
-
filepath = path.resolve(__dirname, chunk.filename);
|
|
61
|
-
} else {
|
|
62
|
-
filepath = chunk.path;
|
|
63
|
-
}
|
|
64
|
-
return fs.readFile(filepath, "utf-8");
|
|
65
|
-
};
|
|
66
55
|
const checkIsNode = () => {
|
|
67
56
|
var _process_release;
|
|
68
57
|
return typeof process !== "undefined" && ((_process_release = process.release) === null || _process_release === void 0 ? void 0 : _process_release.name) === "node";
|
|
@@ -125,13 +114,14 @@ class LoadableCollector {
|
|
|
125
114
|
const jsChunkReg = new RegExp(`<script .*src="${chunk.url}".*>`);
|
|
126
115
|
return !jsChunkReg.test(template) && !((_this_existsAssets = this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
127
116
|
}).map(async (chunk) => {
|
|
128
|
-
const script = `<script${attributes} src="${chunk.url}"></script>`;
|
|
129
117
|
if (checkIsInline(chunk, enableInlineScripts) && checkIsNode()) {
|
|
130
|
-
|
|
131
|
-
|
|
118
|
+
const fs = await Promise.resolve().then(() => __toESM(require("node:fs/promises")));
|
|
119
|
+
const filepath = chunk.path;
|
|
120
|
+
return fs.readFile(filepath, "utf-8").then((content) => `<script>${content}</script>`).catch((_) => {
|
|
121
|
+
return "";
|
|
132
122
|
});
|
|
133
123
|
} else {
|
|
134
|
-
return script
|
|
124
|
+
return `<script${attributes} src="${chunk.url}"></script>`;
|
|
135
125
|
}
|
|
136
126
|
}));
|
|
137
127
|
chunksMap.js += scripts.filter((script) => Boolean(script)).join("");
|
|
@@ -144,13 +134,13 @@ class LoadableCollector {
|
|
|
144
134
|
const cssChunkReg = new RegExp(`<link .*href="${chunk.url}".*>`);
|
|
145
135
|
return !cssChunkReg.test(template) && !((_this_existsAssets = this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
146
136
|
}).map(async (chunk) => {
|
|
147
|
-
const link = `<link${atrributes} href="${chunk.url}" rel="stylesheet" />`;
|
|
148
137
|
if (checkIsInline(chunk, enableInlineStyles) && checkIsNode()) {
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
const fs = await Promise.resolve().then(() => __toESM(require("node:fs/promises")));
|
|
139
|
+
return fs.readFile(chunk.path).then((content) => `<style>${content}</style>`).catch((_) => {
|
|
140
|
+
return "";
|
|
151
141
|
});
|
|
152
142
|
} else {
|
|
153
|
-
return link
|
|
143
|
+
return `<link${atrributes} href="${chunk.url}" rel="stylesheet" />`;
|
|
154
144
|
}
|
|
155
145
|
}));
|
|
156
146
|
chunksMap.css += css.filter((css2) => Boolean(css2)).join("");
|
|
@@ -31,40 +31,6 @@ var checkIsInline = function(chunk, enableInline) {
|
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
var readAsset = function() {
|
|
35
|
-
var _ref = _async_to_generator(function(chunk) {
|
|
36
|
-
var fs, path, filepath;
|
|
37
|
-
return _ts_generator(this, function(_state) {
|
|
38
|
-
switch (_state.label) {
|
|
39
|
-
case 0:
|
|
40
|
-
return [
|
|
41
|
-
4,
|
|
42
|
-
import("node:fs/promises")
|
|
43
|
-
];
|
|
44
|
-
case 1:
|
|
45
|
-
fs = _state.sent();
|
|
46
|
-
return [
|
|
47
|
-
4,
|
|
48
|
-
import("node:path")
|
|
49
|
-
];
|
|
50
|
-
case 2:
|
|
51
|
-
path = _state.sent();
|
|
52
|
-
if (process.env.NODE_ENV === "production") {
|
|
53
|
-
filepath = path.resolve(__dirname, chunk.filename);
|
|
54
|
-
} else {
|
|
55
|
-
filepath = chunk.path;
|
|
56
|
-
}
|
|
57
|
-
return [
|
|
58
|
-
2,
|
|
59
|
-
fs.readFile(filepath, "utf-8")
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
return function readAsset2(chunk) {
|
|
65
|
-
return _ref.apply(this, arguments);
|
|
66
|
-
};
|
|
67
|
-
}();
|
|
68
34
|
var checkIsNode = function() {
|
|
69
35
|
var _process_release;
|
|
70
36
|
return typeof process !== "undefined" && ((_process_release = process.release) === null || _process_release === void 0 ? void 0 : _process_release.name) === "node";
|
|
@@ -185,27 +151,40 @@ var LoadableCollector = /* @__PURE__ */ function() {
|
|
|
185
151
|
return !jsChunkReg.test(template) && !((_this_existsAssets = _this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
186
152
|
}).map(function() {
|
|
187
153
|
var _ref = _async_to_generator(function(chunk) {
|
|
188
|
-
var
|
|
154
|
+
var fs, filepath;
|
|
189
155
|
return _ts_generator(this, function(_state2) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
156
|
+
switch (_state2.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
if (!(checkIsInline(chunk, enableInlineScripts) && checkIsNode()))
|
|
159
|
+
return [
|
|
160
|
+
3,
|
|
161
|
+
2
|
|
162
|
+
];
|
|
163
|
+
return [
|
|
164
|
+
4,
|
|
165
|
+
import("node:fs/promises")
|
|
166
|
+
];
|
|
167
|
+
case 1:
|
|
168
|
+
fs = _state2.sent();
|
|
169
|
+
filepath = chunk.path;
|
|
170
|
+
return [
|
|
171
|
+
2,
|
|
172
|
+
fs.readFile(filepath, "utf-8").then(function(content) {
|
|
173
|
+
return "<script>".concat(content, "</script>");
|
|
174
|
+
}).catch(function(_) {
|
|
175
|
+
return "";
|
|
176
|
+
})
|
|
177
|
+
];
|
|
178
|
+
case 2:
|
|
179
|
+
return [
|
|
180
|
+
2,
|
|
181
|
+
"<script".concat(attributes, ' src="').concat(chunk.url, '"></script>')
|
|
182
|
+
];
|
|
183
|
+
case 3:
|
|
184
|
+
return [
|
|
185
|
+
2
|
|
186
|
+
];
|
|
205
187
|
}
|
|
206
|
-
return [
|
|
207
|
-
2
|
|
208
|
-
];
|
|
209
188
|
});
|
|
210
189
|
});
|
|
211
190
|
return function(chunk) {
|
|
@@ -245,27 +224,39 @@ var LoadableCollector = /* @__PURE__ */ function() {
|
|
|
245
224
|
return !cssChunkReg.test(template) && !((_this_existsAssets = _this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
246
225
|
}).map(function() {
|
|
247
226
|
var _ref = _async_to_generator(function(chunk) {
|
|
248
|
-
var
|
|
227
|
+
var fs;
|
|
249
228
|
return _ts_generator(this, function(_state2) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
229
|
+
switch (_state2.label) {
|
|
230
|
+
case 0:
|
|
231
|
+
if (!(checkIsInline(chunk, enableInlineStyles) && checkIsNode()))
|
|
232
|
+
return [
|
|
233
|
+
3,
|
|
234
|
+
2
|
|
235
|
+
];
|
|
236
|
+
return [
|
|
237
|
+
4,
|
|
238
|
+
import("node:fs/promises")
|
|
239
|
+
];
|
|
240
|
+
case 1:
|
|
241
|
+
fs = _state2.sent();
|
|
242
|
+
return [
|
|
243
|
+
2,
|
|
244
|
+
fs.readFile(chunk.path).then(function(content) {
|
|
245
|
+
return "<style>".concat(content, "</style>");
|
|
246
|
+
}).catch(function(_) {
|
|
247
|
+
return "";
|
|
248
|
+
})
|
|
249
|
+
];
|
|
250
|
+
case 2:
|
|
251
|
+
return [
|
|
252
|
+
2,
|
|
253
|
+
"<link".concat(atrributes, ' href="').concat(chunk.url, '" rel="stylesheet" />')
|
|
254
|
+
];
|
|
255
|
+
case 3:
|
|
256
|
+
return [
|
|
257
|
+
2
|
|
258
|
+
];
|
|
265
259
|
}
|
|
266
|
-
return [
|
|
267
|
-
2
|
|
268
|
-
];
|
|
269
260
|
});
|
|
270
261
|
});
|
|
271
262
|
return function(chunk) {
|
|
@@ -19,17 +19,6 @@ const checkIsInline = (chunk, enableInline) => {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
const readAsset = async (chunk) => {
|
|
23
|
-
const fs = await import("node:fs/promises");
|
|
24
|
-
const path = await import("node:path");
|
|
25
|
-
let filepath;
|
|
26
|
-
if (process.env.NODE_ENV === "production") {
|
|
27
|
-
filepath = path.resolve(__dirname, chunk.filename);
|
|
28
|
-
} else {
|
|
29
|
-
filepath = chunk.path;
|
|
30
|
-
}
|
|
31
|
-
return fs.readFile(filepath, "utf-8");
|
|
32
|
-
};
|
|
33
22
|
const checkIsNode = () => {
|
|
34
23
|
var _process_release;
|
|
35
24
|
return typeof process !== "undefined" && ((_process_release = process.release) === null || _process_release === void 0 ? void 0 : _process_release.name) === "node";
|
|
@@ -92,13 +81,14 @@ class LoadableCollector {
|
|
|
92
81
|
const jsChunkReg = new RegExp(`<script .*src="${chunk.url}".*>`);
|
|
93
82
|
return !jsChunkReg.test(template) && !((_this_existsAssets = this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
94
83
|
}).map(async (chunk) => {
|
|
95
|
-
const script = `<script${attributes} src="${chunk.url}"></script>`;
|
|
96
84
|
if (checkIsInline(chunk, enableInlineScripts) && checkIsNode()) {
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
const fs = await import("node:fs/promises");
|
|
86
|
+
const filepath = chunk.path;
|
|
87
|
+
return fs.readFile(filepath, "utf-8").then((content) => `<script>${content}</script>`).catch((_) => {
|
|
88
|
+
return "";
|
|
99
89
|
});
|
|
100
90
|
} else {
|
|
101
|
-
return script
|
|
91
|
+
return `<script${attributes} src="${chunk.url}"></script>`;
|
|
102
92
|
}
|
|
103
93
|
}));
|
|
104
94
|
chunksMap.js += scripts.filter((script) => Boolean(script)).join("");
|
|
@@ -111,13 +101,13 @@ class LoadableCollector {
|
|
|
111
101
|
const cssChunkReg = new RegExp(`<link .*href="${chunk.url}".*>`);
|
|
112
102
|
return !cssChunkReg.test(template) && !((_this_existsAssets = this.existsAssets) === null || _this_existsAssets === void 0 ? void 0 : _this_existsAssets.includes(chunk.path));
|
|
113
103
|
}).map(async (chunk) => {
|
|
114
|
-
const link = `<link${atrributes} href="${chunk.url}" rel="stylesheet" />`;
|
|
115
104
|
if (checkIsInline(chunk, enableInlineStyles) && checkIsNode()) {
|
|
116
|
-
|
|
117
|
-
|
|
105
|
+
const fs = await import("node:fs/promises");
|
|
106
|
+
return fs.readFile(chunk.path).then((content) => `<style>${content}</style>`).catch((_) => {
|
|
107
|
+
return "";
|
|
118
108
|
});
|
|
119
109
|
} else {
|
|
120
|
-
return link
|
|
110
|
+
return `<link${atrributes} href="${chunk.url}" rel="stylesheet" />`;
|
|
121
111
|
}
|
|
122
112
|
}));
|
|
123
113
|
chunksMap.css += css.filter((css2) => Boolean(css2)).join("");
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.0.0-next-
|
|
18
|
+
"version": "0.0.0-next-20231103131234",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -171,10 +171,10 @@
|
|
|
171
171
|
"react-side-effect": "^2.1.1",
|
|
172
172
|
"styled-components": "^5.3.1",
|
|
173
173
|
"@swc/helpers": "0.5.1",
|
|
174
|
-
"@modern-js/plugin": "0.0.0-next-
|
|
175
|
-
"@modern-js/
|
|
176
|
-
"@modern-js/
|
|
177
|
-
"@modern-js/runtime-utils": "0.0.0-next-
|
|
174
|
+
"@modern-js/plugin": "0.0.0-next-20231103131234",
|
|
175
|
+
"@modern-js/utils": "0.0.0-next-20231103131234",
|
|
176
|
+
"@modern-js/types": "0.0.0-next-20231103131234",
|
|
177
|
+
"@modern-js/runtime-utils": "0.0.0-next-20231103131234"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"react": ">=17",
|
|
@@ -195,11 +195,11 @@
|
|
|
195
195
|
"ts-jest": "^29.1.0",
|
|
196
196
|
"typescript": "^5",
|
|
197
197
|
"webpack": "^5.88.1",
|
|
198
|
-
"@modern-js/app-tools": "0.0.0-next-
|
|
199
|
-
"@modern-js/core": "0.0.0-next-
|
|
200
|
-
"@modern-js/server-core": "0.0.0-next-
|
|
201
|
-
"@scripts/build": "0.0.0-next-
|
|
202
|
-
"@scripts/jest-config": "0.0.0-next-
|
|
198
|
+
"@modern-js/app-tools": "0.0.0-next-20231103131234",
|
|
199
|
+
"@modern-js/core": "0.0.0-next-20231103131234",
|
|
200
|
+
"@modern-js/server-core": "0.0.0-next-20231103131234",
|
|
201
|
+
"@scripts/build": "0.0.0-next-20231103131234",
|
|
202
|
+
"@scripts/jest-config": "0.0.0-next-20231103131234"
|
|
203
203
|
},
|
|
204
204
|
"sideEffects": false,
|
|
205
205
|
"publishConfig": {
|