@siddharatha/adapter-node-rolldown 1.0.5 → 1.0.8
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 +41 -7
- package/package.json +1 -4
package/index.js
CHANGED
|
@@ -19,7 +19,6 @@ const files = fileURLToPath(new URL('./files', import.meta.url).href);
|
|
|
19
19
|
* @param {AdapterOptions} options
|
|
20
20
|
*/
|
|
21
21
|
export default function (options = {}) {
|
|
22
|
-
console.log('Using @siddharatha/adapter-node-rolldown v1.0.4 at 14 jan 16:06');
|
|
23
22
|
const {
|
|
24
23
|
out = 'build',
|
|
25
24
|
precompress = true,
|
|
@@ -90,7 +89,26 @@ export default function (options = {}) {
|
|
|
90
89
|
// Determine external packages
|
|
91
90
|
// Always include runtime dependencies and user dependencies
|
|
92
91
|
const runtimeDeps = ['polka', 'sirv', '@polka/url'];
|
|
93
|
-
|
|
92
|
+
|
|
93
|
+
// OpenTelemetry packages have CommonJS/require issues when bundled as ESM
|
|
94
|
+
// Always mark them as external
|
|
95
|
+
const otelPackages = [
|
|
96
|
+
'@opentelemetry/api',
|
|
97
|
+
'@opentelemetry/sdk-node',
|
|
98
|
+
'@opentelemetry/auto-instrumentations-node',
|
|
99
|
+
'@opentelemetry/exporter-trace-otlp-http',
|
|
100
|
+
'@opentelemetry/exporter-trace-otlp-grpc',
|
|
101
|
+
'@opentelemetry/exporter-metrics-otlp-http',
|
|
102
|
+
'@opentelemetry/exporter-metrics-otlp-grpc',
|
|
103
|
+
'@opentelemetry/otlp-exporter-base',
|
|
104
|
+
'@opentelemetry/resources',
|
|
105
|
+
'@opentelemetry/semantic-conventions',
|
|
106
|
+
'@opentelemetry/core',
|
|
107
|
+
'@opentelemetry/instrumentation',
|
|
108
|
+
'import-in-the-middle'
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
let externalPackages = [...runtimeDeps, ...otelPackages];
|
|
94
112
|
|
|
95
113
|
if (typeof external === 'function') {
|
|
96
114
|
externalPackages = [...externalPackages, ...external(pkg)];
|
|
@@ -116,6 +134,7 @@ export default function (options = {}) {
|
|
|
116
134
|
const bundle = await rolldown({
|
|
117
135
|
input,
|
|
118
136
|
external: externalPatterns,
|
|
137
|
+
platform: 'node',
|
|
119
138
|
resolve: {
|
|
120
139
|
conditionNames: ['node', 'import'],
|
|
121
140
|
...rolldownOptions.resolve
|
|
@@ -128,7 +147,9 @@ export default function (options = {}) {
|
|
|
128
147
|
dir: `${out}/server`,
|
|
129
148
|
format: 'esm',
|
|
130
149
|
sourcemap: true,
|
|
131
|
-
chunkFileNames: 'chunks/[name]-[hash].js'
|
|
150
|
+
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
151
|
+
minify: false,
|
|
152
|
+
keepNames: true
|
|
132
153
|
});
|
|
133
154
|
|
|
134
155
|
// Now copy and bundle the runtime files
|
|
@@ -155,6 +176,7 @@ export default function (options = {}) {
|
|
|
155
176
|
index: `${tmp}/runtime/index.js`
|
|
156
177
|
},
|
|
157
178
|
external: runtimeExternalPatterns,
|
|
179
|
+
platform: 'node',
|
|
158
180
|
resolve: {
|
|
159
181
|
conditionNames: ['node', 'import'],
|
|
160
182
|
modulePaths: [
|
|
@@ -171,7 +193,9 @@ export default function (options = {}) {
|
|
|
171
193
|
dir: `${out}`,
|
|
172
194
|
format: 'esm',
|
|
173
195
|
sourcemap: true,
|
|
174
|
-
chunkFileNames: 'chunks/[name]-[hash].js'
|
|
196
|
+
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
197
|
+
minify: false,
|
|
198
|
+
keepNames: true
|
|
175
199
|
});
|
|
176
200
|
|
|
177
201
|
// Support for instrumentation
|
|
@@ -187,6 +211,12 @@ export default function (options = {}) {
|
|
|
187
211
|
|
|
188
212
|
builder.log.minor('Generating package.json');
|
|
189
213
|
|
|
214
|
+
// Collect all user dependencies (both dependencies and devDependencies)
|
|
215
|
+
const allUserDeps = {
|
|
216
|
+
...(pkg.dependencies || {}),
|
|
217
|
+
...(pkg.devDependencies || {})
|
|
218
|
+
};
|
|
219
|
+
|
|
190
220
|
// Include adapter runtime dependencies + all user dependencies
|
|
191
221
|
const finalDeps = {
|
|
192
222
|
'@polka/url': '^1.0.0-next.28',
|
|
@@ -195,6 +225,13 @@ export default function (options = {}) {
|
|
|
195
225
|
...(pkg.dependencies || {})
|
|
196
226
|
};
|
|
197
227
|
|
|
228
|
+
// Add OpenTelemetry packages if they're used (from devDependencies or dependencies)
|
|
229
|
+
for (const otelPkg of otelPackages) {
|
|
230
|
+
if (allUserDeps[otelPkg] && !finalDeps[otelPkg]) {
|
|
231
|
+
finalDeps[otelPkg] = allUserDeps[otelPkg];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
198
235
|
builder.log.info(`Including ${Object.keys(finalDeps).length} dependencies in output package.json`);
|
|
199
236
|
|
|
200
237
|
writeFileSync(
|
|
@@ -205,9 +242,6 @@ export default function (options = {}) {
|
|
|
205
242
|
version: pkg.version || '1.0.0',
|
|
206
243
|
type: 'module',
|
|
207
244
|
main: './index.js',
|
|
208
|
-
engines: {
|
|
209
|
-
node: pkg.engines?.node || '>=24.12.0'
|
|
210
|
-
},
|
|
211
245
|
dependencies: finalDeps
|
|
212
246
|
},
|
|
213
247
|
null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siddharatha/adapter-node-rolldown",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "High-performance SvelteKit adapter for Node.js with Polka, WebSockets, and OpenTelemetry",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"index.js",
|
|
12
12
|
"index.d.ts"
|
|
13
13
|
],
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=21.0.0"
|
|
16
|
-
},
|
|
17
14
|
"scripts": {
|
|
18
15
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
16
|
},
|