@quilted/rollup 0.2.3 → 0.2.4
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/CHANGELOG.md +6 -0
- package/build/esm/app.mjs +111 -62
- package/build/esm/features/react.mjs +22 -0
- package/build/esm/features/typescript.mjs +2 -2
- package/build/esm/index.mjs +1 -1
- package/build/esm/module.mjs +6 -6
- package/build/esm/server.mjs +7 -1
- package/build/esm/shared/browserslist.mjs +2 -1
- package/build/esm/shared/rollup.mjs +4 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts +64 -14
- package/build/typescript/app.d.ts.map +1 -1
- package/build/typescript/features/react.d.ts +28 -0
- package/build/typescript/features/react.d.ts.map +1 -0
- package/build/typescript/features/typescript.d.ts +1 -1
- package/build/typescript/features/typescript.d.ts.map +1 -1
- package/build/typescript/index.d.ts +1 -1
- package/build/typescript/index.d.ts.map +1 -1
- package/build/typescript/module.d.ts +2 -3
- package/build/typescript/module.d.ts.map +1 -1
- package/build/typescript/server.d.ts +4 -2
- package/build/typescript/server.d.ts.map +1 -1
- package/build/typescript/shared/browserslist.d.ts.map +1 -1
- package/build/typescript/shared/rollup.d.ts +2 -1
- package/build/typescript/shared/rollup.d.ts.map +1 -1
- package/package.json +10 -1
- package/source/app.ts +154 -88
- package/source/features/react.ts +26 -0
- package/source/features/typescript.ts +1 -1
- package/source/index.ts +3 -1
- package/source/module.ts +8 -14
- package/source/server.ts +10 -2
- package/source/shared/browserslist.ts +3 -1
- package/source/shared/rollup.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @quilted/rollup
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`533e7d76`](https://github.com/lemonmade/quilt/commit/533e7d766fb1a0d023c3aabf60cadb59cadecd73) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve Vite and Rollup plugins
|
|
8
|
+
|
|
3
9
|
## 0.2.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/build/esm/app.mjs
CHANGED
|
@@ -5,14 +5,14 @@ import { createRequire } from 'node:module';
|
|
|
5
5
|
import { MAGIC_MODULE_ENTRY, MAGIC_MODULE_APP_COMPONENT, MAGIC_MODULE_REQUEST_ROUTER, MAGIC_MODULE_BROWSER_ASSETS } from './constants.mjs';
|
|
6
6
|
import { resolveEnvOption } from './features/env.mjs';
|
|
7
7
|
import { multiline } from './shared/strings.mjs';
|
|
8
|
-
import { getNodePlugins, removeBuildFiles } from './shared/rollup.mjs';
|
|
8
|
+
import { getNodePlugins, removeBuildFiles, normalizeRollupInput } from './shared/rollup.mjs';
|
|
9
9
|
import { createMagicModulePlugin } from './shared/magic-module.mjs';
|
|
10
10
|
import { getBrowserGroups, getBrowserGroupTargetDetails, targetsSupportModules, rollupGenerateOptionsForBrowsers, getBrowserGroupRegularExpressions } from './shared/browserslist.mjs';
|
|
11
11
|
import { loadPackageJSON } from './shared/package-json.mjs';
|
|
12
12
|
import { resolveRoot } from './shared/path.mjs';
|
|
13
13
|
|
|
14
14
|
const require = createRequire(import.meta.url);
|
|
15
|
-
async function
|
|
15
|
+
async function quiltAppOptions({
|
|
16
16
|
root: rootPath = process.cwd(),
|
|
17
17
|
app,
|
|
18
18
|
env,
|
|
@@ -28,7 +28,7 @@ async function quiltApp({
|
|
|
28
28
|
const optionPromises = [];
|
|
29
29
|
browserGroupEntries.forEach(([name, browsers], index) => {
|
|
30
30
|
optionPromises.push(
|
|
31
|
-
|
|
31
|
+
quiltAppBrowserOptions({
|
|
32
32
|
root,
|
|
33
33
|
app,
|
|
34
34
|
graphql,
|
|
@@ -50,17 +50,47 @@ async function quiltApp({
|
|
|
50
50
|
);
|
|
51
51
|
});
|
|
52
52
|
optionPromises.push(
|
|
53
|
-
|
|
53
|
+
quiltAppServerOptions({
|
|
54
54
|
root,
|
|
55
55
|
app,
|
|
56
56
|
graphql,
|
|
57
57
|
...serverOptions,
|
|
58
|
-
env: {
|
|
58
|
+
env: {
|
|
59
|
+
...resolveEnvOption(env),
|
|
60
|
+
...resolveEnvOption(serverOptions?.env)
|
|
61
|
+
},
|
|
59
62
|
assets: { ...assets, ...serverOptions?.assets }
|
|
60
63
|
})
|
|
61
64
|
);
|
|
62
65
|
return Promise.all(optionPromises);
|
|
63
66
|
}
|
|
67
|
+
async function quiltAppBrowserOptions(options = {}) {
|
|
68
|
+
const { root: rootPath = process.cwd(), assets } = options;
|
|
69
|
+
const root = resolveRoot(rootPath);
|
|
70
|
+
const [plugins, browserGroup] = await Promise.all([
|
|
71
|
+
quiltAppBrowser(options),
|
|
72
|
+
getBrowserGroupTargetDetails(assets?.targets, {
|
|
73
|
+
root
|
|
74
|
+
})
|
|
75
|
+
]);
|
|
76
|
+
const targetFilenamePart = browserGroup.name ? `.${browserGroup.name}` : "";
|
|
77
|
+
const [isESM, generatedCode] = await Promise.all([
|
|
78
|
+
targetsSupportModules(browserGroup.browsers),
|
|
79
|
+
rollupGenerateOptionsForBrowsers(browserGroup.browsers)
|
|
80
|
+
]);
|
|
81
|
+
return {
|
|
82
|
+
plugins,
|
|
83
|
+
output: {
|
|
84
|
+
format: isESM ? "esm" : "systemjs",
|
|
85
|
+
dir: path.resolve(root, `build/assets`),
|
|
86
|
+
entryFileNames: `[name]${targetFilenamePart}.[hash].js`,
|
|
87
|
+
assetFileNames: `[name]${targetFilenamePart}.[hash].[ext]`,
|
|
88
|
+
chunkFileNames: `[name]${targetFilenamePart}.[hash].js`,
|
|
89
|
+
manualChunks: createManualChunksSorter(),
|
|
90
|
+
generatedCode
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
64
94
|
async function quiltAppBrowser({
|
|
65
95
|
root: rootPath = process.cwd(),
|
|
66
96
|
app,
|
|
@@ -83,7 +113,8 @@ async function quiltAppBrowser({
|
|
|
83
113
|
{ visualizer },
|
|
84
114
|
{ magicModuleEnv, replaceProcessEnv },
|
|
85
115
|
{ sourceCode },
|
|
86
|
-
{
|
|
116
|
+
{ tsconfigAliases },
|
|
117
|
+
{ react },
|
|
87
118
|
{ css },
|
|
88
119
|
{ assetManifest, rawAssets, staticAssets },
|
|
89
120
|
{ asyncModules },
|
|
@@ -97,6 +128,7 @@ async function quiltAppBrowser({
|
|
|
97
128
|
import('./features/env.mjs'),
|
|
98
129
|
import('./features/source-code.mjs'),
|
|
99
130
|
import('./features/typescript.mjs'),
|
|
131
|
+
import('./features/react.mjs'),
|
|
100
132
|
import('./features/css.mjs'),
|
|
101
133
|
import('./features/assets.mjs'),
|
|
102
134
|
import('./features/async.mjs'),
|
|
@@ -107,6 +139,7 @@ async function quiltAppBrowser({
|
|
|
107
139
|
loadPackageJSON(root)
|
|
108
140
|
]);
|
|
109
141
|
const plugins = [
|
|
142
|
+
quiltAppBrowserInput({ root, entry }),
|
|
110
143
|
...nodePlugins,
|
|
111
144
|
systemJS({ minify }),
|
|
112
145
|
replaceProcessEnv({ mode }),
|
|
@@ -128,11 +161,12 @@ async function quiltAppBrowser({
|
|
|
128
161
|
}
|
|
129
162
|
}
|
|
130
163
|
}),
|
|
164
|
+
react(),
|
|
165
|
+
css({ minify, emit: true }),
|
|
131
166
|
esnext({
|
|
132
167
|
mode,
|
|
133
168
|
targets: browserGroup.browsers
|
|
134
169
|
}),
|
|
135
|
-
css({ minify, emit: true }),
|
|
136
170
|
rawAssets(),
|
|
137
171
|
staticAssets({
|
|
138
172
|
baseURL,
|
|
@@ -154,7 +188,8 @@ async function quiltAppBrowser({
|
|
|
154
188
|
assetFileNames: `[name]${targetFilenamePart}.[hash].[ext]`,
|
|
155
189
|
chunkFileNames: `[name]${targetFilenamePart}.[hash].js`
|
|
156
190
|
}
|
|
157
|
-
})
|
|
191
|
+
}),
|
|
192
|
+
tsconfigAliases({ root })
|
|
158
193
|
];
|
|
159
194
|
if (assets?.clean ?? true) {
|
|
160
195
|
plugins.push(
|
|
@@ -163,10 +198,6 @@ async function quiltAppBrowser({
|
|
|
163
198
|
})
|
|
164
199
|
);
|
|
165
200
|
}
|
|
166
|
-
const tsconfigAliases = await createTSConfigAliasPlugin();
|
|
167
|
-
if (tsconfigAliases) {
|
|
168
|
-
plugins.push(tsconfigAliases);
|
|
169
|
-
}
|
|
170
201
|
const appEntry = await resolveAppEntry(app, { root, packageJSON });
|
|
171
202
|
if (appEntry) {
|
|
172
203
|
plugins.push(magicModuleAppComponent({ entry: appEntry }));
|
|
@@ -211,33 +242,45 @@ async function quiltAppBrowser({
|
|
|
211
242
|
)
|
|
212
243
|
})
|
|
213
244
|
);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
245
|
+
return plugins;
|
|
246
|
+
}
|
|
247
|
+
function quiltAppBrowserInput({
|
|
248
|
+
root: rootPath = process.cwd(),
|
|
249
|
+
entry
|
|
250
|
+
} = {}) {
|
|
251
|
+
const root = resolveRoot(rootPath);
|
|
252
|
+
return {
|
|
253
|
+
name: "@quilted/app-browser/input",
|
|
254
|
+
async options(options) {
|
|
255
|
+
const finalEntry = normalizeRollupInput(options.input) ?? (entry ? path.resolve(root, entry) : await glob("{browser,client,web}.{ts,tsx,mjs,js,jsx}", {
|
|
256
|
+
cwd: root,
|
|
257
|
+
nodir: true,
|
|
258
|
+
absolute: true
|
|
259
|
+
}).then((files) => files[0])) ?? MAGIC_MODULE_ENTRY;
|
|
260
|
+
return {
|
|
261
|
+
...options,
|
|
262
|
+
// If we are using the "magic entry", give it an explicit name of `browser`.
|
|
263
|
+
// Otherwise, Rollup will use the file name as the output name.
|
|
264
|
+
input: finalEntry === MAGIC_MODULE_ENTRY ? { browser: finalEntry } : finalEntry
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
async function quiltAppServerOptions(options = {}) {
|
|
270
|
+
const { root: rootPath = process.cwd(), output } = options;
|
|
271
|
+
const root = resolveRoot(rootPath);
|
|
272
|
+
const hash = output?.hash ?? "async-only";
|
|
273
|
+
const outputFormat = output?.format ?? "esmodules";
|
|
274
|
+
const plugins = await quiltAppServer(options);
|
|
220
275
|
return {
|
|
221
|
-
// If we are using the "magic entry", give it an explicit name of `browser`.
|
|
222
|
-
// Otherwise, Rollup will use the file name as the output name.
|
|
223
|
-
input: finalEntry === MAGIC_MODULE_ENTRY ? { browser: finalEntry } : finalEntry,
|
|
224
276
|
plugins,
|
|
225
|
-
onwarn(warning, defaultWarn) {
|
|
226
|
-
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && /['"]use client['"]/.test(warning.message)) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
defaultWarn(warning);
|
|
230
|
-
},
|
|
231
277
|
output: {
|
|
232
|
-
format:
|
|
233
|
-
dir: path.resolve(root, `build/
|
|
234
|
-
entryFileNames: `[name]${
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
generatedCode: await rollupGenerateOptionsForBrowsers(
|
|
239
|
-
browserGroup.browsers
|
|
240
|
-
)
|
|
278
|
+
format: outputFormat === "commonjs" || outputFormat === "cjs" ? "cjs" : "esm",
|
|
279
|
+
dir: path.resolve(root, `build/server`),
|
|
280
|
+
entryFileNames: `[name]${hash === true ? `.[hash]` : ""}.js`,
|
|
281
|
+
chunkFileNames: `[name]${hash === true || hash === "async-only" ? `.[hash]` : ""}.js`,
|
|
282
|
+
assetFileNames: `[name]${hash === true ? `.[hash]` : ""}.[ext]`,
|
|
283
|
+
generatedCode: "es2015"
|
|
241
284
|
}
|
|
242
285
|
};
|
|
243
286
|
}
|
|
@@ -257,13 +300,12 @@ async function quiltAppServer({
|
|
|
257
300
|
const assetsInline = assets?.inline ?? true;
|
|
258
301
|
const bundle = output?.bundle;
|
|
259
302
|
const minify = output?.minify ?? false;
|
|
260
|
-
const hash = output?.hash ?? "async-only";
|
|
261
|
-
const outputFormat = output?.format ?? "esmodules";
|
|
262
303
|
const [
|
|
263
304
|
{ visualizer },
|
|
264
305
|
{ magicModuleEnv, replaceProcessEnv },
|
|
265
306
|
{ sourceCode },
|
|
266
|
-
{
|
|
307
|
+
{ react },
|
|
308
|
+
{ tsconfigAliases },
|
|
267
309
|
{ css },
|
|
268
310
|
{ rawAssets, staticAssets },
|
|
269
311
|
{ asyncModules },
|
|
@@ -274,6 +316,7 @@ async function quiltAppServer({
|
|
|
274
316
|
import('rollup-plugin-visualizer'),
|
|
275
317
|
import('./features/env.mjs'),
|
|
276
318
|
import('./features/source-code.mjs'),
|
|
319
|
+
import('./features/react.mjs'),
|
|
277
320
|
import('./features/typescript.mjs'),
|
|
278
321
|
import('./features/css.mjs'),
|
|
279
322
|
import('./features/assets.mjs'),
|
|
@@ -283,6 +326,7 @@ async function quiltAppServer({
|
|
|
283
326
|
loadPackageJSON(root)
|
|
284
327
|
]);
|
|
285
328
|
const plugins = [
|
|
329
|
+
quiltAppServerInput({ root, entry, format }),
|
|
286
330
|
...nodePlugins,
|
|
287
331
|
replaceProcessEnv({ mode }),
|
|
288
332
|
magicModuleEnv({ ...resolveEnvOption(env), mode }),
|
|
@@ -302,6 +346,7 @@ async function quiltAppServer({
|
|
|
302
346
|
}
|
|
303
347
|
}
|
|
304
348
|
}),
|
|
349
|
+
react(),
|
|
305
350
|
esnext({
|
|
306
351
|
mode,
|
|
307
352
|
targets: ["current node"]
|
|
@@ -318,12 +363,9 @@ async function quiltAppServer({
|
|
|
318
363
|
preload: false,
|
|
319
364
|
moduleID: ({ imported }) => path.relative(root, imported)
|
|
320
365
|
}),
|
|
321
|
-
removeBuildFiles(["build/server"], { root })
|
|
366
|
+
removeBuildFiles(["build/server"], { root }),
|
|
367
|
+
tsconfigAliases({ root })
|
|
322
368
|
];
|
|
323
|
-
const tsconfigAliases = await createTSConfigAliasPlugin();
|
|
324
|
-
if (tsconfigAliases) {
|
|
325
|
-
plugins.push(tsconfigAliases);
|
|
326
|
-
}
|
|
327
369
|
const appEntry = await resolveAppEntry(app, { root, packageJSON });
|
|
328
370
|
if (appEntry) {
|
|
329
371
|
plugins.push(magicModuleAppComponent({ entry: appEntry }));
|
|
@@ -333,7 +375,6 @@ async function quiltAppServer({
|
|
|
333
375
|
nodir: true,
|
|
334
376
|
absolute: true
|
|
335
377
|
}).then((files) => files[0]);
|
|
336
|
-
const finalEntry = format === "request-router" ? MAGIC_MODULE_ENTRY : serverEntry ?? MAGIC_MODULE_ENTRY;
|
|
337
378
|
plugins.push(
|
|
338
379
|
magicModuleAppServerEntry({
|
|
339
380
|
assets: { baseURL }
|
|
@@ -360,24 +401,32 @@ async function quiltAppServer({
|
|
|
360
401
|
)
|
|
361
402
|
})
|
|
362
403
|
);
|
|
404
|
+
return plugins;
|
|
405
|
+
}
|
|
406
|
+
function quiltAppServerInput({
|
|
407
|
+
root: rootPath = process.cwd(),
|
|
408
|
+
entry,
|
|
409
|
+
format = "request-router"
|
|
410
|
+
} = {}) {
|
|
411
|
+
const root = resolveRoot(rootPath);
|
|
363
412
|
return {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
413
|
+
name: "@quilted/app-server/input",
|
|
414
|
+
async options(options) {
|
|
415
|
+
let finalEntry = normalizeRollupInput(options.input);
|
|
416
|
+
if (!finalEntry) {
|
|
417
|
+
const serverEntry = entry ? path.resolve(root, entry) : await glob("{server,service,backend}.{ts,tsx,mjs,js,jsx}", {
|
|
418
|
+
cwd: root,
|
|
419
|
+
nodir: true,
|
|
420
|
+
absolute: true
|
|
421
|
+
}).then((files) => files[0]);
|
|
422
|
+
finalEntry = format === "request-router" ? MAGIC_MODULE_ENTRY : serverEntry ?? MAGIC_MODULE_ENTRY;
|
|
371
423
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
chunkFileNames: `[name]${hash === true || hash === "async-only" ? `.[hash]` : ""}.js`,
|
|
379
|
-
assetFileNames: `[name]${hash === true ? `.[hash]` : ""}.[ext]`,
|
|
380
|
-
generatedCode: "es2015"
|
|
424
|
+
return {
|
|
425
|
+
...options,
|
|
426
|
+
// If we are using the "magic entry", give it an explicit name of `server`.
|
|
427
|
+
// Otherwise, Rollup will use the file name as the output name.
|
|
428
|
+
input: finalEntry === MAGIC_MODULE_ENTRY ? { server: finalEntry } : finalEntry
|
|
429
|
+
};
|
|
381
430
|
}
|
|
382
431
|
};
|
|
383
432
|
}
|
|
@@ -649,4 +698,4 @@ async function resolveAppEntry(entry, { root, packageJSON }) {
|
|
|
649
698
|
return globbed[0];
|
|
650
699
|
}
|
|
651
700
|
|
|
652
|
-
export { magicModuleAppAssetManifests, magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, magicModuleAppServerEntry,
|
|
701
|
+
export { MAGIC_MODULE_APP_COMPONENT, MAGIC_MODULE_BROWSER_ASSETS, MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER, magicModuleAppAssetManifests, magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, magicModuleAppServerEntry, quiltAppBrowser, quiltAppBrowserInput, quiltAppBrowserOptions, quiltAppOptions, quiltAppServer, quiltAppServerInput, quiltAppServerOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function react() {
|
|
2
|
+
return {
|
|
3
|
+
name: "@quilted/react",
|
|
4
|
+
options(options) {
|
|
5
|
+
return {
|
|
6
|
+
...options,
|
|
7
|
+
onLog(level, log, handler) {
|
|
8
|
+
if (log.code === "MODULE_LEVEL_DIRECTIVE" && /['"]use client['"]/.test(log.message)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (options.onLog) {
|
|
12
|
+
options.onLog(level, log, handler);
|
|
13
|
+
} else {
|
|
14
|
+
handler(level, log);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { react };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
|
|
4
|
-
async function
|
|
4
|
+
async function tsconfigAliases({
|
|
5
5
|
root = process.cwd()
|
|
6
6
|
} = {}) {
|
|
7
7
|
const [{ default: alias }, tsconfig] = await Promise.all([
|
|
@@ -34,4 +34,4 @@ async function getTSConfig(root) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export {
|
|
37
|
+
export { tsconfigAliases };
|
package/build/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { quiltAppBrowser, quiltAppBrowserOptions, quiltAppOptions, quiltAppServer, quiltAppServerOptions } from './app.mjs';
|
|
2
2
|
export { quiltModule } from './module.mjs';
|
|
3
3
|
export { quiltPackage, quiltPackageESModules, quiltPackageESNext } from './package.mjs';
|
|
4
4
|
export { quiltServer } from './server.mjs';
|
package/build/esm/module.mjs
CHANGED
|
@@ -27,6 +27,8 @@ async function quiltModule({
|
|
|
27
27
|
{ visualizer },
|
|
28
28
|
{ magicModuleEnv, replaceProcessEnv },
|
|
29
29
|
{ sourceCode },
|
|
30
|
+
{ tsconfigAliases },
|
|
31
|
+
{ react },
|
|
30
32
|
{ esnext },
|
|
31
33
|
nodePlugins,
|
|
32
34
|
packageJSON
|
|
@@ -34,6 +36,8 @@ async function quiltModule({
|
|
|
34
36
|
import('rollup-plugin-visualizer'),
|
|
35
37
|
import('./features/env.mjs'),
|
|
36
38
|
import('./features/source-code.mjs'),
|
|
39
|
+
import('./features/typescript.mjs'),
|
|
40
|
+
import('./features/react.mjs'),
|
|
37
41
|
import('./features/esnext.mjs'),
|
|
38
42
|
getNodePlugins({ bundle }),
|
|
39
43
|
loadPackageJSON(root)
|
|
@@ -44,7 +48,9 @@ async function quiltModule({
|
|
|
44
48
|
replaceProcessEnv({ mode }),
|
|
45
49
|
magicModuleEnv({ ...resolveEnvOption(env), mode }),
|
|
46
50
|
sourceCode({ mode, targets: browserGroup.browsers }),
|
|
51
|
+
tsconfigAliases({ root }),
|
|
47
52
|
esnext({ mode, targets: browserGroup.browsers }),
|
|
53
|
+
react(),
|
|
48
54
|
removeBuildFiles(["build/assets", "build/reports"], { root })
|
|
49
55
|
];
|
|
50
56
|
if (graphql) {
|
|
@@ -69,12 +75,6 @@ async function quiltModule({
|
|
|
69
75
|
return {
|
|
70
76
|
input: finalEntry,
|
|
71
77
|
plugins,
|
|
72
|
-
onwarn(warning, defaultWarn) {
|
|
73
|
-
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && /['"]use client['"]/.test(warning.message)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
defaultWarn(warning);
|
|
77
|
-
},
|
|
78
78
|
output: {
|
|
79
79
|
format: "esm",
|
|
80
80
|
dir: outputDirectory,
|
package/build/esm/server.mjs
CHANGED
|
@@ -29,6 +29,8 @@ async function quiltServer({
|
|
|
29
29
|
{ visualizer },
|
|
30
30
|
{ magicModuleEnv, replaceProcessEnv },
|
|
31
31
|
{ sourceCode },
|
|
32
|
+
{ tsconfigAliases },
|
|
33
|
+
{ react },
|
|
32
34
|
{ esnext },
|
|
33
35
|
nodePlugins,
|
|
34
36
|
packageJSON
|
|
@@ -36,6 +38,8 @@ async function quiltServer({
|
|
|
36
38
|
import('rollup-plugin-visualizer'),
|
|
37
39
|
import('./features/env.mjs'),
|
|
38
40
|
import('./features/source-code.mjs'),
|
|
41
|
+
import('./features/typescript.mjs'),
|
|
42
|
+
import('./features/react.mjs'),
|
|
39
43
|
import('./features/esnext.mjs'),
|
|
40
44
|
getNodePlugins({ bundle }),
|
|
41
45
|
loadPackageJSON(root)
|
|
@@ -47,6 +51,8 @@ async function quiltServer({
|
|
|
47
51
|
replaceProcessEnv({ mode }),
|
|
48
52
|
magicModuleEnv({ ...resolveEnvOption(env), mode }),
|
|
49
53
|
sourceCode({ mode, targets: ["current node"] }),
|
|
54
|
+
tsconfigAliases({ root }),
|
|
55
|
+
react(),
|
|
50
56
|
esnext({ mode, targets: ["current node"] }),
|
|
51
57
|
removeBuildFiles(["build/server", "build/reports"], { root })
|
|
52
58
|
];
|
|
@@ -115,4 +121,4 @@ async function sourceForServer(root, packageJSON) {
|
|
|
115
121
|
return possibleSourceFiles[0];
|
|
116
122
|
}
|
|
117
123
|
|
|
118
|
-
export { quiltServer };
|
|
124
|
+
export { MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER, quiltServer };
|
|
@@ -8,7 +8,8 @@ async function getBrowserGroupTargetDetails(targetSelection = {}, { root } = {})
|
|
|
8
8
|
const targetName = targets.name ?? "default";
|
|
9
9
|
return config[targetName] ?? ["defaults"];
|
|
10
10
|
})();
|
|
11
|
-
|
|
11
|
+
const browsers = browserslist(targetBrowsers);
|
|
12
|
+
return { name: targets.name, browsers };
|
|
12
13
|
}
|
|
13
14
|
async function getBrowserGroups({
|
|
14
15
|
root = process.cwd()
|
|
@@ -28,6 +28,9 @@ function removeBuildFiles(patterns, { root = process.cwd() } = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
function normalizeRollupInput(input) {
|
|
32
|
+
return Array.isArray(input) && input.length === 0 ? void 0 : input;
|
|
33
|
+
}
|
|
31
34
|
async function getNodePlugins({
|
|
32
35
|
bundle = {}
|
|
33
36
|
} = {}) {
|
|
@@ -100,4 +103,4 @@ async function getNodePlugins({
|
|
|
100
103
|
];
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
export { getNodePlugins, removeBuildFiles, smartReplace };
|
|
106
|
+
export { getNodePlugins, normalizeRollupInput, removeBuildFiles, smartReplace };
|