@quilted/rollup 0.2.2 → 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 +14 -0
- package/build/esm/app.mjs +124 -65
- 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 +5 -12
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts +65 -15
- 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 +167 -91
- 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 +6 -12
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c5f61853`](https://github.com/lemonmade/quilt/commit/c5f61853fe0692e98f735fa55218a96b1b3f75f7) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix root module resolution for app rollup plugins
|
|
14
|
+
|
|
15
|
+
- [`47103ea8`](https://github.com/lemonmade/quilt/commit/47103ea851be46d6203ebecdf0f73ef2c42f727a) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix .mjs extension preference during node resolution
|
|
16
|
+
|
|
3
17
|
## 0.2.2
|
|
4
18
|
|
|
5
19
|
### 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 }));
|
|
@@ -176,7 +207,10 @@ async function quiltAppBrowser({
|
|
|
176
207
|
const { graphql: graphql2 } = await import('./features/graphql.mjs');
|
|
177
208
|
plugins.push(
|
|
178
209
|
graphql2({
|
|
179
|
-
manifest: path.resolve(
|
|
210
|
+
manifest: path.resolve(
|
|
211
|
+
root,
|
|
212
|
+
`build/manifests/graphql${targetFilenamePart}.json`
|
|
213
|
+
)
|
|
180
214
|
})
|
|
181
215
|
);
|
|
182
216
|
}
|
|
@@ -192,7 +226,10 @@ async function quiltAppBrowser({
|
|
|
192
226
|
assetManifest({
|
|
193
227
|
baseURL,
|
|
194
228
|
cacheKey,
|
|
195
|
-
file: path.resolve(
|
|
229
|
+
file: path.resolve(
|
|
230
|
+
root,
|
|
231
|
+
`build/manifests/assets${targetFilenamePart}.json`
|
|
232
|
+
),
|
|
196
233
|
priority: assets?.priority
|
|
197
234
|
}),
|
|
198
235
|
visualizer({
|
|
@@ -200,37 +237,50 @@ async function quiltAppBrowser({
|
|
|
200
237
|
open: false,
|
|
201
238
|
brotliSize: true,
|
|
202
239
|
filename: path.resolve(
|
|
240
|
+
root,
|
|
203
241
|
`build/reports/bundle-visualizer${targetFilenamePart}.html`
|
|
204
242
|
)
|
|
205
243
|
})
|
|
206
244
|
);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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);
|
|
213
275
|
return {
|
|
214
|
-
// If we are using the "magic entry", give it an explicit name of `browser`.
|
|
215
|
-
// Otherwise, Rollup will use the file name as the output name.
|
|
216
|
-
input: finalEntry === MAGIC_MODULE_ENTRY ? { browser: finalEntry } : finalEntry,
|
|
217
276
|
plugins,
|
|
218
|
-
onwarn(warning, defaultWarn) {
|
|
219
|
-
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && /['"]use client['"]/.test(warning.message)) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
defaultWarn(warning);
|
|
223
|
-
},
|
|
224
277
|
output: {
|
|
225
|
-
format:
|
|
226
|
-
dir: path.resolve(root, `build/
|
|
227
|
-
entryFileNames: `[name]${
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
generatedCode: await rollupGenerateOptionsForBrowsers(
|
|
232
|
-
browserGroup.browsers
|
|
233
|
-
)
|
|
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"
|
|
234
284
|
}
|
|
235
285
|
};
|
|
236
286
|
}
|
|
@@ -250,13 +300,12 @@ async function quiltAppServer({
|
|
|
250
300
|
const assetsInline = assets?.inline ?? true;
|
|
251
301
|
const bundle = output?.bundle;
|
|
252
302
|
const minify = output?.minify ?? false;
|
|
253
|
-
const hash = output?.hash ?? "async-only";
|
|
254
|
-
const outputFormat = output?.format ?? "esmodules";
|
|
255
303
|
const [
|
|
256
304
|
{ visualizer },
|
|
257
305
|
{ magicModuleEnv, replaceProcessEnv },
|
|
258
306
|
{ sourceCode },
|
|
259
|
-
{
|
|
307
|
+
{ react },
|
|
308
|
+
{ tsconfigAliases },
|
|
260
309
|
{ css },
|
|
261
310
|
{ rawAssets, staticAssets },
|
|
262
311
|
{ asyncModules },
|
|
@@ -267,6 +316,7 @@ async function quiltAppServer({
|
|
|
267
316
|
import('rollup-plugin-visualizer'),
|
|
268
317
|
import('./features/env.mjs'),
|
|
269
318
|
import('./features/source-code.mjs'),
|
|
319
|
+
import('./features/react.mjs'),
|
|
270
320
|
import('./features/typescript.mjs'),
|
|
271
321
|
import('./features/css.mjs'),
|
|
272
322
|
import('./features/assets.mjs'),
|
|
@@ -276,6 +326,7 @@ async function quiltAppServer({
|
|
|
276
326
|
loadPackageJSON(root)
|
|
277
327
|
]);
|
|
278
328
|
const plugins = [
|
|
329
|
+
quiltAppServerInput({ root, entry, format }),
|
|
279
330
|
...nodePlugins,
|
|
280
331
|
replaceProcessEnv({ mode }),
|
|
281
332
|
magicModuleEnv({ ...resolveEnvOption(env), mode }),
|
|
@@ -295,6 +346,7 @@ async function quiltAppServer({
|
|
|
295
346
|
}
|
|
296
347
|
}
|
|
297
348
|
}),
|
|
349
|
+
react(),
|
|
298
350
|
esnext({
|
|
299
351
|
mode,
|
|
300
352
|
targets: ["current node"]
|
|
@@ -311,12 +363,9 @@ async function quiltAppServer({
|
|
|
311
363
|
preload: false,
|
|
312
364
|
moduleID: ({ imported }) => path.relative(root, imported)
|
|
313
365
|
}),
|
|
314
|
-
removeBuildFiles(["build/server"], { root })
|
|
366
|
+
removeBuildFiles(["build/server"], { root }),
|
|
367
|
+
tsconfigAliases({ root })
|
|
315
368
|
];
|
|
316
|
-
const tsconfigAliases = await createTSConfigAliasPlugin();
|
|
317
|
-
if (tsconfigAliases) {
|
|
318
|
-
plugins.push(tsconfigAliases);
|
|
319
|
-
}
|
|
320
369
|
const appEntry = await resolveAppEntry(app, { root, packageJSON });
|
|
321
370
|
if (appEntry) {
|
|
322
371
|
plugins.push(magicModuleAppComponent({ entry: appEntry }));
|
|
@@ -326,7 +375,6 @@ async function quiltAppServer({
|
|
|
326
375
|
nodir: true,
|
|
327
376
|
absolute: true
|
|
328
377
|
}).then((files) => files[0]);
|
|
329
|
-
const finalEntry = format === "request-router" ? MAGIC_MODULE_ENTRY : serverEntry ?? MAGIC_MODULE_ENTRY;
|
|
330
378
|
plugins.push(
|
|
331
379
|
magicModuleAppServerEntry({
|
|
332
380
|
assets: { baseURL }
|
|
@@ -347,27 +395,38 @@ async function quiltAppServer({
|
|
|
347
395
|
template: "treemap",
|
|
348
396
|
open: false,
|
|
349
397
|
brotliSize: false,
|
|
350
|
-
filename: path.resolve(
|
|
398
|
+
filename: path.resolve(
|
|
399
|
+
root,
|
|
400
|
+
`build/reports/bundle-visualizer.server.html`
|
|
401
|
+
)
|
|
351
402
|
})
|
|
352
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);
|
|
353
412
|
return {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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;
|
|
361
423
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
chunkFileNames: `[name]${hash === true || hash === "async-only" ? `.[hash]` : ""}.js`,
|
|
369
|
-
assetFileNames: `[name]${hash === true ? `.[hash]` : ""}.[ext]`,
|
|
370
|
-
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
|
+
};
|
|
371
430
|
}
|
|
372
431
|
};
|
|
373
432
|
}
|
|
@@ -639,4 +698,4 @@ async function resolveAppEntry(entry, { root, packageJSON }) {
|
|
|
639
698
|
return globbed[0];
|
|
640
699
|
}
|
|
641
700
|
|
|
642
|
-
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
|
} = {}) {
|
|
@@ -86,17 +89,7 @@ async function getNodePlugins({
|
|
|
86
89
|
nodeResolve({
|
|
87
90
|
preferBuiltins: true,
|
|
88
91
|
dedupe: [],
|
|
89
|
-
extensions: [
|
|
90
|
-
".ts",
|
|
91
|
-
".tsx",
|
|
92
|
-
".mts",
|
|
93
|
-
".mtsx",
|
|
94
|
-
".js",
|
|
95
|
-
".jsx",
|
|
96
|
-
".es6",
|
|
97
|
-
".es",
|
|
98
|
-
".mjs"
|
|
99
|
-
],
|
|
92
|
+
extensions: [".ts", ".tsx", ".mts", ".mtsx", ".mjs", ".js", ".jsx"],
|
|
100
93
|
exportConditions: [
|
|
101
94
|
"esnext",
|
|
102
95
|
"quilt:esnext",
|
|
@@ -110,4 +103,4 @@ async function getNodePlugins({
|
|
|
110
103
|
];
|
|
111
104
|
}
|
|
112
105
|
|
|
113
|
-
export { getNodePlugins, removeBuildFiles, smartReplace };
|
|
106
|
+
export { getNodePlugins, normalizeRollupInput, removeBuildFiles, smartReplace };
|