@ecopages/core 0.2.0-alpha.41 → 0.2.0-alpha.43
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.43",
|
|
4
4
|
"description": "Core package for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"directory": "packages/core"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ecopages/file-system": "0.2.0-alpha.
|
|
20
|
+
"@ecopages/file-system": "0.2.0-alpha.43",
|
|
21
21
|
"@ecopages/logger": "^0.2.3",
|
|
22
22
|
"@ecopages/scripts-injector": "^0.1.5",
|
|
23
23
|
"@worker-tools/html-rewriter": "0.1.0-pre.19",
|
|
@@ -42,9 +42,13 @@ function linkPointsToPackage(linkPath, packageRoot) {
|
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function resolveRuntimePackageRoot(specifier, resolvedPath, parentPath) {
|
|
46
46
|
const packageName = getPackageNameFromSpecifier(specifier);
|
|
47
|
-
|
|
47
|
+
return findInstalledPackageDir(packageName, parentPath) ?? findPackageRoot(resolvedPath);
|
|
48
|
+
}
|
|
49
|
+
function ensureRuntimePackageLink(nodeModulesDir, specifier, resolvedPath, parentPath) {
|
|
50
|
+
const packageName = getPackageNameFromSpecifier(specifier);
|
|
51
|
+
const packageRoot = resolveRuntimePackageRoot(specifier, resolvedPath, parentPath);
|
|
48
52
|
const linkPath = path.join(nodeModulesDir, packageName);
|
|
49
53
|
mkdirSync(path.dirname(linkPath), { recursive: true });
|
|
50
54
|
if (pathEntryExists(linkPath)) {
|
|
@@ -227,7 +231,12 @@ function resolveNodeBootstrapDependency(args, options) {
|
|
|
227
231
|
const candidatePath = path.join(options.projectDir, "node_modules", packageName);
|
|
228
232
|
const candidatePackageJson = path.join(candidatePath, "package.json");
|
|
229
233
|
if (existsSync(candidatePackageJson)) {
|
|
230
|
-
ensureRuntimePackageLink(
|
|
234
|
+
ensureRuntimePackageLink(
|
|
235
|
+
options.runtimeNodeModulesDir,
|
|
236
|
+
args.path,
|
|
237
|
+
candidatePackageJson,
|
|
238
|
+
resolveParent
|
|
239
|
+
);
|
|
231
240
|
return { path: args.path, external: true };
|
|
232
241
|
}
|
|
233
242
|
}
|
|
@@ -236,7 +245,7 @@ function resolveNodeBootstrapDependency(args, options) {
|
|
|
236
245
|
return void 0;
|
|
237
246
|
}
|
|
238
247
|
if (resolvedPath2.includes(`${path.sep}node_modules${path.sep}`)) {
|
|
239
|
-
ensureRuntimePackageLink(options.runtimeNodeModulesDir, args.path, resolvedPath2);
|
|
248
|
+
ensureRuntimePackageLink(options.runtimeNodeModulesDir, args.path, resolvedPath2, resolveParent);
|
|
240
249
|
return {
|
|
241
250
|
path: args.path,
|
|
242
251
|
external: true
|
|
@@ -245,7 +254,7 @@ function resolveNodeBootstrapDependency(args, options) {
|
|
|
245
254
|
return { path: resolvedPath2 };
|
|
246
255
|
}
|
|
247
256
|
const resolvedPath = resolveSpecifier(args.path, resolveParent);
|
|
248
|
-
ensureRuntimePackageLink(options.runtimeNodeModulesDir, args.path, resolvedPath);
|
|
257
|
+
ensureRuntimePackageLink(options.runtimeNodeModulesDir, args.path, resolvedPath, resolveParent);
|
|
249
258
|
return {
|
|
250
259
|
path: args.path,
|
|
251
260
|
external: true
|
|
@@ -266,7 +275,7 @@ function createNodeBootstrapPlugin(options) {
|
|
|
266
275
|
return void 0;
|
|
267
276
|
}
|
|
268
277
|
const originalContents = readFileSync(args.path, "utf8");
|
|
269
|
-
const contents = originalContents.replaceAll("import.meta.dirname", JSON.stringify(path.dirname(args.path))).replaceAll("import.meta.filename", JSON.stringify(args.path));
|
|
278
|
+
const contents = originalContents.replaceAll("import.meta.env", "process.env").replaceAll("import.meta.dirname", JSON.stringify(path.dirname(args.path))).replaceAll("import.meta.filename", JSON.stringify(args.path)).replaceAll("import.meta.dir", JSON.stringify(path.dirname(args.path))).replaceAll("import.meta.path", JSON.stringify(args.path));
|
|
270
279
|
if (contents === originalContents) {
|
|
271
280
|
return void 0;
|
|
272
281
|
}
|