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