@quilted/rollup 0.1.19 → 0.2.0

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/esm/app.mjs +443 -219
  3. package/build/esm/constants.mjs +5 -5
  4. package/build/esm/features/assets.mjs +93 -81
  5. package/build/esm/features/async.mjs +186 -0
  6. package/build/esm/features/css.mjs +26 -39
  7. package/build/esm/features/env.mjs +47 -44
  8. package/build/esm/features/esnext.mjs +57 -0
  9. package/build/esm/features/graphql/transform.mjs +60 -56
  10. package/build/esm/features/graphql.mjs +65 -47
  11. package/build/esm/features/request-router.mjs +6 -4
  12. package/build/esm/features/source-code.mjs +54 -28
  13. package/build/esm/features/system-js.mjs +13 -18
  14. package/build/esm/features/typescript.mjs +13 -10
  15. package/build/esm/features/workers.mjs +173 -0
  16. package/build/esm/index.mjs +3 -2
  17. package/build/esm/module.mjs +69 -62
  18. package/build/esm/package.mjs +275 -84
  19. package/build/esm/server.mjs +118 -0
  20. package/build/esm/shared/browserslist.mjs +141 -16
  21. package/build/esm/shared/magic-module.mjs +9 -7
  22. package/build/esm/shared/package-json.mjs +7 -1
  23. package/build/esm/shared/path.mjs +7 -0
  24. package/build/esm/shared/rollup.mjs +89 -25
  25. package/build/esm/shared/strings.mjs +7 -6
  26. package/build/tsconfig.tsbuildinfo +1 -1
  27. package/build/typescript/app.d.ts +126 -27
  28. package/build/typescript/app.d.ts.map +1 -1
  29. package/build/typescript/features/assets.d.ts +1 -2
  30. package/build/typescript/features/assets.d.ts.map +1 -1
  31. package/build/typescript/features/async.d.ts +10 -0
  32. package/build/typescript/features/async.d.ts.map +1 -0
  33. package/build/typescript/features/css.d.ts +2 -1
  34. package/build/typescript/features/css.d.ts.map +1 -1
  35. package/build/typescript/features/env.d.ts +1 -0
  36. package/build/typescript/features/env.d.ts.map +1 -1
  37. package/build/typescript/features/esnext.d.ts +9 -0
  38. package/build/typescript/features/esnext.d.ts.map +1 -0
  39. package/build/typescript/features/graphql.d.ts +2 -2
  40. package/build/typescript/features/graphql.d.ts.map +1 -1
  41. package/build/typescript/features/source-code.d.ts +9 -3
  42. package/build/typescript/features/source-code.d.ts.map +1 -1
  43. package/build/typescript/features/workers.d.ts +52 -0
  44. package/build/typescript/features/workers.d.ts.map +1 -0
  45. package/build/typescript/index.d.ts +3 -2
  46. package/build/typescript/index.d.ts.map +1 -1
  47. package/build/typescript/module.d.ts +24 -6
  48. package/build/typescript/module.d.ts.map +1 -1
  49. package/build/typescript/package.d.ts +196 -4
  50. package/build/typescript/package.d.ts.map +1 -1
  51. package/build/typescript/server.d.ts +98 -0
  52. package/build/typescript/server.d.ts.map +1 -0
  53. package/build/typescript/shared/browserslist.d.ts +20 -3
  54. package/build/typescript/shared/browserslist.d.ts.map +1 -1
  55. package/build/typescript/shared/path.d.ts +2 -0
  56. package/build/typescript/shared/path.d.ts.map +1 -0
  57. package/build/typescript/shared/rollup.d.ts +27 -1
  58. package/build/typescript/shared/rollup.d.ts.map +1 -1
  59. package/configuration/rollup.config.js +40 -0
  60. package/package.json +61 -8
  61. package/source/app.ts +466 -96
  62. package/source/features/assets.ts +5 -7
  63. package/source/features/async.ts +249 -0
  64. package/source/features/css.ts +4 -2
  65. package/source/features/env.ts +6 -0
  66. package/source/features/esnext.ts +70 -0
  67. package/source/features/graphql.ts +4 -2
  68. package/source/features/source-code.ts +26 -8
  69. package/source/features/workers.ts +292 -0
  70. package/source/index.ts +4 -0
  71. package/source/module.ts +45 -19
  72. package/source/package.ts +394 -36
  73. package/source/server.ts +245 -0
  74. package/source/shared/browserslist.ts +208 -18
  75. package/source/shared/path.ts +5 -0
  76. package/source/shared/rollup.ts +102 -4
  77. package/tsconfig.json +6 -2
  78. package/build/cjs/app.cjs +0 -441
  79. package/build/cjs/constants.cjs +0 -13
  80. package/build/cjs/features/assets.cjs +0 -240
  81. package/build/cjs/features/css.cjs +0 -71
  82. package/build/cjs/features/env.cjs +0 -135
  83. package/build/cjs/features/graphql/transform.cjs +0 -186
  84. package/build/cjs/features/graphql.cjs +0 -86
  85. package/build/cjs/features/request-router.cjs +0 -31
  86. package/build/cjs/features/source-code.cjs +0 -54
  87. package/build/cjs/features/system-js.cjs +0 -36
  88. package/build/cjs/features/typescript.cjs +0 -56
  89. package/build/cjs/index.cjs +0 -13
  90. package/build/cjs/module.cjs +0 -121
  91. package/build/cjs/package.cjs +0 -170
  92. package/build/cjs/shared/browserslist.cjs +0 -25
  93. package/build/cjs/shared/magic-module.cjs +0 -32
  94. package/build/cjs/shared/package-json.cjs +0 -31
  95. package/build/cjs/shared/rollup.cjs +0 -72
  96. package/build/cjs/shared/strings.cjs +0 -16
  97. package/build/esnext/app.esnext +0 -414
  98. package/build/esnext/constants.esnext +0 -7
  99. package/build/esnext/features/assets.esnext +0 -215
  100. package/build/esnext/features/css.esnext +0 -69
  101. package/build/esnext/features/env.esnext +0 -112
  102. package/build/esnext/features/graphql/transform.esnext +0 -181
  103. package/build/esnext/features/graphql.esnext +0 -84
  104. package/build/esnext/features/request-router.esnext +0 -29
  105. package/build/esnext/features/source-code.esnext +0 -51
  106. package/build/esnext/features/system-js.esnext +0 -33
  107. package/build/esnext/features/typescript.esnext +0 -34
  108. package/build/esnext/index.esnext +0 -3
  109. package/build/esnext/module.esnext +0 -100
  110. package/build/esnext/package.esnext +0 -148
  111. package/build/esnext/shared/browserslist.esnext +0 -23
  112. package/build/esnext/shared/magic-module.esnext +0 -30
  113. package/build/esnext/shared/package-json.esnext +0 -10
  114. package/build/esnext/shared/rollup.esnext +0 -49
  115. package/build/esnext/shared/strings.esnext +0 -14
  116. package/build/typescript/env.d.ts +0 -55
  117. package/build/typescript/env.d.ts.map +0 -1
  118. package/build/typescript/graphql/transform.d.ts +0 -17
  119. package/build/typescript/graphql/transform.d.ts.map +0 -1
  120. package/build/typescript/graphql.d.ts +0 -6
  121. package/build/typescript/graphql.d.ts.map +0 -1
  122. package/build/typescript/request-router.d.ts +0 -15
  123. package/build/typescript/request-router.d.ts.map +0 -1
  124. package/build/typescript/shared/source-code.d.ts +0 -5
  125. package/build/typescript/shared/source-code.d.ts.map +0 -1
  126. package/quilt.project.ts +0 -5
@@ -1,5 +1,6 @@
1
- import { Plugin } from 'rollup';
2
- export interface PackageOptions {
1
+ import { Plugin, type RollupOptions, type OutputOptions } from 'rollup';
2
+ import { type RollupNodePluginOptions } from './shared/rollup.ts';
3
+ export interface PackageBaseOptions extends Pick<RollupNodePluginOptions, 'bundle'> {
3
4
  /**
4
5
  * The root directory containing the source code for your application.
5
6
  */
@@ -10,8 +11,100 @@ export interface PackageOptions {
10
11
  * @default true
11
12
  */
12
13
  graphql?: boolean;
14
+ /**
15
+ * A map of package entry to source file name. The keys in this
16
+ * object should be in the same format as the keys for the `exports`
17
+ * property in the package.json file. For example, the following object
18
+ * species a "root" entry point
19
+ *
20
+ * ```ts
21
+ * quiltPackage({
22
+ * entries: {
23
+ * '.': './source/index.ts',
24
+ * './testing': './source/testing.ts',
25
+ * },
26
+ * });
27
+ * ```
28
+ *
29
+ * When you do not explicitly provide this option, Quilt will provide a
30
+ * default option that reads the `exports` property of your package.json,
31
+ * and attempts to infer the source files for the entry points listed
32
+ * there.
33
+ */
34
+ entries?: Record<string, string>;
35
+ /**
36
+ * Controls how React will be handled by your package. Setting this value
37
+ * to `preact` will cause Quilt to use `preact` as the JSX import source.
38
+ * Otherwise, `react` will be used as the import source.
39
+ *
40
+ * @default true
41
+ */
42
+ react?: boolean | 'react' | 'preact';
43
+ /**
44
+ * Customizes the Rollup options used to build your package. This function
45
+ * is called with the default options determined by Quilt, so you can override
46
+ * them however you like. Alternatively, you can provide a static object of
47
+ * Rollup options, which will be merged with the defaults provided by Quilt.
48
+ */
49
+ customize?: RollupOptions | ((options: RollupOptions) => RollupOptions | Promise<RollupOptions>);
13
50
  }
14
- export declare function quiltPackageESModules({ root: rootPath, graphql, }?: PackageOptions): Promise<{
51
+ export interface PackageESModuleOptions extends PackageBaseOptions {
52
+ /**
53
+ * A map of executables to output for this package. The keys in this
54
+ * object should be the filenames of the executable you want to create,
55
+ * and the values should be the source file that will be run. For example,
56
+ * the following object species a `quilt` executable, which will run the
57
+ * `./source/cli.ts` file:
58
+ *
59
+ * ```ts
60
+ * quiltPackage({
61
+ * executable: {
62
+ * quilt: './source/cli.ts',
63
+ * },
64
+ * });
65
+ * ```
66
+ *
67
+ * By default, no executables are built for a package. For more on building
68
+ * executables, see [Quilt’s package build documentation](https://github.com/lemonmade/quilt/blob/main/documentation/projects/packages/build.md#executable-files)
69
+ */
70
+ executable?: Record<string, string>;
71
+ /**
72
+ * Whether to build a CommonJS version of this library. This build
73
+ * will be placed in `./build/cjs`; you’ll need to add a `require`
74
+ * export condition to your `package.json` that points at these files
75
+ * for each entry.
76
+ *
77
+ * Instead of a boolean, you can also pass an object with an `exports`
78
+ * field. Passing this value turns on the CommonJS build, and allows you
79
+ * to customize the way in which ES exports from your source files
80
+ * are turned into CommonJS.
81
+ *
82
+ * @default false
83
+ * @see https://github.com/lemonmade/quilt/blob/main/documentation/projects/packages/builds.md#commonjs-build
84
+ */
85
+ commonjs?: boolean | {
86
+ exports?: 'named' | 'default';
87
+ };
88
+ }
89
+ export interface PackageOptions extends PackageESModuleOptions {
90
+ /**
91
+ * Whether to build an “ESNext” version of your package. This version
92
+ * will do minimal transpilation, keeping the resulting builds extremely
93
+ * close to your source code. Quilt apps and services that depend on your
94
+ * package will then re-compile the ESNext outputs to match the language
95
+ * features in the runtime environment they are targeting.
96
+ *
97
+ * @default true
98
+ * @see https://github.com/lemonmade/quilt/blob/main/documentation/projects/packages/builds.md#esnext-build
99
+ */
100
+ esnext?: boolean;
101
+ }
102
+ export declare function quiltPackage({ root: rootPath, commonjs, esnext: explicitESNext, entries, executable, bundle, react, graphql, customize, }?: PackageOptions): Promise<(RollupOptions | {
103
+ input: string[];
104
+ plugins: Plugin<any>[];
105
+ onwarn(warning: import("rollup").RollupLog, defaultWarn: import("rollup").LoggingFunction): void;
106
+ output: OutputOptions[];
107
+ } | {
15
108
  input: string[];
16
109
  plugins: Plugin<any>[];
17
110
  onwarn(warning: import("rollup").RollupLog, defaultWarn: import("rollup").LoggingFunction): void;
@@ -22,9 +115,68 @@ export declare function quiltPackageESModules({ root: rootPath, graphql, }?: Pac
22
115
  dir: string;
23
116
  entryFileNames: string;
24
117
  assetFileNames: string;
118
+ generatedCode: "es2015";
119
+ };
120
+ } | {
121
+ plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | import("rollup").NullValue | Plugin<any> | import("rollup").InputPluginOption[]> | null)[];
122
+ output: OutputOptions | OutputOptions[] | {
123
+ preserveModules: true;
124
+ preserveModulesRoot: string;
125
+ format: "esm";
126
+ dir: string;
127
+ entryFileNames: string;
128
+ assetFileNames: string;
129
+ generatedCode: "es2015";
25
130
  };
131
+ cache?: boolean | import("rollup").RollupCache | undefined;
132
+ context?: string | undefined;
133
+ experimentalCacheExpiry?: number | undefined;
134
+ experimentalLogSideEffects?: boolean | undefined;
135
+ external?: import("rollup").ExternalOption | undefined;
136
+ input: import("rollup").InputOption;
137
+ logLevel?: import("rollup").LogLevelOption | undefined;
138
+ makeAbsoluteExternalsRelative?: boolean | "ifRelativeSource" | undefined;
139
+ maxParallelFileOps?: number | undefined;
140
+ moduleContext?: ((id: string) => string | import("rollup").NullValue) | {
141
+ [id: string]: string;
142
+ } | undefined;
143
+ onLog?: import("rollup").LogHandlerWithDefault | undefined;
144
+ onwarn: import("rollup").WarningHandlerWithDefault;
145
+ perf?: boolean | undefined;
146
+ preserveEntrySignatures?: import("rollup").PreserveEntrySignaturesOption | undefined;
147
+ preserveSymlinks?: boolean | undefined;
148
+ shimMissingExports?: boolean | undefined;
149
+ strictDeprecations?: boolean | undefined;
150
+ treeshake?: boolean | import("rollup").TreeshakingPreset | import("rollup").TreeshakingOptions | undefined;
151
+ watch?: false | import("rollup").WatcherOptions | undefined;
152
+ })[]>;
153
+ export declare function quiltPackageESModules({ root: rootPath, commonjs, entries, executable, react, bundle, graphql, customize, }?: PackageESModuleOptions): Promise<RollupOptions | {
154
+ input: string[];
155
+ plugins: Plugin<any>[];
156
+ onwarn(warning: import("rollup").RollupLog, defaultWarn: import("rollup").LoggingFunction): void;
157
+ output: OutputOptions[];
26
158
  }>;
27
- export declare function quiltPackageESNext({ root: rootPath, graphql, }?: PackageOptions): Promise<{
159
+ /**
160
+ * Creates a special `esnext` build that is a minimally-processed version
161
+ * of your original source code, preserving native ESModules. This build is
162
+ * ideal for consumers, as it can be processed to transpile only what is
163
+ * needed for the consumer’s target. This will be output in an `esnext`
164
+ * subdirectory of your default build directory. To have consumers prefer
165
+ * this build, make sure that your package.json lists the `quilt:esnext`
166
+ * export condition first for all your export declarations:
167
+ *
168
+ * ```json
169
+ * {
170
+ * "exports": {
171
+ * ".": {
172
+ * "quilt:esnext": "./build/esnext/index.esnext",
173
+ * "import": "./build/esm/index.mjs"
174
+ * }
175
+ * }
176
+ * }
177
+ * ```
178
+ */
179
+ export declare function quiltPackageESNext({ root: rootPath, react, graphql, entries, bundle, customize, }?: PackageBaseOptions): Promise<RollupOptions | {
28
180
  input: string[];
29
181
  plugins: Plugin<any>[];
30
182
  onwarn(warning: import("rollup").RollupLog, defaultWarn: import("rollup").LoggingFunction): void;
@@ -35,6 +187,46 @@ export declare function quiltPackageESNext({ root: rootPath, graphql, }?: Packag
35
187
  dir: string;
36
188
  entryFileNames: string;
37
189
  assetFileNames: string;
190
+ generatedCode: "es2015";
191
+ };
192
+ } | {
193
+ plugins: (false | void | Plugin<any> | import("rollup").InputPluginOption[] | Promise<false | import("rollup").NullValue | Plugin<any> | import("rollup").InputPluginOption[]> | null)[];
194
+ output: OutputOptions | OutputOptions[] | {
195
+ preserveModules: true;
196
+ preserveModulesRoot: string;
197
+ format: "esm";
198
+ dir: string;
199
+ entryFileNames: string;
200
+ assetFileNames: string;
201
+ generatedCode: "es2015";
38
202
  };
203
+ cache?: boolean | import("rollup").RollupCache | undefined;
204
+ context?: string | undefined;
205
+ experimentalCacheExpiry?: number | undefined;
206
+ experimentalLogSideEffects?: boolean | undefined;
207
+ external?: import("rollup").ExternalOption | undefined;
208
+ input: import("rollup").InputOption;
209
+ logLevel?: import("rollup").LogLevelOption | undefined;
210
+ makeAbsoluteExternalsRelative?: boolean | "ifRelativeSource" | undefined;
211
+ maxParallelFileOps?: number | undefined;
212
+ moduleContext?: ((id: string) => string | import("rollup").NullValue) | {
213
+ [id: string]: string;
214
+ } | undefined;
215
+ onLog?: import("rollup").LogHandlerWithDefault | undefined;
216
+ onwarn: import("rollup").WarningHandlerWithDefault;
217
+ perf?: boolean | undefined;
218
+ preserveEntrySignatures?: import("rollup").PreserveEntrySignaturesOption | undefined;
219
+ preserveSymlinks?: boolean | undefined;
220
+ shimMissingExports?: boolean | undefined;
221
+ strictDeprecations?: boolean | undefined;
222
+ treeshake?: boolean | import("rollup").TreeshakingPreset | import("rollup").TreeshakingOptions | undefined;
223
+ watch?: false | import("rollup").WatcherOptions | undefined;
39
224
  }>;
225
+ export declare function packageExecutables(executables: Record<string, string>, { root, nodeOptions }: {
226
+ root: string;
227
+ nodeOptions?: readonly string[];
228
+ }): {
229
+ name: string;
230
+ generateBundle(this: import("rollup").PluginContext): Promise<void>;
231
+ };
40
232
  //# sourceMappingURL=package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../source/package.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAOlD,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,IAAI,EAAE,QAAwB,EAC9B,OAAc,GACf,GAAE,cAAmB;;;;;;;;;;;;GAgDrB;AAED,wBAAsB,kBAAkB,CAAC,EACvC,IAAI,EAA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AE,cAAc,EACtB,OAAO,EACP,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAc,EACd,SAAS,GACV,GAAE,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiCrB;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,IAAI,EAAE,QAAwB,EAC9B,QAAgB,EAChB,OAAO,EACP,UAAe,EACf,KAAK,EACL,MAAM,EACN,OAAc,EACd,SAAS,GACV,GAAE,sBAA2B;;;;;GAmH7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,IAAI,EAAE,QAAwB,EAC9B,KAAK,EACL,OAAc,EACd,OAAO,EACP,MAAM,EACN,SAAS,GACV,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EzB;AAID,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,EAAC,IAAI,EAAE,WAAgB,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAC;;;EAyE1E"}
@@ -0,0 +1,98 @@
1
+ import { Plugin } from 'rollup';
2
+ import { RollupNodePluginOptions } from './shared/rollup.ts';
3
+ import { type MagicModuleEnvOptions } from './features/env.ts';
4
+ export interface ServerOptions {
5
+ /**
6
+ * The root directory containing the source code for your application.
7
+ */
8
+ root?: string | URL;
9
+ /**
10
+ * The entry module for this server. By default, this module must export
11
+ * a `RequestRouter` object as its default export, which will be wrapped in
12
+ * the specific server runtime you configure. If you set the format to `'custom'`,
13
+ * this entry can be any content — it will be bundled as-is.
14
+ *
15
+ * If not provided, this will default to a file named `server`, `service`,
16
+ * or `backend` in your server’s root directory.
17
+ */
18
+ entry?: string;
19
+ /**
20
+ * Whether this server code uses the `request-router` library to
21
+ * define itself in a generic way, which can be adapted to a variety
22
+ * of environments. By default, this is `'request-router'`, and when `'request-router'`,
23
+ * the `entry` you specified must export an `RequestRouter` object as
24
+ * its default export. When set to `false`, the app server will be built
25
+ * as a basic server-side JavaScript project, without the special
26
+ * `request-router` adaptor.
27
+ *
28
+ * @default 'request-router'
29
+ */
30
+ format?: 'request-router' | 'custom';
31
+ /**
32
+ * Whether to include GraphQL-related code transformations.
33
+ *
34
+ * @default true
35
+ */
36
+ graphql?: boolean;
37
+ /**
38
+ * Customizes the behavior of environment variables for your module.
39
+ */
40
+ env?: MagicModuleEnvOptions | MagicModuleEnvOptions['mode'];
41
+ /**
42
+ * Controls how the server outputs are generated.
43
+ */
44
+ output?: ServerOutputOptions;
45
+ /**
46
+ * The port that the server will listen on when it runs. This only applies
47
+ * when you use the `request-router` format — if you use the `custom` format,
48
+ * you are responsible for starting the server yourself.
49
+ *
50
+ * If you do not provide a value here, the server will listen for requests on
51
+ * the port specified by `process.env.NODE_ENV`.
52
+ */
53
+ port?: number | string;
54
+ /**
55
+ * The host that the server will listen on when it runs. This only applies
56
+ * when you use the `request-router` format — if you use the `custom` format,
57
+ * you are responsible for starting the server yourself.
58
+ */
59
+ host?: string;
60
+ }
61
+ export interface ServerOutputOptions extends Pick<RollupNodePluginOptions, 'bundle'> {
62
+ /**
63
+ * Whether to minify assets created for this server.
64
+ *
65
+ * @default false
66
+ */
67
+ minify?: boolean;
68
+ /**
69
+ * Whether to add a hash to the output files for your server. You can set
70
+ * this to `true`, which includes a hash for all files, `false`, which never
71
+ * includes a hash, or `'async-only'`, which only includes a hash for files
72
+ * that are loaded asynchronously (that is, your entry file will not have a
73
+ * hash, but any files it loads will).
74
+ *
75
+ * @default 'async-only'
76
+ */
77
+ hash?: boolean | 'async-only';
78
+ /**
79
+ * What module format to use for the server output.
80
+ *
81
+ * @default 'esmodules'
82
+ */
83
+ format?: 'esmodules' | 'esm' | 'es' | 'commonjs' | 'cjs';
84
+ }
85
+ export declare function quiltServer({ root: rootPath, entry, format, env, graphql, output, port, host, }?: ServerOptions): Promise<{
86
+ input: string;
87
+ plugins: Plugin<any>[];
88
+ onwarn(warning: import("rollup").RollupLog, defaultWarn: import("rollup").LoggingFunction): void;
89
+ output: {
90
+ format: "esm" | "cjs";
91
+ dir: string;
92
+ entryFileNames: string;
93
+ chunkFileNames: string;
94
+ assetFileNames: string;
95
+ generatedCode: "es2015";
96
+ };
97
+ }>;
98
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../source/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAGlD,OAAO,EACL,uBAAuB,EAGxB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAmB,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAI/E,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEpB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,gBAAgB,GAAG,QAAQ,CAAC;IAErC;;;;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;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC;IAC/C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAE9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,GAAG,KAAK,CAAC;CAC1D;AAED,wBAAsB,WAAW,CAAC,EAChC,IAAI,EAAE,QAAwB,EAC9B,KAAK,EACL,MAAyB,EACzB,GAAG,EACH,OAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,GACL,GAAE,aAAkB;;;;;;;;;;;;GAyGpB"}
@@ -1,11 +1,28 @@
1
- export type BrowserTargetSelection = string[] | {
1
+ export type BrowserGroupTargetSelection = readonly string[] | {
2
2
  name?: string;
3
- browsers?: string[];
3
+ browsers?: readonly string[];
4
4
  };
5
- export declare function getBrowserTargetDetails(targetSelection?: BrowserTargetSelection, { root }?: {
5
+ export declare function getBrowserGroupTargetDetails(targetSelection?: BrowserGroupTargetSelection, { root }?: {
6
6
  root?: string;
7
7
  }): Promise<{
8
8
  name: string | undefined;
9
9
  browsers: string[];
10
10
  }>;
11
+ export interface BrowserGroups {
12
+ default: readonly string[];
13
+ [name: string]: readonly string[];
14
+ }
15
+ export declare function getBrowserGroups({ root, }?: {
16
+ root?: string;
17
+ }): Promise<BrowserGroups>;
18
+ export declare function getBrowserGroupRegularExpressions(groups?: BrowserGroups): Promise<Record<string, RegExp>>;
19
+ export declare function targetsSupportModules(targets: readonly string[]): Promise<boolean>;
20
+ export declare function rollupGenerateOptionsForBrowsers(browsers: readonly string[]): Promise<{
21
+ preset: "es2015";
22
+ arrowFunctions: boolean;
23
+ constBindings: boolean;
24
+ objectShorthand: boolean;
25
+ reservedNamesAsProps: boolean;
26
+ symbols: boolean;
27
+ }>;
11
28
  //# sourceMappingURL=browserslist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserslist.d.ts","sourceRoot":"","sources":["../../../source/shared/browserslist.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC9B,MAAM,EAAE,GACR;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEN,wBAAsB,uBAAuB,CAC3C,eAAe,GAAE,sBAA2B,EAC5C,EAAC,IAAI,EAAC,GAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAM;;;GAsB7B"}
1
+ {"version":3,"file":"browserslist.d.ts","sourceRoot":"","sources":["../../../source/shared/browserslist.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GACnC,SAAS,MAAM,EAAE,GACjB;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEN,wBAAsB,4BAA4B,CAChD,eAAe,GAAE,2BAAgC,EACjD,EAAC,IAAI,EAAC,GAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAM;;;GAwB7B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,wBAAsB,gBAAgB,CAAC,EACrC,IAAoB,GACrB,GAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAwB/C;AAED,wBAAsB,iCAAiC,CACrD,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAuCjC;AAID,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,oBAcrE;AAqBD,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,SAAS,MAAM,EAAE;;;;;;;GAwE5B"}
@@ -0,0 +1,2 @@
1
+ export declare function resolveRoot(root: string | URL): string;
2
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../source/shared/path.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,UAE7C"}
@@ -7,7 +7,33 @@ export declare function removeBuildFiles(patterns: string | string[], { root }?:
7
7
  name: string;
8
8
  buildStart(this: import("rollup").PluginContext): Promise<void>;
9
9
  };
10
- export declare function getNodePlugins(): Promise<Plugin<any>[]>;
10
+ export interface RollupNodeBundle {
11
+ readonly builtins?: boolean;
12
+ readonly dependencies?: boolean;
13
+ readonly devDependencies?: boolean;
14
+ readonly peerDependencies?: boolean;
15
+ readonly exclude?: (string | RegExp)[];
16
+ readonly include?: (string | RegExp)[];
17
+ }
18
+ export interface RollupNodePluginOptions {
19
+ /**
20
+ * Controls how dependencies from node_modules will be bundled into
21
+ * your rollup build. This can either be `true`, indicating that all
22
+ * dependencies (except node builtins, like `fs`) will be bundled;
23
+ * `false`, indicating that all node dependencies should be treated as
24
+ * external in the resulting build; or a `RollupNodeBundle` object
25
+ * that gives fine-grained control over how node dependencies are
26
+ * bundled. The options in the `RollupNodeBundle` object indicate
27
+ * which dependencies to bundle into your project; this is similar to
28
+ * the options provided to [`rollup-plugin-node-externals`](https://github.com/Septh/rollup-plugin-node-externals),
29
+ * except that those options are inverted (e.g., they indicate which
30
+ * modules to externalize, rather than which modules to bundle).
31
+ *
32
+ * @see https://github.com/Septh/rollup-plugin-node-externals
33
+ */
34
+ bundle?: boolean | RollupNodeBundle;
35
+ }
36
+ export declare function getNodePlugins({ bundle, }?: RollupNodePluginOptions): Promise<Plugin<any>[]>;
11
37
  export declare function rollupPluginsToArray(plugins?: InputOptions['plugins']): import("rollup").InputPluginOption[];
12
38
  export declare function addRollupOnWarn(options: InputOptions, warn: NonNullable<InputOptions['onwarn']>): InputOptions;
13
39
  //# 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,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AAC;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;IACtC;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;CACrC;AAED,wBAAsB,cAAc,CAAC,EACnC,MAAW,GACZ,GAAE,uBAA4B,0BA4F9B;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"}
@@ -0,0 +1,40 @@
1
+ import * as fs from 'fs/promises';
2
+
3
+ import {defineConfig} from 'rollup';
4
+ import esbuild from 'rollup-plugin-esbuild';
5
+ import commonjs from '@rollup/plugin-commonjs';
6
+ import json from '@rollup/plugin-json';
7
+ import nodeResolve from '@rollup/plugin-node-resolve';
8
+ import nodeExternals from 'rollup-plugin-node-externals';
9
+
10
+ import pkg from '../package.json' assert {type: 'json'};
11
+
12
+ // We need this rollup plugin to build our other packages, so we have to manually
13
+ // author its config.
14
+ export default defineConfig({
15
+ input: Object.values(pkg.exports).map((exports) => exports['quilt:source']),
16
+ plugins: [
17
+ esbuild({
18
+ target: 'node18',
19
+ }),
20
+ nodeExternals(),
21
+ nodeResolve(),
22
+ commonjs(),
23
+ json(),
24
+ {
25
+ name: 'remove-files',
26
+ async buildStart() {
27
+ await fs.rm('build/esm', {recursive: true, force: true});
28
+ },
29
+ },
30
+ ],
31
+ output: {
32
+ dir: 'build/esm',
33
+ format: 'esm',
34
+ sourcemap: false,
35
+ preserveModules: true,
36
+ preserveModulesRoot: './source',
37
+ entryFileNames: `[name].mjs`,
38
+ assetFileNames: `[name].[ext]`,
39
+ },
40
+ });
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "access": "public",
7
7
  "@quilted/registry": "https://registry.npmjs.org"
8
8
  },
9
- "version": "0.1.19",
9
+ "version": "0.2.0",
10
10
  "engines": {
11
11
  "node": ">=14.0.0"
12
12
  },
@@ -20,22 +20,65 @@
20
20
  "types": "./build/typescript/index.d.ts",
21
21
  "quilt:source": "./source/index.ts",
22
22
  "quilt:esnext": "./build/esnext/index.esnext",
23
- "import": "./build/esm/index.mjs",
24
- "require": "./build/cjs/index.cjs"
23
+ "import": "./build/esm/index.mjs"
24
+ },
25
+ "./app": {
26
+ "types": "./build/typescript/app.d.ts",
27
+ "quilt:source": "./source/app.ts",
28
+ "quilt:esnext": "./build/esnext/app.esnext",
29
+ "import": "./build/esm/app.mjs"
30
+ },
31
+ "./module": {
32
+ "types": "./build/typescript/module.d.ts",
33
+ "quilt:source": "./source/module.ts",
34
+ "quilt:esnext": "./build/esnext/module.esnext",
35
+ "import": "./build/esm/module.mjs"
36
+ },
37
+ "./package": {
38
+ "types": "./build/typescript/package.d.ts",
39
+ "quilt:source": "./source/package.ts",
40
+ "quilt:esnext": "./build/esnext/package.esnext",
41
+ "import": "./build/esm/package.mjs"
42
+ },
43
+ "./server": {
44
+ "types": "./build/typescript/server.d.ts",
45
+ "quilt:source": "./source/server.ts",
46
+ "quilt:esnext": "./build/esnext/server.esnext",
47
+ "import": "./build/esm/server.mjs"
25
48
  },
26
49
  "./features/assets": {
27
50
  "types": "./build/typescript/features/assets.d.ts",
28
51
  "quilt:source": "./source/features/assets.ts",
29
52
  "quilt:esnext": "./build/esnext/features/assets.esnext",
30
- "import": "./build/esm/features/assets.mjs",
31
- "require": "./build/cjs/features/assets.cjs"
53
+ "import": "./build/esm/features/assets.mjs"
54
+ },
55
+ "./features/graphql": {
56
+ "types": "./build/typescript/features/graphql.d.ts",
57
+ "quilt:source": "./source/features/graphql.ts",
58
+ "quilt:esnext": "./build/esnext/features/graphql.esnext",
59
+ "import": "./build/esm/features/graphql.mjs"
32
60
  }
33
61
  },
34
62
  "types": "./build/typescript/index.d.ts",
35
63
  "typesVersions": {
36
64
  "*": {
65
+ "app": [
66
+ "./build/typescript/app.d.ts"
67
+ ],
68
+ "module": [
69
+ "./build/typescript/module.d.ts"
70
+ ],
71
+ "package": [
72
+ "./build/typescript/package.d.ts"
73
+ ],
74
+ "server": [
75
+ "./build/typescript/server.d.ts"
76
+ ],
37
77
  "features/assets": [
38
78
  "./build/typescript/features/assets.d.ts"
79
+ ],
80
+ "features/graphql": [
81
+ "./build/typescript/features/graphql.d.ts"
39
82
  ]
40
83
  }
41
84
  },
@@ -48,25 +91,31 @@
48
91
  "@babel/preset-env": "^7.23.0",
49
92
  "@babel/preset-react": "^7.22.0",
50
93
  "@babel/preset-typescript": "^7.23.0",
94
+ "@mdn/browser-compat-data": "^5.3.26",
51
95
  "@rollup/plugin-alias": "^5.0.1",
52
96
  "@rollup/plugin-babel": "^6.0.4",
53
97
  "@rollup/plugin-replace": "^5.0.3",
54
98
  "@rollup/plugin-commonjs": "^25.0.5",
55
99
  "@rollup/plugin-json": "^6.0.1",
56
100
  "@rollup/plugin-node-resolve": "^15.2.3",
57
- "@quilted/assets": "^0.0.5",
58
- "@quilted/graphql": "^2.0.0",
101
+ "@quilted/assets": "^0.1.0",
102
+ "@quilted/babel": "^0.2.0",
103
+ "@quilted/graphql": "^3.0.0",
59
104
  "@types/babel__preset-env": "^7.9.0",
60
105
  "browserslist": "^4.22.1",
106
+ "browserslist-useragent-regexp": "^4.1.0",
61
107
  "dotenv": "^16.0.0",
108
+ "es-module-lexer": "^1.3.1",
62
109
  "esbuild": "^0.19.4",
63
110
  "glob": "^10.3.10",
64
111
  "graphql": "^16.8.0",
65
112
  "lightningcss": "^1.22.0",
113
+ "magic-string": "^0.30.5",
66
114
  "mrmime": "^1.0.1",
67
115
  "rollup-plugin-esbuild": "^6.1.0",
68
116
  "rollup-plugin-node-externals": "^6.1.2",
69
117
  "rollup-plugin-visualizer": "^5.9.2",
118
+ "semver": "^7.5.4",
70
119
  "systemjs": "^6.14.2"
71
120
  },
72
121
  "peerDependencies": {
@@ -78,6 +127,7 @@
78
127
  }
79
128
  },
80
129
  "devDependencies": {
130
+ "@types/semver": "^7.5.4",
81
131
  "rollup": "^4.1.4"
82
132
  },
83
133
  "eslintConfig": {
@@ -87,5 +137,8 @@
87
137
  },
88
138
  "browserslist": [
89
139
  "extends @quilted/browserslist-config/defaults"
90
- ]
140
+ ],
141
+ "scripts": {
142
+ "build": "rollup --config configuration/rollup.config.js"
143
+ }
91
144
  }