ecopages 0.2.0-alpha.44 → 0.2.0-alpha.46
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/bin/node-entry-bridge.js +24 -1
- package/package.json +2 -2
package/bin/node-entry-bridge.js
CHANGED
|
@@ -77,6 +77,26 @@ function ensureRuntimePackageLink(nodeModulesDir, specifier, resolvedPath) {
|
|
|
77
77
|
}
|
|
78
78
|
symlinkSync(packageRoot, linkPath, "dir");
|
|
79
79
|
}
|
|
80
|
+
function getNodeExternalSpecifier(specifier, resolvedPath) {
|
|
81
|
+
const packageName = getPackageNameFromSpecifier(specifier);
|
|
82
|
+
if (specifier === packageName) {
|
|
83
|
+
return specifier;
|
|
84
|
+
}
|
|
85
|
+
if (path.extname(specifier)) {
|
|
86
|
+
return specifier;
|
|
87
|
+
}
|
|
88
|
+
const resolvedExtension = path.extname(resolvedPath);
|
|
89
|
+
if (![".js", ".mjs", ".cjs", ".json"].includes(resolvedExtension)) {
|
|
90
|
+
return specifier;
|
|
91
|
+
}
|
|
92
|
+
const packageRoot = findPackageRoot(resolvedPath);
|
|
93
|
+
const requestedSubpath = specifier.slice(packageName.length + 1);
|
|
94
|
+
const resolvedSubpath = path.relative(packageRoot, resolvedPath);
|
|
95
|
+
if (resolvedSubpath === `${requestedSubpath}${resolvedExtension}`) {
|
|
96
|
+
return `${specifier}${resolvedExtension}`;
|
|
97
|
+
}
|
|
98
|
+
return specifier;
|
|
99
|
+
}
|
|
80
100
|
function createNodeEntryBridgePlugin({ rootDir, entryFile, runtimeNodeModulesDir }) {
|
|
81
101
|
return {
|
|
82
102
|
name: "ecopages-node-entry-bridge",
|
|
@@ -97,7 +117,7 @@ function createNodeEntryBridgePlugin({ rootDir, entryFile, runtimeNodeModulesDir
|
|
|
97
117
|
}
|
|
98
118
|
if (!args.path.startsWith("@ecopages/")) {
|
|
99
119
|
return {
|
|
100
|
-
path: args.path,
|
|
120
|
+
path: getNodeExternalSpecifier(args.path, resolvedPath),
|
|
101
121
|
external: true
|
|
102
122
|
};
|
|
103
123
|
}
|
|
@@ -140,6 +160,9 @@ async function buildNodeEntryBridge(entryFile, options = {}) {
|
|
|
140
160
|
platform: "node",
|
|
141
161
|
target: "es2022",
|
|
142
162
|
sourcemap: "linked",
|
|
163
|
+
banner: {
|
|
164
|
+
js: 'import { createRequire as __ecopagesCreateRequire } from "node:module"; const require = __ecopagesCreateRequire(import.meta.url);'
|
|
165
|
+
},
|
|
143
166
|
logLevel: "silent",
|
|
144
167
|
plugins: [
|
|
145
168
|
createNodeEntryBridgePlugin({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ecopages",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.46",
|
|
4
4
|
"description": "CLI utilities for Ecopages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ecopages": "bin/cli.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
35
|
+
"@ecopages/core": "0.2.0-alpha.46",
|
|
36
36
|
"@ecopages/logger": "^0.2.3",
|
|
37
37
|
"esbuild": "^0.28.0",
|
|
38
38
|
"giget": "^2.0.0"
|