@siddharatha/adapter-node-rolldown 1.1.4 → 1.1.6
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/index.js +13 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -66,15 +66,6 @@ export default function (opts = {}) {
|
|
|
66
66
|
|
|
67
67
|
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
68
68
|
|
|
69
|
-
// determine external patterns for bundling
|
|
70
|
-
let externalPatterns;
|
|
71
|
-
if (bundleAll) {
|
|
72
|
-
externalPatterns = [];
|
|
73
|
-
} else if (external) {
|
|
74
|
-
externalPatterns = typeof external === 'function' ? external(pkg) : external;
|
|
75
|
-
} else {
|
|
76
|
-
externalPatterns = Object.keys(pkg.dependencies || {});
|
|
77
|
-
}
|
|
78
69
|
|
|
79
70
|
/** @type {Record<string, string>} */
|
|
80
71
|
const input = {
|
|
@@ -97,6 +88,9 @@ export default function (opts = {}) {
|
|
|
97
88
|
external: keepPackageDependencies
|
|
98
89
|
? [...Object.keys(pkg.dependencies || {}).map((d) => new RegExp(`^${d}(\\/.*)?$`))]
|
|
99
90
|
: undefined,
|
|
91
|
+
output: {
|
|
92
|
+
keepNames: true // Preserves function/class names post-bundling [web:1]
|
|
93
|
+
}
|
|
100
94
|
});
|
|
101
95
|
|
|
102
96
|
await bundle.write({
|
|
@@ -141,13 +135,17 @@ export default function (opts = {}) {
|
|
|
141
135
|
|
|
142
136
|
if (cleanPackageJson) {
|
|
143
137
|
const packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
const cleanedPackageJson = {
|
|
139
|
+
name: packageJson.name,
|
|
140
|
+
version: packageJson.version,
|
|
141
|
+
type: 'module'
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
if (keepPackageDependencies) {
|
|
145
|
+
cleanedPackageJson.dependencies = packageJson.dependencies;
|
|
148
146
|
}
|
|
149
|
-
|
|
150
|
-
writeFileSync(`${out}/package.json`, JSON.stringify(
|
|
147
|
+
|
|
148
|
+
writeFileSync(`${out}/package.json`, JSON.stringify(cleanedPackageJson, null, 2), 'utf-8');
|
|
151
149
|
} else {
|
|
152
150
|
builder.copy('package.json', `${out}/package.json`, {});
|
|
153
151
|
}
|