@quilted/rollup 0.2.19 → 0.2.21
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 +12 -0
- package/build/esm/app.mjs +10 -4
- package/build/esm/module.mjs +10 -4
- package/build/esm/server.mjs +7 -1
- package/build/esm/shared/rollup.mjs +5 -3
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts +54 -21
- package/build/typescript/app.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 +34 -3
- package/build/typescript/module.d.ts.map +1 -1
- package/build/typescript/package.d.ts +2 -2
- package/build/typescript/server.d.ts +19 -3
- package/build/typescript/server.d.ts.map +1 -1
- package/build/typescript/shared/rollup.d.ts +10 -1
- package/build/typescript/shared/rollup.d.ts.map +1 -1
- package/package.json +1 -1
- package/source/app.ts +12 -7
- package/source/index.ts +1 -1
- package/source/module.ts +53 -4
- package/source/server.ts +24 -3
- package/source/shared/rollup.ts +14 -2
- package/build/typescript/features/request-router.d.ts +0 -15
- package/build/typescript/features/request-router.d.ts.map +0 -1
- package/build/typescript/shared/package-json.d.ts +0 -6
- package/build/typescript/shared/package-json.d.ts.map +0 -1
- package/build/typescript/shared/path.d.ts +0 -2
- package/build/typescript/shared/path.d.ts.map +0 -1
- package/build/typescript/shared/server.d.ts +0 -36
- package/build/typescript/shared/server.d.ts.map +0 -1
- package/source/shared/server.ts +0 -48
|
@@ -3,8 +3,7 @@ import { MAGIC_MODULE_ENTRY, MAGIC_MODULE_APP_COMPONENT, MAGIC_MODULE_BROWSER_AS
|
|
|
3
3
|
import { type MagicModuleEnvOptions } from './features/env.ts';
|
|
4
4
|
import { type RollupNodePluginOptions } from './shared/rollup.ts';
|
|
5
5
|
import { type BrowserGroupTargetSelection } from './shared/browserslist.ts';
|
|
6
|
-
import type { ServerRuntime } from './
|
|
7
|
-
import type { NodeServerRuntimeOptions } from './server.ts';
|
|
6
|
+
import type { ServerRuntime, NodeServerRuntimeOptions } from './server.ts';
|
|
8
7
|
export interface AppBaseOptions {
|
|
9
8
|
/**
|
|
10
9
|
* The root directory containing the source code for your application.
|
|
@@ -246,13 +245,6 @@ export declare function quiltAppBrowserInput({ root, entry, }?: Pick<AppBrowserO
|
|
|
246
245
|
export declare function quiltAppServer(options?: AppServerOptions): Promise<{
|
|
247
246
|
plugins: InputPluginOption[];
|
|
248
247
|
output: {
|
|
249
|
-
format: "esm";
|
|
250
|
-
dir: string;
|
|
251
|
-
entryFileNames: string;
|
|
252
|
-
chunkFileNames: string;
|
|
253
|
-
assetFileNames: string;
|
|
254
|
-
generatedCode: "es2015";
|
|
255
|
-
} | {
|
|
256
248
|
amd?: import("rollup").AmdOptions | undefined;
|
|
257
249
|
assetFileNames: string | ((chunkInfo: import("rollup").PreRenderedAsset) => string);
|
|
258
250
|
banner?: string | import("rollup").AddonFunction | undefined;
|
|
@@ -272,7 +264,7 @@ export declare function quiltAppServer(options?: AppServerOptions): Promise<{
|
|
|
272
264
|
footer?: string | import("rollup").AddonFunction | undefined;
|
|
273
265
|
format: import("rollup").ModuleFormat;
|
|
274
266
|
freeze?: boolean | undefined;
|
|
275
|
-
generatedCode: import("rollup").
|
|
267
|
+
generatedCode: import("rollup").GeneratedCodeOptions | import("rollup").GeneratedCodePreset;
|
|
276
268
|
globals?: import("rollup").GlobalsOption | undefined;
|
|
277
269
|
hoistTransitiveImports?: boolean | undefined;
|
|
278
270
|
indent?: string | boolean | undefined;
|
|
@@ -299,13 +291,6 @@ export declare function quiltAppServer(options?: AppServerOptions): Promise<{
|
|
|
299
291
|
strict?: boolean | undefined;
|
|
300
292
|
systemNullSetters?: boolean | undefined;
|
|
301
293
|
validate?: boolean | undefined;
|
|
302
|
-
} | {
|
|
303
|
-
format: "esm" | "cjs";
|
|
304
|
-
dir: string;
|
|
305
|
-
entryFileNames: string;
|
|
306
|
-
chunkFileNames: string;
|
|
307
|
-
assetFileNames: string;
|
|
308
|
-
generatedCode: "es2015";
|
|
309
294
|
};
|
|
310
295
|
}>;
|
|
311
296
|
export declare function quiltAppServerPlugins({ root, app, env, entry, format, graphql, assets, output, runtime, }?: AppServerOptions): Promise<InputPluginOption[]>;
|
|
@@ -369,7 +354,19 @@ export declare function magicModuleAppComponent({ entry, root, }: {
|
|
|
369
354
|
load: ((this: import("rollup").PluginContext, source: string) => Promise<{
|
|
370
355
|
code: string;
|
|
371
356
|
moduleSideEffects: "no-treeshake" | undefined;
|
|
372
|
-
} | null>) | undefined;
|
|
357
|
+
} | null>) | undefined; /**
|
|
358
|
+
* The entry module for this app. This should be an absolute path, or relative
|
|
359
|
+
* path from the root directory containing your project. This entry should just be
|
|
360
|
+
* for the main `App` component in your project, which Quilt will automatically use
|
|
361
|
+
* to create browser and server-side entries for your project.
|
|
362
|
+
*
|
|
363
|
+
* If you only want to use a custom entry module for the browser build, use the
|
|
364
|
+
* `entry` option of the `quiltAppBrowser()` instead. If you only want to use a
|
|
365
|
+
* custom entry module for the server-side build, use the `server.entry` option
|
|
366
|
+
* instead.
|
|
367
|
+
*
|
|
368
|
+
* @example './App.tsx'
|
|
369
|
+
*/
|
|
373
370
|
};
|
|
374
371
|
export declare function magicModuleAppRequestRouter({ entry, root, }?: Pick<AppServerOptions, 'entry' | 'root'>): {
|
|
375
372
|
name: string;
|
|
@@ -380,7 +377,19 @@ export declare function magicModuleAppRequestRouter({ entry, root, }?: Pick<AppS
|
|
|
380
377
|
load: ((this: import("rollup").PluginContext, source: string) => Promise<{
|
|
381
378
|
code: string;
|
|
382
379
|
moduleSideEffects: "no-treeshake" | undefined;
|
|
383
|
-
} | null>) | undefined;
|
|
380
|
+
} | null>) | undefined; /**
|
|
381
|
+
* The entry module for this app. This should be an absolute path, or relative
|
|
382
|
+
* path from the root directory containing your project. This entry should just be
|
|
383
|
+
* for the main `App` component in your project, which Quilt will automatically use
|
|
384
|
+
* to create browser and server-side entries for your project.
|
|
385
|
+
*
|
|
386
|
+
* If you only want to use a custom entry module for the browser build, use the
|
|
387
|
+
* `entry` option of the `quiltAppBrowser()` instead. If you only want to use a
|
|
388
|
+
* custom entry module for the server-side build, use the `server.entry` option
|
|
389
|
+
* instead.
|
|
390
|
+
*
|
|
391
|
+
* @example './App.tsx'
|
|
392
|
+
*/
|
|
384
393
|
};
|
|
385
394
|
export declare function magicModuleAppBrowserEntry({ hydrate, selector, }?: AppBrowserModuleOptions): {
|
|
386
395
|
name: string;
|
|
@@ -391,7 +400,19 @@ export declare function magicModuleAppBrowserEntry({ hydrate, selector, }?: AppB
|
|
|
391
400
|
load: ((this: import("rollup").PluginContext, source: string) => Promise<{
|
|
392
401
|
code: string;
|
|
393
402
|
moduleSideEffects: "no-treeshake" | undefined;
|
|
394
|
-
} | null>) | undefined;
|
|
403
|
+
} | null>) | undefined; /**
|
|
404
|
+
* The entry module for this app. This should be an absolute path, or relative
|
|
405
|
+
* path from the root directory containing your project. This entry should just be
|
|
406
|
+
* for the main `App` component in your project, which Quilt will automatically use
|
|
407
|
+
* to create browser and server-side entries for your project.
|
|
408
|
+
*
|
|
409
|
+
* If you only want to use a custom entry module for the browser build, use the
|
|
410
|
+
* `entry` option of the `quiltAppBrowser()` instead. If you only want to use a
|
|
411
|
+
* custom entry module for the server-side build, use the `server.entry` option
|
|
412
|
+
* instead.
|
|
413
|
+
*
|
|
414
|
+
* @example './App.tsx'
|
|
415
|
+
*/
|
|
395
416
|
};
|
|
396
417
|
export declare function magicModuleAppAssetManifests(): {
|
|
397
418
|
name: string;
|
|
@@ -402,7 +423,19 @@ export declare function magicModuleAppAssetManifests(): {
|
|
|
402
423
|
load: ((this: import("rollup").PluginContext, source: string) => Promise<{
|
|
403
424
|
code: string;
|
|
404
425
|
moduleSideEffects: "no-treeshake" | undefined;
|
|
405
|
-
} | null>) | undefined;
|
|
426
|
+
} | null>) | undefined; /**
|
|
427
|
+
* The entry module for this app. This should be an absolute path, or relative
|
|
428
|
+
* path from the root directory containing your project. This entry should just be
|
|
429
|
+
* for the main `App` component in your project, which Quilt will automatically use
|
|
430
|
+
* to create browser and server-side entries for your project.
|
|
431
|
+
*
|
|
432
|
+
* If you only want to use a custom entry module for the browser build, use the
|
|
433
|
+
* `entry` option of the `quiltAppBrowser()` instead. If you only want to use a
|
|
434
|
+
* custom entry module for the server-side build, use the `server.entry` option
|
|
435
|
+
* instead.
|
|
436
|
+
*
|
|
437
|
+
* @example './App.tsx'
|
|
438
|
+
*/
|
|
406
439
|
};
|
|
407
440
|
export declare function sourceEntryForAppBrowser({ entry, root, }: {
|
|
408
441
|
entry?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../source/app.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACf,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAmB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAOL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../source/app.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACf,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAmB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAOL,KAAK,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;IAC3E;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,IAAI,EACJ,MAAiB,EACjB,MAAM,EAAE,WAAkB,GAC3B,GAAE,2BAAgC;;;;;;;;;;EA4DlC;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,IAAoB,GACrB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;;;;;;;;;4BAnyBC;;;;;;;;;;;;OAYG;EAszBJ;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,KAAK,EACL,IAAoB,GACrB,GAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,CAAM;;;;;;;;;4BAv0B9C;;;;;;;;;;;;OAYG;EA42BJ;AAED,wBAAgB,0BAA0B,CAAC,EACzC,OAAc,EACd,QAAiB,GAClB,GAAE,uBAA4B;;;;;;;;;4BA73B7B;;;;;;;;;;;;OAYG;EA24BJ;AAED,wBAAgB,4BAA4B;;;;;;;;;4BAz5B1C;;;;;;;;;;;;OAYG;EAk9BJ;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,KAAK,EACL,IAAoB,GACrB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACrB,+BAgBA;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,KAAK,EACL,IAAoB,GACrB,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACrB,+BAgBA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { quiltApp, quiltAppBrowser, quiltAppBrowserPlugins, quiltAppServer, quiltAppServerPlugins, type AppOptions, type AppBaseOptions, type AppBrowserOptions, type AppServerOptions, type AppRuntime, type AppServerRuntime, } from './app.ts';
|
|
2
|
-
export { quiltModule, type ModuleOptions } from './module.ts';
|
|
2
|
+
export { quiltModule, type ModuleOptions, type ModuleRuntime } from './module.ts';
|
|
3
3
|
export { quiltPackage, quiltPackageESModules, quiltPackageESNext, type PackageOptions, } from './package.ts';
|
|
4
4
|
export { quiltServer, type ServerOptions, type ServerOutputOptions, type ServerRuntime, } from './server.ts';
|
|
5
5
|
export { multiline } from './shared/strings.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,WAAW,EAAE,KAAK,aAAa,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAC,MAAM,aAAa,CAAC;AAChF,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InputPluginOption, OutputOptions } from 'rollup';
|
|
2
2
|
import { RollupNodePluginOptions } from './shared/rollup.ts';
|
|
3
3
|
import { type BrowserGroupTargetSelection } from './shared/browserslist.ts';
|
|
4
4
|
import { type MagicModuleEnvOptions } from './features/env.ts';
|
|
@@ -33,6 +33,37 @@ export interface ModuleOptions {
|
|
|
33
33
|
* Customizes the assets created for your module.
|
|
34
34
|
*/
|
|
35
35
|
assets?: ModuleAssetsOptions;
|
|
36
|
+
/**
|
|
37
|
+
* Customizations to the module for the runtime it will execute in.
|
|
38
|
+
*/
|
|
39
|
+
runtime?: ModuleRuntime;
|
|
40
|
+
}
|
|
41
|
+
export interface ModuleRuntime {
|
|
42
|
+
output?: Pick<RollupNodePluginOptions, 'bundle'> & {
|
|
43
|
+
/**
|
|
44
|
+
* What module format to use for the server output.
|
|
45
|
+
*
|
|
46
|
+
* @default 'module'
|
|
47
|
+
*/
|
|
48
|
+
format?: 'module' | 'modules' | 'esmodules' | 'esm' | 'es' | 'commonjs' | 'cjs';
|
|
49
|
+
/**
|
|
50
|
+
* The directory to output the server to.
|
|
51
|
+
*/
|
|
52
|
+
directory?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Overrides to the Rollup output options.
|
|
55
|
+
*/
|
|
56
|
+
options?: OutputOptions;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Overrides for module resolution for this server.
|
|
60
|
+
*/
|
|
61
|
+
resolve?: {
|
|
62
|
+
/**
|
|
63
|
+
* Additional export conditions to use when resolving `exports` fields in `package.json`.
|
|
64
|
+
*/
|
|
65
|
+
exportConditions?: string[];
|
|
66
|
+
};
|
|
36
67
|
}
|
|
37
68
|
export interface ModuleAssetsOptions extends Pick<RollupNodePluginOptions, 'bundle'> {
|
|
38
69
|
/**
|
|
@@ -45,9 +76,9 @@ export interface ModuleAssetsOptions extends Pick<RollupNodePluginOptions, 'bund
|
|
|
45
76
|
hash?: boolean | 'async-only';
|
|
46
77
|
targets?: BrowserGroupTargetSelection;
|
|
47
78
|
}
|
|
48
|
-
export declare function quiltModule({ root, entry, env, assets, graphql, }?: ModuleOptions): Promise<{
|
|
79
|
+
export declare function quiltModule({ root, entry, env, assets, graphql, runtime, }?: ModuleOptions): Promise<{
|
|
49
80
|
input: {
|
|
50
|
-
[
|
|
81
|
+
[x: string]: string;
|
|
51
82
|
};
|
|
52
83
|
plugins: InputPluginOption[];
|
|
53
84
|
output: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../source/module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../source/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,iBAAiB,EAAiB,aAAa,EAAC,MAAM,QAAQ,CAAC;AAG5E,OAAO,EACL,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE5D;;OAEG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAAG;QACjD;;;;WAIG;QACH,MAAM,CAAC,EACH,QAAQ,GACR,SAAS,GACT,WAAW,GACX,KAAK,GACL,IAAI,GACJ,UAAU,GACV,KAAK,CAAC;QAEV;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC;IAC/C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9B,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACvC;AAED,wBAAsB,WAAW,CAAC,EAChC,IAAoB,EACpB,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAc,EACd,OAAO,GACR,GAAE,aAAkB;;;;;;;;;;;;;;;;;;;;;GAwGpB"}
|
|
@@ -117,7 +117,7 @@ export declare function quiltPackage({ root, commonjs, esnext: explicitESNext, e
|
|
|
117
117
|
generatedCode: "es2015";
|
|
118
118
|
};
|
|
119
119
|
} | {
|
|
120
|
-
plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | import("rollup").NullValue |
|
|
120
|
+
plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | Plugin<any> | import("rollup").NullValue | import("rollup").InputPluginOption[]> | null)[];
|
|
121
121
|
output: OutputOptions | OutputOptions[] | {
|
|
122
122
|
preserveModules: true;
|
|
123
123
|
preserveModulesRoot: string;
|
|
@@ -188,7 +188,7 @@ export declare function quiltPackageESNext({ root, react: useReact, graphql, ent
|
|
|
188
188
|
generatedCode: "es2015";
|
|
189
189
|
};
|
|
190
190
|
} | {
|
|
191
|
-
plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | import("rollup").NullValue |
|
|
191
|
+
plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | Plugin<any> | import("rollup").NullValue | import("rollup").InputPluginOption[]> | null)[];
|
|
192
192
|
output: OutputOptions | OutputOptions[] | {
|
|
193
193
|
preserveModules: true;
|
|
194
194
|
preserveModulesRoot: string;
|
|
@@ -2,7 +2,7 @@ import { type InputPluginOption } from 'rollup';
|
|
|
2
2
|
import { RollupNodePluginOptions } from './shared/rollup.ts';
|
|
3
3
|
import { type MagicModuleEnvOptions } from './features/env.ts';
|
|
4
4
|
import { MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER } from './constants.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ModuleRuntime } from './module.ts';
|
|
6
6
|
export interface ServerOptions {
|
|
7
7
|
/**
|
|
8
8
|
* The root directory containing the source code for your application.
|
|
@@ -49,6 +49,20 @@ export interface ServerOptions {
|
|
|
49
49
|
*/
|
|
50
50
|
runtime?: ServerRuntime;
|
|
51
51
|
}
|
|
52
|
+
export interface ServerRuntime extends ModuleRuntime {
|
|
53
|
+
/**
|
|
54
|
+
* A string that will be inlined directly as code to reference a runtime constant
|
|
55
|
+
* that contains environment variables.
|
|
56
|
+
*/
|
|
57
|
+
env?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The content to use as the entry point when the server uses the `request-router`
|
|
60
|
+
* format for their server. This file should import the request router instance for
|
|
61
|
+
* this app from 'quilt:module/request-router', and create a server that is appropriate
|
|
62
|
+
* for this runtime.
|
|
63
|
+
*/
|
|
64
|
+
requestRouter?(): string;
|
|
65
|
+
}
|
|
52
66
|
export interface ServerOutputOptions extends Pick<RollupNodePluginOptions, 'bundle'> {
|
|
53
67
|
/**
|
|
54
68
|
* The directory to output the server into.
|
|
@@ -73,7 +87,6 @@ export interface ServerOutputOptions extends Pick<RollupNodePluginOptions, 'bund
|
|
|
73
87
|
*/
|
|
74
88
|
hash?: boolean | 'async-only';
|
|
75
89
|
}
|
|
76
|
-
export type { ServerRuntime };
|
|
77
90
|
export { MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER };
|
|
78
91
|
export declare function quiltServer({ root: rootPath, entry, format, env, graphql, output, runtime, }?: ServerOptions): Promise<{
|
|
79
92
|
input: {
|
|
@@ -100,7 +113,7 @@ export declare function quiltServer({ root: rootPath, entry, format, env, graphq
|
|
|
100
113
|
footer?: string | import("rollup").AddonFunction | undefined;
|
|
101
114
|
format: import("rollup").ModuleFormat;
|
|
102
115
|
freeze?: boolean | undefined;
|
|
103
|
-
generatedCode: import("rollup").
|
|
116
|
+
generatedCode: import("rollup").GeneratedCodeOptions | import("rollup").GeneratedCodePreset;
|
|
104
117
|
globals?: import("rollup").GlobalsOption | undefined;
|
|
105
118
|
hoistTransitiveImports?: boolean | undefined;
|
|
106
119
|
indent?: string | boolean | undefined;
|
|
@@ -155,6 +168,9 @@ export declare function nodeServerRuntime({ host, port, format, }?: NodeServerRu
|
|
|
155
168
|
format: "esm" | "cjs";
|
|
156
169
|
};
|
|
157
170
|
};
|
|
171
|
+
resolve: {
|
|
172
|
+
exportConditions: string[];
|
|
173
|
+
};
|
|
158
174
|
requestRouter(): string;
|
|
159
175
|
};
|
|
160
176
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../source/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,iBAAiB,EAAqB,MAAM,QAAQ,CAAC;AAGlE,OAAO,EACL,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAmB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;A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M,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;CAC/B;AAED,OAAO,EAAC,kBAAkB,EAAE,2BAA2B,EAAC,CAAC;AAEzD,wBAAsB,WAAW,CAAC,EAChC,IAAI,EAAE,QAAwB,EAC9B,KAAK,EACL,MAAyB,EACzB,GAAG,EACH,OAAc,EACd,MAAM,EACN,OAA6B,GAC9B,GAAE,aAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwHpB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EACH,QAAQ,GACR,SAAS,GACT,WAAW,GACX,KAAK,GACL,IAAI,GACJ,UAAU,GACV,KAAK,CAAC;CACX;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,EACJ,MAAiB,GAClB,GAAE,wBAA6B;;;;;;;;;;;EA0B/B"}
|
|
@@ -33,8 +33,17 @@ export interface RollupNodePluginOptions {
|
|
|
33
33
|
* @see https://github.com/Septh/rollup-plugin-node-externals
|
|
34
34
|
*/
|
|
35
35
|
bundle?: boolean | RollupNodeBundle;
|
|
36
|
+
/**
|
|
37
|
+
* Additional options to the `@rollup/plugin-node-resolve` plugin.
|
|
38
|
+
*/
|
|
39
|
+
resolve?: {
|
|
40
|
+
/**
|
|
41
|
+
* Additional export conditions to use when resolving `exports` fields in `package.json`.
|
|
42
|
+
*/
|
|
43
|
+
exportConditions?: string[];
|
|
44
|
+
};
|
|
36
45
|
}
|
|
37
|
-
export declare function getNodePlugins({ bundle, }?: RollupNodePluginOptions): Promise<Plugin<any>[]>;
|
|
46
|
+
export declare function getNodePlugins({ bundle, resolve, }?: RollupNodePluginOptions): Promise<Plugin<any>[]>;
|
|
38
47
|
export declare function rollupPluginsToArray(plugins?: InputOptions['plugins']): import("rollup").InputPluginOption[];
|
|
39
48
|
export declare function addRollupOnWarn(options: InputOptions, warn: NonNullable<InputOptions['onwarn']>): InputOptions;
|
|
40
49
|
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../../source/shared/rollup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,QAAQ,CAAC;AAC9D,OAAgB,EAAC,KAAK,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE1E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,EACnD,OAAO,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,eAY/C;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,EAAC,IAAoB,EAAC,GAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAM;;;EAe7C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,CAAC,EAAE,WAAW,2BAEvD;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,uBAAuB;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C,EAAE,MAAM,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,wBAAsB,cAAc,CAAC,EACnC,MAAW,EACX,OAAY,GACb,GAAE,uBAA4B,0BAmF9B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,wCAErE;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,GACxC,YAAY,CAed"}
|
package/package.json
CHANGED
package/source/app.ts
CHANGED
|
@@ -36,9 +36,8 @@ import {
|
|
|
36
36
|
type BrowserGroupTargetSelection,
|
|
37
37
|
} from './shared/browserslist.ts';
|
|
38
38
|
import {Project} from './shared/project.ts';
|
|
39
|
-
import type {ServerRuntime} from './shared/server.ts';
|
|
40
39
|
|
|
41
|
-
import type {NodeServerRuntimeOptions} from './server.ts';
|
|
40
|
+
import type {ServerRuntime, NodeServerRuntimeOptions} from './server.ts';
|
|
42
41
|
|
|
43
42
|
export interface AppBaseOptions {
|
|
44
43
|
/**
|
|
@@ -567,19 +566,20 @@ export async function quiltAppServer(options: AppServerOptions = {}) {
|
|
|
567
566
|
const {
|
|
568
567
|
output,
|
|
569
568
|
root = process.cwd(),
|
|
570
|
-
runtime = nodeAppServerRuntime(),
|
|
569
|
+
runtime = nodeAppServerRuntime() as AppServerRuntime,
|
|
571
570
|
} = options;
|
|
572
571
|
|
|
573
572
|
const project = Project.load(root);
|
|
574
573
|
const hash = output?.hash ?? 'async-only';
|
|
574
|
+
const format = runtime.output?.format ?? 'esm';
|
|
575
575
|
|
|
576
576
|
const plugins = await quiltAppServerPlugins({...options, root, runtime});
|
|
577
577
|
|
|
578
578
|
return {
|
|
579
579
|
plugins,
|
|
580
580
|
output: {
|
|
581
|
-
format: 'esm',
|
|
582
|
-
dir: project.resolve(`build/server`),
|
|
581
|
+
format: format === 'cjs' || format === 'commonjs' ? 'commonjs' : 'esm',
|
|
582
|
+
dir: project.resolve(runtime.output?.directory ?? `build/server`),
|
|
583
583
|
entryFileNames: `[name]${hash === true ? `.[hash]` : ''}.js`,
|
|
584
584
|
chunkFileNames: `[name]${
|
|
585
585
|
hash === true || hash === 'async-only' ? `.[hash]` : ''
|
|
@@ -608,7 +608,9 @@ export async function quiltAppServerPlugins({
|
|
|
608
608
|
const baseURL = assets?.baseURL ?? '/assets/';
|
|
609
609
|
const assetsInline = assets?.inline ?? true;
|
|
610
610
|
|
|
611
|
-
const outputDirectory = project.resolve(
|
|
611
|
+
const outputDirectory = project.resolve(
|
|
612
|
+
runtime.output?.directory ?? 'build/server',
|
|
613
|
+
);
|
|
612
614
|
const reportsDirectory = path.resolve(outputDirectory, '../reports');
|
|
613
615
|
|
|
614
616
|
const bundle = output?.bundle ?? runtime.output?.bundle;
|
|
@@ -637,7 +639,10 @@ export async function quiltAppServerPlugins({
|
|
|
637
639
|
import('./features/assets.ts'),
|
|
638
640
|
import('./features/async.ts'),
|
|
639
641
|
import('./features/esnext.ts'),
|
|
640
|
-
getNodePlugins({
|
|
642
|
+
getNodePlugins({
|
|
643
|
+
bundle,
|
|
644
|
+
resolve: {exportConditions: runtime.resolve?.exportConditions},
|
|
645
|
+
}),
|
|
641
646
|
]);
|
|
642
647
|
|
|
643
648
|
const plugins: InputPluginOption[] = [
|
package/source/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export {
|
|
|
11
11
|
type AppRuntime,
|
|
12
12
|
type AppServerRuntime,
|
|
13
13
|
} from './app.ts';
|
|
14
|
-
export {quiltModule, type ModuleOptions} from './module.ts';
|
|
14
|
+
export {quiltModule, type ModuleOptions, type ModuleRuntime} from './module.ts';
|
|
15
15
|
export {
|
|
16
16
|
quiltPackage,
|
|
17
17
|
quiltPackageESModules,
|
package/source/module.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import type {InputPluginOption, RollupOptions, OutputOptions} from 'rollup';
|
|
4
4
|
|
|
5
5
|
import {Project, sourceEntriesForProject} from './shared/project.ts';
|
|
6
6
|
import {
|
|
@@ -50,6 +50,49 @@ export interface ModuleOptions {
|
|
|
50
50
|
* Customizes the assets created for your module.
|
|
51
51
|
*/
|
|
52
52
|
assets?: ModuleAssetsOptions;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Customizations to the module for the runtime it will execute in.
|
|
56
|
+
*/
|
|
57
|
+
runtime?: ModuleRuntime;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ModuleRuntime {
|
|
61
|
+
output?: Pick<RollupNodePluginOptions, 'bundle'> & {
|
|
62
|
+
/**
|
|
63
|
+
* What module format to use for the server output.
|
|
64
|
+
*
|
|
65
|
+
* @default 'module'
|
|
66
|
+
*/
|
|
67
|
+
format?:
|
|
68
|
+
| 'module'
|
|
69
|
+
| 'modules'
|
|
70
|
+
| 'esmodules'
|
|
71
|
+
| 'esm'
|
|
72
|
+
| 'es'
|
|
73
|
+
| 'commonjs'
|
|
74
|
+
| 'cjs';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The directory to output the server to.
|
|
78
|
+
*/
|
|
79
|
+
directory?: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Overrides to the Rollup output options.
|
|
83
|
+
*/
|
|
84
|
+
options?: OutputOptions;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Overrides for module resolution for this server.
|
|
89
|
+
*/
|
|
90
|
+
resolve?: {
|
|
91
|
+
/**
|
|
92
|
+
* Additional export conditions to use when resolving `exports` fields in `package.json`.
|
|
93
|
+
*/
|
|
94
|
+
exportConditions?: string[];
|
|
95
|
+
};
|
|
53
96
|
}
|
|
54
97
|
|
|
55
98
|
export interface ModuleAssetsOptions
|
|
@@ -71,15 +114,18 @@ export async function quiltModule({
|
|
|
71
114
|
env,
|
|
72
115
|
assets,
|
|
73
116
|
graphql = true,
|
|
117
|
+
runtime,
|
|
74
118
|
}: ModuleOptions = {}) {
|
|
75
119
|
const project = Project.load(root);
|
|
76
120
|
const mode = (typeof env === 'object' ? env?.mode : env) ?? 'production';
|
|
77
|
-
const outputDirectory = project.resolve(
|
|
121
|
+
const outputDirectory = project.resolve(
|
|
122
|
+
runtime?.output?.directory ?? 'build/output',
|
|
123
|
+
);
|
|
78
124
|
const reportDirectory = path.join(outputDirectory, '../reports');
|
|
79
125
|
|
|
80
126
|
const minify = assets?.minify ?? true;
|
|
81
127
|
const hash = assets?.hash ?? 'async-only';
|
|
82
|
-
const bundle = assets?.bundle ?? true;
|
|
128
|
+
const bundle = assets?.bundle ?? runtime?.output?.bundle ?? true;
|
|
83
129
|
|
|
84
130
|
const browserGroup = await getBrowserGroupTargetDetails(assets?.targets, {
|
|
85
131
|
root: project.root,
|
|
@@ -103,7 +149,10 @@ export async function quiltModule({
|
|
|
103
149
|
import('./features/node.ts'),
|
|
104
150
|
import('./features/react.ts'),
|
|
105
151
|
import('./features/esnext.ts'),
|
|
106
|
-
getNodePlugins({
|
|
152
|
+
getNodePlugins({
|
|
153
|
+
bundle,
|
|
154
|
+
resolve: {exportConditions: runtime?.resolve?.exportConditions},
|
|
155
|
+
}),
|
|
107
156
|
]);
|
|
108
157
|
|
|
109
158
|
const finalEntry = await resolveModuleEntry(entry, project);
|
package/source/server.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {multiline} from './shared/strings.ts';
|
|
|
13
13
|
import {resolveEnvOption, type MagicModuleEnvOptions} from './features/env.ts';
|
|
14
14
|
import {MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER} from './constants.ts';
|
|
15
15
|
import {createMagicModulePlugin} from './shared/magic-module.ts';
|
|
16
|
-
import type {
|
|
16
|
+
import type {ModuleRuntime} from './module.ts';
|
|
17
17
|
|
|
18
18
|
export interface ServerOptions {
|
|
19
19
|
/**
|
|
@@ -68,6 +68,22 @@ export interface ServerOptions {
|
|
|
68
68
|
runtime?: ServerRuntime;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
export interface ServerRuntime extends ModuleRuntime {
|
|
72
|
+
/**
|
|
73
|
+
* A string that will be inlined directly as code to reference a runtime constant
|
|
74
|
+
* that contains environment variables.
|
|
75
|
+
*/
|
|
76
|
+
env?: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The content to use as the entry point when the server uses the `request-router`
|
|
80
|
+
* format for their server. This file should import the request router instance for
|
|
81
|
+
* this app from 'quilt:module/request-router', and create a server that is appropriate
|
|
82
|
+
* for this runtime.
|
|
83
|
+
*/
|
|
84
|
+
requestRouter?(): string;
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
export interface ServerOutputOptions
|
|
72
88
|
extends Pick<RollupNodePluginOptions, 'bundle'> {
|
|
73
89
|
/**
|
|
@@ -96,7 +112,6 @@ export interface ServerOutputOptions
|
|
|
96
112
|
hash?: boolean | 'async-only';
|
|
97
113
|
}
|
|
98
114
|
|
|
99
|
-
export type {ServerRuntime};
|
|
100
115
|
export {MAGIC_MODULE_ENTRY, MAGIC_MODULE_REQUEST_ROUTER};
|
|
101
116
|
|
|
102
117
|
export async function quiltServer({
|
|
@@ -137,7 +152,10 @@ export async function quiltServer({
|
|
|
137
152
|
import('./features/node.ts'),
|
|
138
153
|
import('./features/react.ts'),
|
|
139
154
|
import('./features/esnext.ts'),
|
|
140
|
-
getNodePlugins({
|
|
155
|
+
getNodePlugins({
|
|
156
|
+
bundle,
|
|
157
|
+
resolve: {exportConditions: runtime.resolve?.exportConditions},
|
|
158
|
+
}),
|
|
141
159
|
]);
|
|
142
160
|
|
|
143
161
|
const serverEntry = entry
|
|
@@ -267,6 +285,9 @@ export function nodeServerRuntime({
|
|
|
267
285
|
format: format === 'commonjs' || format === 'cjs' ? 'cjs' : 'esm',
|
|
268
286
|
},
|
|
269
287
|
},
|
|
288
|
+
resolve: {
|
|
289
|
+
exportConditions: ['node'],
|
|
290
|
+
},
|
|
270
291
|
requestRouter() {
|
|
271
292
|
return multiline`
|
|
272
293
|
import requestRouter from ${JSON.stringify(
|
package/source/shared/rollup.ts
CHANGED
|
@@ -69,10 +69,21 @@ export interface RollupNodePluginOptions {
|
|
|
69
69
|
* @see https://github.com/Septh/rollup-plugin-node-externals
|
|
70
70
|
*/
|
|
71
71
|
bundle?: boolean | RollupNodeBundle;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Additional options to the `@rollup/plugin-node-resolve` plugin.
|
|
75
|
+
*/
|
|
76
|
+
resolve?: {
|
|
77
|
+
/**
|
|
78
|
+
* Additional export conditions to use when resolving `exports` fields in `package.json`.
|
|
79
|
+
*/
|
|
80
|
+
exportConditions?: string[];
|
|
81
|
+
};
|
|
72
82
|
}
|
|
73
83
|
|
|
74
84
|
export async function getNodePlugins({
|
|
75
85
|
bundle = {},
|
|
86
|
+
resolve = {},
|
|
76
87
|
}: RollupNodePluginOptions = {}) {
|
|
77
88
|
const [
|
|
78
89
|
{default: commonjs},
|
|
@@ -94,7 +105,7 @@ export async function getNodePlugins({
|
|
|
94
105
|
// other than node builtins.
|
|
95
106
|
nodeExternalsOptions = {
|
|
96
107
|
builtins: true,
|
|
97
|
-
builtinsPrefix: '
|
|
108
|
+
builtinsPrefix: 'add',
|
|
98
109
|
deps: false,
|
|
99
110
|
devDeps: false,
|
|
100
111
|
peerDeps: false,
|
|
@@ -128,7 +139,7 @@ export async function getNodePlugins({
|
|
|
128
139
|
|
|
129
140
|
nodeExternalsOptions = {
|
|
130
141
|
builtins: !bundleBuiltins,
|
|
131
|
-
builtinsPrefix:
|
|
142
|
+
builtinsPrefix: 'add',
|
|
132
143
|
deps: !bundleDependencies,
|
|
133
144
|
devDeps: !bundleDevDependencies,
|
|
134
145
|
peerDeps: !bundlePeerDependencies,
|
|
@@ -147,6 +158,7 @@ export async function getNodePlugins({
|
|
|
147
158
|
exportConditions: [
|
|
148
159
|
'esnext',
|
|
149
160
|
'quilt:esnext',
|
|
161
|
+
...(resolve.exportConditions ?? []),
|
|
150
162
|
'default',
|
|
151
163
|
'module',
|
|
152
164
|
'import',
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare function magicModuleRequestRouterEntry({ host, port, }?: {
|
|
2
|
-
host?: string;
|
|
3
|
-
port?: number;
|
|
4
|
-
}): {
|
|
5
|
-
name: string;
|
|
6
|
-
resolveId(this: import("rollup").PluginContext, id: string): Promise<{
|
|
7
|
-
id: string;
|
|
8
|
-
moduleSideEffects: "no-treeshake" | undefined;
|
|
9
|
-
} | null>;
|
|
10
|
-
load: ((this: import("rollup").PluginContext, source: string) => Promise<{
|
|
11
|
-
code: string;
|
|
12
|
-
moduleSideEffects: "no-treeshake" | undefined;
|
|
13
|
-
} | null>) | undefined;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=request-router.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-router.d.ts","sourceRoot":"","sources":["../../../source/features/request-router.ts"],"names":[],"mappings":"AAKA,wBAAgB,6BAA6B,CAAC,EAC5C,IAAI,EACJ,IAAI,GACL,GAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACV;;;;;;;;;;EAsBL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../source/shared/package-json.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,wBAUvD"}
|