@rindo/core 3.0.1 → 3.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 (112) hide show
  1. package/cli/config-flags.d.ts +122 -122
  2. package/cli/index.cjs +2335 -2432
  3. package/cli/index.d.ts +19 -19
  4. package/cli/index.js +2336 -2433
  5. package/cli/package.json +1 -1
  6. package/compiler/package.json +1 -1
  7. package/compiler/rindo.d.ts +73 -73
  8. package/compiler/rindo.js +66180 -62899
  9. package/compiler/rindo.min.js +2 -2
  10. package/compiler/sys/in-memory-fs.d.ts +218 -218
  11. package/compiler/transpile.d.ts +32 -32
  12. package/dev-server/client/app-error.d.ts +18 -18
  13. package/dev-server/client/events.d.ts +6 -6
  14. package/dev-server/client/hmr-components.d.ts +1 -1
  15. package/dev-server/client/hmr-external-styles.d.ts +1 -1
  16. package/dev-server/client/hmr-images.d.ts +1 -1
  17. package/dev-server/client/hmr-inline-styles.d.ts +1 -1
  18. package/dev-server/client/hmr-util.d.ts +9 -9
  19. package/dev-server/client/hmr-window.d.ts +10 -10
  20. package/dev-server/client/index.d.ts +6 -6
  21. package/dev-server/client/index.js +781 -781
  22. package/dev-server/client/logger.d.ts +5 -5
  23. package/dev-server/client/package.json +1 -1
  24. package/dev-server/client/progress.d.ts +3 -3
  25. package/dev-server/client/status.d.ts +4 -4
  26. package/dev-server/connector.html +2 -2
  27. package/dev-server/index.d.ts +3 -3
  28. package/dev-server/index.js +228 -228
  29. package/dev-server/open-in-editor-api.js +1 -1
  30. package/dev-server/package.json +1 -1
  31. package/dev-server/server-process.js +1300 -1281
  32. package/dev-server/ws.js +1 -1
  33. package/dev-server/xdg-open +0 -0
  34. package/internal/app-data/index.cjs +88 -88
  35. package/internal/app-data/index.d.ts +4 -4
  36. package/internal/app-data/index.js +88 -88
  37. package/internal/app-data/package.json +1 -1
  38. package/internal/client/css-shim.js +1 -1
  39. package/internal/client/dom.js +1 -1
  40. package/internal/client/index.js +3380 -3380
  41. package/internal/client/package.json +1 -1
  42. package/internal/client/patch-browser.js +155 -155
  43. package/internal/client/patch-esm.js +25 -25
  44. package/internal/client/shadow-css.js +382 -382
  45. package/internal/hydrate/package.json +1 -1
  46. package/internal/index.d.ts +2 -2
  47. package/internal/index.js +1 -1
  48. package/internal/package.json +1 -1
  49. package/internal/rindo-private.d.ts +2289 -2268
  50. package/internal/rindo-public-compiler.d.ts +2429 -2356
  51. package/internal/rindo-public-docs.d.ts +139 -139
  52. package/internal/rindo-public-runtime.d.ts +1636 -1636
  53. package/internal/testing/package.json +1 -1
  54. package/mock-doc/index.cjs +4766 -4766
  55. package/mock-doc/index.d.ts +1006 -1006
  56. package/mock-doc/index.js +4766 -4766
  57. package/mock-doc/package.json +1 -1
  58. package/package.json +9 -9
  59. package/screenshot/connector-base.d.ts +42 -42
  60. package/screenshot/connector-local.d.ts +7 -7
  61. package/screenshot/index.d.ts +3 -3
  62. package/screenshot/index.js +615 -615
  63. package/screenshot/package.json +1 -1
  64. package/screenshot/pixel-match.d.ts +1 -1
  65. package/screenshot/pixel-match.js +14 -14
  66. package/screenshot/screenshot-compare.d.ts +3 -3
  67. package/screenshot/screenshot-fs.d.ts +15 -15
  68. package/sys/node/autoprefixer.js +2 -2
  69. package/sys/node/glob.js +1 -1
  70. package/sys/node/graceful-fs.js +1 -1
  71. package/sys/node/index.d.ts +22 -22
  72. package/sys/node/index.js +14 -8
  73. package/sys/node/node-fetch.js +1 -1
  74. package/sys/node/package.json +1 -1
  75. package/sys/node/prompts.js +1 -1
  76. package/sys/node/worker.js +1 -1
  77. package/testing/index.d.ts +12 -12
  78. package/testing/index.js +7 -3
  79. package/testing/jest/jest-config.d.ts +16 -16
  80. package/testing/jest/jest-environment.d.ts +15 -15
  81. package/testing/jest/jest-preprocessor.d.ts +59 -59
  82. package/testing/jest/jest-runner.d.ts +10 -10
  83. package/testing/jest/jest-screenshot.d.ts +2 -2
  84. package/testing/jest/jest-serializer.d.ts +4 -4
  85. package/testing/jest/jest-setup-test-framework.d.ts +1 -1
  86. package/testing/jest-preset.js +1 -1
  87. package/testing/matchers/attributes.d.ts +14 -14
  88. package/testing/matchers/class-list.d.ts +12 -12
  89. package/testing/matchers/events.d.ts +21 -21
  90. package/testing/matchers/html.d.ts +12 -12
  91. package/testing/matchers/index.d.ts +23 -23
  92. package/testing/matchers/screenshot.d.ts +5 -5
  93. package/testing/matchers/text.d.ts +4 -4
  94. package/testing/mock-fetch.d.ts +11 -11
  95. package/testing/mocks.d.ts +56 -56
  96. package/testing/package.json +1 -1
  97. package/testing/puppeteer/index.d.ts +2 -2
  98. package/testing/puppeteer/puppeteer-browser.d.ts +6 -6
  99. package/testing/puppeteer/puppeteer-declarations.d.ts +403 -403
  100. package/testing/puppeteer/puppeteer-element.d.ts +67 -67
  101. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -2
  102. package/testing/puppeteer/puppeteer-events.d.ts +21 -21
  103. package/testing/puppeteer/puppeteer-page.d.ts +2 -2
  104. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -4
  105. package/testing/reset-build-conditionals.d.ts +2 -2
  106. package/testing/spec-page.d.ts +2 -2
  107. package/testing/test-transpile.d.ts +2 -2
  108. package/testing/testing-logger.d.ts +25 -25
  109. package/testing/testing-sys.d.ts +6 -6
  110. package/testing/testing-utils.d.ts +79 -79
  111. package/testing/testing.d.ts +2 -2
  112. package/dependencies.json +0 -120
@@ -1,2357 +1,2430 @@
1
- import type { ConfigFlags } from '../cli/config-flags';
2
- import type { PrerenderUrlResults, PrintLine } from '../internal';
3
- import type { JsonDocs } from './rindo-public-docs';
4
- export * from './rindo-public-docs';
5
- /**
6
- * https://rindojs.web.app/docs/config/
7
- */
8
- export interface RindoConfig {
9
- /**
10
- * By default, Rindo will attempt to optimize small scripts by inlining them in HTML. Setting
11
- * this flag to `false` will prevent this optimization and keep all scripts separate from HTML.
12
- */
13
- allowInlineScripts?: boolean;
14
- /**
15
- * By setting `autoprefixCss` to `true`, Rindo will use the appropriate config to automatically
16
- * prefix css. For example, developers can write modern and standard css properties, such as
17
- * "transform", and Rindo will automatically add in the prefixed version, such as "-webkit-transform".
18
- * As of Rindo v2, autoprefixing CSS is no longer the default.
19
- * Defaults to `false`
20
- */
21
- autoprefixCss?: boolean | any;
22
- /**
23
- * By default, Rindo will statically analyze the application and generate a component graph of
24
- * how all the components are interconnected.
25
- *
26
- * From the component graph it is able to best decide how components should be grouped
27
- * depending on their usage with one another within the app.
28
- * By doing so it's able to bundle components together in order to reduce network requests.
29
- * However, bundles can be manually generated using the bundles config.
30
- *
31
- * The bundles config is an array of objects that represent how components are grouped together
32
- * in lazy-loaded bundles.
33
- * This config is rarely needed as Rindo handles this automatically behind the scenes.
34
- */
35
- bundles?: ConfigBundle[];
36
- /**
37
- * Rindo will cache build results in order to speed up rebuilds.
38
- * To disable this feature, set enableCache to false.
39
- */
40
- enableCache?: boolean;
41
- /**
42
- * Rindo is traditionally used to compile many components into an app,
43
- * and each component comes with its own compartmentalized styles.
44
- * However, it's still common to have styles which should be "global" across all components and the website.
45
- * A global CSS file is often useful to set CSS Variables.
46
- *
47
- * Additionally, the globalStyle config can be used to precompile styles with Sass, PostCss, etc.
48
- * Below is an example folder structure containing a webapp's global sass file, named app.css.
49
- */
50
- globalStyle?: string;
51
- /**
52
- * When the hashFileNames config is set to true, and it is a production build,
53
- * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
54
- */
55
- hashedFileNameLength?: number;
56
- /**
57
- * During production builds, the content of each generated file is hashed to represent the content,
58
- * and the hashed value is used as the filename. If the content isn't updated between builds,
59
- * then it receives the same filename. When the content is updated, then the filename is different.
60
- *
61
- * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
62
- * content delivery networks (CDNs) and heavily caching files for faster apps.
63
- */
64
- hashFileNames?: boolean;
65
- /**
66
- * The namespace config is a string representing a namespace for the app.
67
- * For apps that are not meant to be a library of reusable components,
68
- * the default of App is just fine. However, if the app is meant to be consumed
69
- * as a third-party library, such as Family, a unique namespace is required.
70
- */
71
- namespace?: string;
72
- /**
73
- * Rindo is able to take an app's source and compile it to numerous targets,
74
- * such as an app to be deployed on an http server, or as a third-party library
75
- * to be distributed on npm. By default, Rindo apps have an output target type of www.
76
- *
77
- * The outputTargets config is an array of objects, with types of www and dist.
78
- */
79
- outputTargets?: OutputTarget[];
80
- /**
81
- * The plugins config can be used to add your own rollup plugins.
82
- * By default, Rindo does not come with Sass or PostCss support.
83
- * However, either can be added using the plugin array.
84
- */
85
- plugins?: any[];
86
- /**
87
- * Generate js source map files for all bundles
88
- */
89
- sourceMap?: boolean;
90
- /**
91
- * The srcDir config specifies the directory which should contain the source typescript files
92
- * for each component. The standard for Rindo apps is to use src, which is the default.
93
- */
94
- srcDir?: string;
95
- /**
96
- * Passes custom configuration down to the "@rollup/plugin-commonjs" that Rindo uses under the hood.
97
- * For further information: https://rindojs.web.app/docs/module-bundling
98
- */
99
- commonjs?: BundlingConfig;
100
- /**
101
- * Passes custom configuration down to the "@rollup/plugin-node-resolve" that Rindo uses under the hood.
102
- * For further information: https://rindojs.web.app/docs/module-bundling
103
- */
104
- nodeResolve?: NodeResolveConfig;
105
- /**
106
- * Passes custom configuration down to rollup itself, not all rollup options can be overridden.
107
- */
108
- rollupConfig?: RollupConfig;
109
- /**
110
- * Sets if the ES5 build should be generated or not. Rindo generates a modern build without ES5,
111
- * whereas this setting to `true` will also create es5 builds for both dev and prod modes. Setting
112
- * `buildEs5` to `prod` will only build ES5 in prod mode. Basically if the app does not need to run
113
- * on legacy browsers (IE11 and Edge 18 and below), it's safe to not build ES5, which will also speed
114
- * up build times. Defaults to `false`.
115
- */
116
- buildEs5?: boolean | 'prod';
117
- /**
118
- * Sets if the JS browser files are minified or not. Rindo uses `terser` under the hood.
119
- * Defaults to `false` in dev mode and `true` in production mode.
120
- */
121
- minifyJs?: boolean;
122
- /**
123
- * Sets if the CSS is minified or not.
124
- * Defaults to `false` in dev mode and `true` in production mode.
125
- */
126
- minifyCss?: boolean;
127
- /**
128
- * Forces Rindo to run in `dev` mode if the value is `true` and `production` mode
129
- * if it's `false`.
130
- *
131
- * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
132
- */
133
- devMode?: boolean;
134
- /**
135
- * Object to provide a custom logger. By default a `logger` is already provided for the
136
- * platform the compiler is running on, such as NodeJS or a browser.
137
- */
138
- logger?: Logger;
139
- /**
140
- * Config to add extra runtime for DOM features that require more polyfills. Note
141
- * that not all DOM APIs are fully polyfilled when using the slot polyfill. These
142
- * are opt-in since not all users will require the additional runtime.
143
- */
144
- extras?: ConfigExtras;
145
- /**
146
- * The hydrated flag identifies if a component and all of its child components
147
- * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
148
- * as various components are asynchronously downloaded and rendered. By default it
149
- * will add the `hydrated` CSS class to the element. The `hydratedFlag` config can be used
150
- * to change the name of the CSS class, change it to an attribute, or change which
151
- * type of CSS properties and values are assigned before and after hydrating. This config
152
- * can also be used to not include the hydrated flag at all by setting it to `null`.
153
- */
154
- hydratedFlag?: HydratedFlag | null;
155
- /**
156
- * Family prefers to hide all components prior to hydration with a style tag appended
157
- * to the head of the document containing some `visibility: hidden;` css rules.
158
- *
159
- * Disabling this will remove the style tag that sets `visibility: hidden;` on all
160
- * unhydrated web components. This more closely follows the HTML spec, and allows
161
- * you to set your own fallback content.
162
- *
163
- */
164
- invisiblePrehydration?: boolean;
165
- /**
166
- * Sets the task queue used by Rindo's runtime. The task queue schedules DOM read and writes
167
- * across the frames to efficiently render and reduce layout thrashing. By default,
168
- * `async` is used. It's recommended to also try each setting to decide which works
169
- * best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
170
- * main thread to periodically lock-up, it's always recommended to try
171
- * [Web Workers](https://rindojs.web.app/docs/web-workers) for those tasks.
172
- *
173
- * - `async`: DOM read and writes are scheduled in the next frame to prevent layout thrashing.
174
- * During intensive CPU tasks it will not reschedule rendering to happen in the next frame.
175
- * `async` is ideal for most apps, and if the app has many intensive tasks causing the main
176
- * thread to lock-up, it's recommended to try [Web Workers](https://rindojs.web.app/docs/web-workers)
177
- * rather than the congestion async queue.
178
- *
179
- * - `congestionAsync`: DOM reads and writes are scheduled in the next frame to prevent layout
180
- * thrashing. When the app is heavily tasked and the queue becomes congested it will then
181
- * split the work across multiple frames to prevent blocking the main thread. However, it can
182
- * also introduce unnecessary reflows in some cases, especially during startup. `congestionAsync`
183
- * is ideal for apps running animations while also simultaneously executing intensive tasks
184
- * which may lock-up the main thread.
185
- *
186
- * - `immediate`: Makes writeTask() and readTask() callbacks to be executed synchronously. Tasks
187
- * are not scheduled to run in the next frame, but do note there is at least one microtask.
188
- * The `immediate` setting is ideal for apps that do not provide long running and smooth
189
- * animations. Like the async setting, if the app has intensive tasks causing the main thread
190
- * to lock-up, it's recommended to try [Web Workers](https://rindojs.web.app/docs/web-workers).
191
- */
192
- taskQueue?: 'async' | 'immediate' | 'congestionAsync';
193
- /**
194
- * Provide a object of key/values accessible within the app, using the `Env` object.
195
- */
196
- env?: {
197
- [prop: string]: string | undefined;
198
- };
199
- globalScript?: string;
200
- srcIndexHtml?: string;
201
- watch?: boolean;
202
- testing?: TestingConfig;
203
- maxConcurrentWorkers?: number;
204
- preamble?: string;
205
- rollupPlugins?: {
206
- before?: any[];
207
- after?: any[];
208
- };
209
- entryComponentsHint?: string[];
210
- buildDist?: boolean;
211
- buildLogFilePath?: string;
212
- cacheDir?: string;
213
- devInspector?: boolean;
214
- devServer?: RindoDevServerConfig;
215
- enableCacheStats?: boolean;
216
- sys?: CompilerSystem;
217
- tsconfig?: string;
218
- validateTypes?: boolean;
219
- /**
220
- * An array of RegExp patterns that are matched against all source files before adding
221
- * to the watch list in watch mode. If the file path matches any of the patterns, when it
222
- * is updated, it will not trigger a re-run of tests.
223
- */
224
- watchIgnoredRegex?: RegExp | RegExp[];
225
- /**
226
- * Set whether unused dependencies should be excluded from the built output.
227
- */
228
- excludeUnusedDependencies?: boolean;
229
- rindoCoreResolvedId?: string;
230
- }
231
- export interface ConfigExtras {
232
- /**
233
- * By default, the slot polyfill does not update `appendChild()` so that it appends
234
- * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
235
- * polyfill for those who need it when using `element.appendChild(node)` and expecting the
236
- * child to be appended in the same location shadow dom would. This is not required for
237
- * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
238
- */
239
- appendChildSlotFix?: boolean;
240
- /**
241
- * By default, the runtime does not polyfill `cloneNode()` when cloning a component
242
- * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
243
- * This is not required for IE11 or Edge 18, but can be enabled if the app is using
244
- * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
245
- * simulating shadow dom. Defaults to `false`.
246
- */
247
- cloneNodeFix?: boolean;
248
- /**
249
- * Include the CSS Custom Property polyfill/shim for legacy browsers. ESM builds will
250
- * not include the css vars shim. Defaults to `false`
251
- *
252
- * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
253
- * versions are no longer supported.
254
- */
255
- __deprecated__cssVarsShim?: boolean;
256
- /**
257
- * Dynamic `import()` shim. This is only needed for Edge 18 and below, and
258
- * Firefox 67 and below. Defaults to `false`.
259
- * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
260
- * versions are no longer supported.
261
- */
262
- __deprecated__dynamicImportShim?: boolean;
263
- /**
264
- * Experimental flag. Projects that use a Rindo library built using the `dist` output target may have trouble lazily
265
- * loading components when using a bundler such as Wite or Parcel. Setting this flag to `true` will change how Rindo
266
- * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
267
- * the size of the compiled output. Defaults to `false`.
268
- */
269
- experimentalImportInjection?: boolean;
270
- /**
271
- * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
272
- */
273
- lifecycleDOMEvents?: boolean;
274
- /**
275
- * Safari 10 supports ES modules with `<script type="module">`, however, it did not implement
276
- * `<script nomodule>`. When set to `true`, the runtime will patch support for Safari 10
277
- * due to its lack of `nomodule` support.
278
- * Defaults to `false`.
279
- *
280
- * @deprecated Since Rindo v3.0.0, Safari 10 is no longer supported.
281
- */
282
- __deprecated__safari10?: boolean;
283
- /**
284
- * It is possible to assign data to the actual `<script>` element's `data-opts` property,
285
- * which then gets passed to Rindo's initial bootstrap. This feature is only required
286
- * for very special cases and rarely needed. Defaults to `false`.
287
- */
288
- scriptDataOpts?: boolean;
289
- /**
290
- * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
291
- * component that uses the shadow DOM. Defaults to `false`
292
- */
293
- scopedSlotTextContentFix?: boolean;
294
- /**
295
- * If enabled `true`, the runtime will check if the shadow dom shim is required. However,
296
- * if it's determined that shadow dom is already natively supported by the browser then
297
- * it does not request the shim. When set to `false` it will avoid all shadow dom tests.
298
- * Defaults to `false`.
299
- *
300
- * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari versions
301
- * are no longer supported.
302
- */
303
- __deprecated__shadowDomShim?: boolean;
304
- /**
305
- * When a component is first attached to the DOM, this setting will wait a single tick before
306
- * rendering. This works around an Angular issue, where Angular attaches the elements before
307
- * settings their initial state, leading to double renders and unnecessary event dispatches.
308
- * Defaults to `false`.
309
- */
310
- initializeNextTick?: boolean;
311
- /**
312
- * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
313
- * to simulate the same behavior. However, the host element's `childNodes` and `children`
314
- * getters are not patched to only show the child nodes and elements of the default slot.
315
- * Defaults to `false`.
316
- */
317
- slotChildNodesFix?: boolean;
318
- /**
319
- * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
320
- * can be customized at runtime. Defaults to `false`.
321
- */
322
- tagNameTransform?: boolean;
323
- }
324
- export interface Config extends RindoConfig {
325
- buildAppCore?: boolean;
326
- buildDocs?: boolean;
327
- configPath?: string;
328
- writeLog?: boolean;
329
- devServer?: DevServerConfig;
330
- flags?: ConfigFlags;
331
- fsNamespace?: string;
332
- logLevel?: LogLevel;
333
- rootDir?: string;
334
- packageJsonFilePath?: string;
335
- suppressLogs?: boolean;
336
- profile?: boolean;
337
- tsCompilerOptions?: any;
338
- _isValidated?: boolean;
339
- _isTesting?: boolean;
340
- }
341
- /**
342
- * A 'loose' type useful for wrapping an incomplete / possible malformed
343
- * object as we work on getting it comply with a particular Interface T.
344
- *
345
- * Example:
346
- *
347
- * ```ts
348
- * interface Foo {
349
- * bar: string
350
- * }
351
- *
352
- * function validateFoo(foo: Loose<Foo>): Foo {
353
- * let validatedFoo = {
354
- * ...foo,
355
- * bar: foo.bar || DEFAULT_BAR
356
- * }
357
- *
358
- * return validatedFoo
359
- * }
360
- * ```
361
- *
362
- * Use this when you need to take user input or something from some other part
363
- * of the world that we don't control and transform it into something
364
- * conforming to a given interface. For best results, pair with a validation
365
- * function as shown in the example.
366
- */
367
- type Loose<T extends Object> = Record<string, any> & Partial<T>;
368
- /**
369
- * A Loose version of the Config interface. This is intended to let us load a partial config
370
- * and have type information carry though as we construct an object which is a valid `Config`.
371
- */
372
- export type UnvalidatedConfig = Loose<Config>;
373
- /**
374
- * Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
375
- * This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
376
- *
377
- * ```typescript
378
- * type Foo { bar?: number, baz?: string }
379
- * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
380
- * ```
381
- */
382
- type RequireFields<T, K extends keyof T> = T & {
383
- [P in K]-?: T[P];
384
- };
385
- /**
386
- * Fields in {@link Config} to make required for {@link ValidatedConfig}
387
- */
388
- type StrictConfigFields = 'flags' | 'hydratedFlag' | 'logger' | 'outputTargets' | 'packageJsonFilePath' | 'rootDir' | 'sys' | 'testing';
389
- /**
390
- * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
391
- * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
392
- * about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
393
- * validations have occurred at runtime.
394
- */
395
- export type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
396
- export interface HydratedFlag {
397
- /**
398
- * Defaults to `hydrated`.
399
- */
400
- name?: string;
401
- /**
402
- * Can be either `class` or `attribute`. Defaults to `class`.
403
- */
404
- selector?: 'class' | 'attribute';
405
- /**
406
- * The CSS property used to show and hide components. Defaults to use the CSS `visibility`
407
- * property. Other commonly used CSS properties would be `display` with the `initialValue`
408
- * setting as `none`, or `opacity` with the `initialValue` as `0`. Defaults to `visibility`
409
- * and the default `initialValue` is `hidden`.
410
- */
411
- property?: string;
412
- /**
413
- * This is the CSS value to give all components before it has been hydrated.
414
- * Defaults to `hidden`.
415
- */
416
- initialValue?: string;
417
- /**
418
- * This is the CSS value to assign once a component has finished hydrating.
419
- * This is the CSS value that'll allow the component to show. Defaults to `inherit`.
420
- */
421
- hydratedValue?: string;
422
- }
423
- export interface RindoDevServerConfig {
424
- /**
425
- * IP address used by the dev server. The default is `0.0.0.0`, which points to all IPv4 addresses
426
- * on the local machine, such as `localhost`.
427
- */
428
- address?: string;
429
- /**
430
- * Base path to be used by the server. Defaults to the root pathname.
431
- */
432
- basePath?: string;
433
- /**
434
- * EXPERIMENTAL!
435
- * During development, node modules can be independently requested and bundled, making for
436
- * faster build times. This is only available using the Rindo Dev Server throughout
437
- * development. Production builds and builds with the `es5` flag will override
438
- * this setting to `false`. Default is `false`.
439
- */
440
- experimentalDevModules?: boolean;
441
- /**
442
- * If the dev server should respond with gzip compressed content. Defaults to `true`.
443
- */
444
- gzip?: boolean;
445
- /**
446
- * When set, the dev server will run via https using the SSL certificate and key you provide
447
- * (use `fs` if you want to read them from files).
448
- */
449
- https?: Credentials;
450
- /**
451
- * The URL the dev server should first open to. Defaults to `/`.
452
- */
453
- initialLoadUrl?: string;
454
- /**
455
- * When `true`, every request to the server will be logged within the terminal.
456
- * Defaults to `false`.
457
- */
458
- logRequests?: boolean;
459
- /**
460
- * By default, when dev server is started the local dev URL is opened in your default browser.
461
- * However, to prevent this URL to be opened change this value to `false`. Defaults to `true`.
462
- */
463
- openBrowser?: boolean;
464
- /**
465
- * Sets the server's port. Defaults to `3333`.
466
- */
467
- port?: number;
468
- /**
469
- * When files are watched and updated, by default the dev server will use `hmr` (Hot Module Replacement)
470
- * to update the page without a full page refresh. To have the page do a full refresh use `pageReload`.
471
- * To disable any reloading, use `null`. Defaults to `hmr`.
472
- */
473
- reloadStrategy?: PageReloadStrategy;
474
- /**
475
- * Local path to a NodeJs file with a dev server request listener as the default export.
476
- * The user's request listener is given the first chance to handle every request the dev server
477
- * receives, and can choose to handle it or instead pass it on to the default dev server
478
- * by calling `next()`.
479
- *
480
- * Below is an example of a NodeJs file the `requestListenerPath` config is using.
481
- * The request and response arguments are the same as Node's `http` module and `RequestListener`
482
- * callback. https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener
483
- *
484
- * ```js
485
- * module.exports = function (req, res, next) {
486
- * if (req.url === '/ping') {
487
- * // custom response overriding the dev server
488
- * res.setHeader('Content-Type', 'text/plain');
489
- * res.writeHead(200);
490
- * res.end('pong');
491
- * } else {
492
- * // pass request on to the default dev server
493
- * next();
494
- * }
495
- * };
496
- * ```
497
- */
498
- requestListenerPath?: string;
499
- /**
500
- * The root directory to serve the files from.
501
- */
502
- root?: string;
503
- /**
504
- * If the dev server should Server-Side Render (SSR) each page, meaning it'll dynamically generate
505
- * server-side rendered html on each page load. The `--ssr` flag will most commonly be used with
506
- * the`--dev --watch --serve` flags during development. Note that this is for development purposes
507
- * only, and the built-in dev server should not be used for production. Defaults to `false`.
508
- */
509
- ssr?: boolean;
510
- /**
511
- * If the dev server fails to start up within the given timeout (in milliseconds), the startup will
512
- * be canceled. Set to zero to disable the timeout. Defaults to `15000`.
513
- */
514
- startupTimeout?: number;
515
- /**
516
- * Whether to use the dev server's websocket client or not. Defaults to `true`.
517
- */
518
- websocket?: boolean;
519
- /**
520
- * If the dev server should fork a worker for the server process or not. A singled-threaded dev server
521
- * is slower, however it is useful for debugging http requests and responses. Defaults to `true`.
522
- */
523
- worker?: boolean;
524
- }
525
- export interface DevServerConfig extends RindoDevServerConfig {
526
- browserUrl?: string;
527
- devServerDir?: string;
528
- /**
529
- * A list of glob patterns like `subdir/*.js` to exclude from hot-module
530
- * reloading updates.
531
- */
532
- excludeHmr?: string[];
533
- historyApiFallback?: HistoryApiFallback;
534
- openBrowser?: boolean;
535
- prerenderConfig?: string;
536
- protocol?: 'http' | 'https';
537
- srcIndexHtml?: string;
538
- }
539
- export interface HistoryApiFallback {
540
- index?: string;
541
- disableDotRule?: boolean;
542
- }
543
- export interface DevServerEditor {
544
- id: string;
545
- name?: string;
546
- supported?: boolean;
547
- priority?: number;
548
- }
549
- export type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
550
- export type PageReloadStrategy = 'hmr' | 'pageReload' | null;
551
- /**
552
- * The prerender config is used when prerendering a `www` output target.
553
- * Within `rindo.config.ts`, set the path to the prerendering
554
- * config file path using the `prerenderConfig` property, such as:
555
- *
556
- * ```tsx
557
- * import { Config } from '@rindo/core';
558
- * export const config: Config = {
559
- * outputTargets: [
560
- * {
561
- * type: 'www',
562
- * baseUrl: 'https://rindojs.web.app/',
563
- * prerenderConfig: './prerender.config.ts',
564
- * }
565
- * ]
566
- * };
567
- * ```
568
- *
569
- * The `prerender.config.ts` should export a `config` object using
570
- * the `PrerenderConfig` interface.
571
- *
572
- * ```tsx
573
- * import { PrerenderConfig } from '@rindo/core';
574
- * export const config: PrerenderConfig = {
575
- * ...
576
- * };
577
- * ```
578
- *
579
- * For more info: https://rindojs.web.app/docs/static-site-generation
580
- */
581
- export interface PrerenderConfig {
582
- /**
583
- * Run after each `document` is hydrated, but before it is serialized
584
- * into an HTML string. Hook is passed the `document` and its `URL`.
585
- */
586
- afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
587
- /**
588
- * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
589
- */
590
- beforeHydrate?(document: Document, url: URL): any | Promise<any>;
591
- /**
592
- * Runs after the template Document object has serialize into an
593
- * HTML formatted string. Returns an HTML string to be used as the
594
- * base template for all prerendered pages.
595
- */
596
- afterSerializeTemplate?(html: string): string | Promise<string>;
597
- /**
598
- * Runs before the template Document object is serialize into an
599
- * HTML formatted string. Returns the Document to be serialized which
600
- * will become the base template html for all prerendered pages.
601
- */
602
- beforeSerializeTemplate?(document: Document): Document | Promise<Document>;
603
- /**
604
- * A hook to be used to generate the canonical `<link>` tag
605
- * which goes in the `<head>` of every prerendered page. Returning `null`
606
- * will not add a canonical url tag to the page.
607
- */
608
- canonicalUrl?(url: URL): string | null;
609
- /**
610
- * While prerendering, crawl same-origin URLs found within `<a href>` elements.
611
- * Defaults to `true`.
612
- */
613
- crawlUrls?: boolean;
614
- /**
615
- * URLs to start the prerendering from. By default the root URL of `/` is used.
616
- */
617
- entryUrls?: string[];
618
- /**
619
- * Return `true` the given `<a>` element should be crawled or not.
620
- */
621
- filterAnchor?(attrs: {
622
- [attrName: string]: string;
623
- }, base?: URL): boolean;
624
- /**
625
- * Return `true` if the given URL should be prerendered or not.
626
- */
627
- filterUrl?(url: URL, base: URL): boolean;
628
- /**
629
- * Returns the file path which the prerendered HTML content
630
- * should be written to.
631
- */
632
- filePath?(url: URL, filePath: string): string;
633
- /**
634
- * Returns the hydrate options to use for each individual prerendered page.
635
- */
636
- hydrateOptions?(url: URL): PrerenderHydrateOptions;
637
- /**
638
- * Returns the template file's content. The template is the base
639
- * HTML used for all prerendered pages.
640
- */
641
- loadTemplate?(filePath: string): string | Promise<string>;
642
- /**
643
- * Used to normalize the page's URL from a given a string and the current
644
- * page's base URL. Largely used when reading an anchor's `href` attribute
645
- * value and normalizing it into a `URL`.
646
- */
647
- normalizeUrl?(href: string, base: URL): URL;
648
- robotsTxt?(opts: RobotsTxtOpts): string | RobotsTxtResults;
649
- sitemapXml?(opts: SitemapXmpOpts): string | SitemapXmpResults;
650
- /**
651
- * Static Site Generated (SSG). Does not include Rindo's clientside
652
- * JavaScript, custom elements or preload modules.
653
- */
654
- staticSite?: boolean;
655
- /**
656
- * If the prerenndered URLs should have a trailing "/"" or not. Defaults to `false`.
657
- */
658
- trailingSlash?: boolean;
659
- }
660
- export interface HydrateDocumentOptions {
661
- /**
662
- * Build ID that will be added to `<html data-rindo-build="BUILD_ID">`. By default
663
- * a random ID will be generated
664
- */
665
- buildId?: string;
666
- /**
667
- * Sets the `href` attribute on the `<link rel="canonical">`
668
- * tag within the `<head>`. If the value is not defined it will
669
- * ensure a canonical link tag is no included in the `<head>`.
670
- */
671
- canonicalUrl?: string;
672
- /**
673
- * Include the HTML comments and attributes used by the clientside
674
- * JavaScript to read the structure of the HTML and rebuild each
675
- * component. Defaults to `true`.
676
- */
677
- clientHydrateAnnotations?: boolean;
678
- /**
679
- * Constrain `setTimeout()` to 1ms, but still async. Also
680
- * only allows `setInterval()` to fire once, also constrained to 1ms.
681
- * Defaults to `true`.
682
- */
683
- constrainTimeouts?: boolean;
684
- /**
685
- * Sets `document.cookie`
686
- */
687
- cookie?: string;
688
- /**
689
- * Sets the `dir` attribute on the top level `<html>`.
690
- */
691
- direction?: string;
692
- /**
693
- * Component tag names listed here will not be prerendered, nor will
694
- * hydrated on the clientside. Components listed here will be ignored
695
- * as custom elements and treated no differently than a `<div>`.
696
- */
697
- excludeComponents?: string[];
698
- /**
699
- * Sets the `lang` attribute on the top level `<html>`.
700
- */
701
- language?: string;
702
- /**
703
- * Maximum number of components to hydrate on one page. Defaults to `300`.
704
- */
705
- maxHydrateCount?: number;
706
- /**
707
- * Sets `document.referrer`
708
- */
709
- referrer?: string;
710
- /**
711
- * Removes every `<script>` element found in the `document`. Defaults to `false`.
712
- */
713
- removeScripts?: boolean;
714
- /**
715
- * Removes CSS not used by elements within the `document`. Defaults to `true`.
716
- */
717
- removeUnusedStyles?: boolean;
718
- /**
719
- * The url the runtime uses for the resources, such as the assets directory.
720
- */
721
- resourcesUrl?: string;
722
- /**
723
- * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
724
- */
725
- runtimeLogging?: boolean;
726
- /**
727
- * Component tags listed here will only be prerendered or serverside-rendered
728
- * and will not be clientside hydrated. This is useful for components that
729
- * are not dynamic and do not need to be defined as a custom element within the
730
- * browser. For example, a header or footer component would be a good example that
731
- * may not require any clientside JavaScript.
732
- */
733
- staticComponents?: string[];
734
- /**
735
- * The amount of milliseconds to wait for a page to finish rendering until
736
- * a timeout error is thrown. Defaults to `15000`.
737
- */
738
- timeout?: number;
739
- /**
740
- * Sets `document.title`.
741
- */
742
- title?: string;
743
- /**
744
- * Sets `location.href`
745
- */
746
- url?: string;
747
- /**
748
- * Sets `navigator.userAgent`
749
- */
750
- userAgent?: string;
751
- }
752
- export interface SerializeDocumentOptions extends HydrateDocumentOptions {
753
- /**
754
- * Runs after the `document` has been hydrated.
755
- */
756
- afterHydrate?(document: any): any | Promise<any>;
757
- /**
758
- * Sets an approximate line width the HTML should attempt to stay within.
759
- * Note that this is "approximate", in that HTML may often not be able
760
- * to be split at an exact line width. Additionally, new lines created
761
- * is where HTML naturally already has whitespace, such as before an
762
- * attribute or spaces between words. Defaults to `100`.
763
- */
764
- approximateLineWidth?: number;
765
- /**
766
- * Runs before the `document` has been hydrated.
767
- */
768
- beforeHydrate?(document: any): any | Promise<any>;
769
- /**
770
- * Format the HTML in a nicely indented format.
771
- * Defaults to `false`.
772
- */
773
- prettyHtml?: boolean;
774
- /**
775
- * Remove quotes from attribute values when possible.
776
- * Defaults to `true`.
777
- */
778
- removeAttributeQuotes?: boolean;
779
- /**
780
- * Remove the `=""` from standardized `boolean` attributes,
781
- * such as `hidden` or `checked`. Defaults to `true`.
782
- */
783
- removeBooleanAttributeQuotes?: boolean;
784
- /**
785
- * Remove these standardized attributes when their value is empty:
786
- * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
787
- */
788
- removeEmptyAttributes?: boolean;
789
- /**
790
- * Remove HTML comments. Defaults to `true`.
791
- */
792
- removeHtmlComments?: boolean;
793
- }
794
- export interface HydrateFactoryOptions extends SerializeDocumentOptions {
795
- serializeToHtml: boolean;
796
- destroyWindow: boolean;
797
- destroyDocument: boolean;
798
- }
799
- export interface PrerenderHydrateOptions extends SerializeDocumentOptions {
800
- /**
801
- * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
802
- * Defaults to `true`.
803
- */
804
- addModulePreloads?: boolean;
805
- /**
806
- * Hash the content of assets, such as images, fonts and css files,
807
- * and add the hashed value as `v` querystring. For example,
808
- * `/assets/image.png?v=abcd1234`. This allows for assets to be
809
- * heavily cached by setting the server's response header with
810
- * `Cache-Control: max-age=31536000, immutable`.
811
- */
812
- hashAssets?: 'querystring';
813
- /**
814
- * External stylesheets from `<link rel="stylesheet">` are instead inlined
815
- * into `<style>` elements. Defaults to `false`.
816
- */
817
- inlineExternalStyleSheets?: boolean;
818
- /**
819
- * Minify CSS content within `<style>` elements. Defaults to `true`.
820
- */
821
- minifyStyleElements?: boolean;
822
- /**
823
- * Minify JavaScript content within `<script>` elements. Defaults to `true`.
824
- */
825
- minifyScriptElements?: boolean;
826
- /**
827
- * Entire `document` should be static. This is useful for specific pages that
828
- * should be static, rather than the entire site. If the whole site should be static,
829
- * use the `staticSite` property on the prerender config instead. If only certain
830
- * components should be static then use `staticComponents` instead.
831
- */
832
- staticDocument?: boolean;
833
- }
834
- export interface RobotsTxtOpts {
835
- urls: string[];
836
- sitemapUrl: string;
837
- baseUrl: string;
838
- dir: string;
839
- }
840
- export interface RobotsTxtResults {
841
- content: string;
842
- filePath: string;
843
- url: string;
844
- }
845
- export interface SitemapXmpOpts {
846
- urls: string[];
847
- baseUrl: string;
848
- dir: string;
849
- }
850
- export interface SitemapXmpResults {
851
- content: string;
852
- filePath: string;
853
- url: string;
854
- }
855
- /**
856
- * Common system used by the compiler. All file reads, writes, access, etc. will all use
857
- * this system. Additionally, throughout each build, the compiler will use an internal
858
- * in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
859
- * build all actions the in-memory fs performed will be written to disk using this system.
860
- * A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
861
- * will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
862
- * of the actual platform it's being ran on top of.
863
- */
864
- export interface CompilerSystem {
865
- name: 'node' | 'in-memory';
866
- version: string;
867
- events?: BuildEvents;
868
- details?: SystemDetails;
869
- /**
870
- * Add a callback which will be ran when destroy() is called.
871
- */
872
- addDestroy(cb: () => void): void;
873
- /**
874
- * Always returns a boolean, does not throw.
875
- */
876
- access(p: string): Promise<boolean>;
877
- /**
878
- * SYNC! Always returns a boolean, does not throw.
879
- */
880
- accessSync(p: string): boolean;
881
- applyGlobalPatch?(fromDir: string): Promise<void>;
882
- applyPrerenderGlobalPatch?(opts: {
883
- devServerHostUrl: string;
884
- window: any;
885
- }): void;
886
- cacheStorage?: CacheStorage;
887
- checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
888
- copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
889
- /**
890
- * Always returns a boolean if the files were copied or not. Does not throw.
891
- */
892
- copyFile(src: string, dst: string): Promise<boolean>;
893
- /**
894
- * Used to destroy any listeners, file watchers or child processes.
895
- */
896
- destroy(): Promise<void>;
897
- /**
898
- * Does not throw.
899
- */
900
- createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
901
- /**
902
- * SYNC! Does not throw.
903
- */
904
- createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
905
- homeDir(): string;
906
- /**
907
- * Used to determine if the current context of the terminal is TTY.
908
- */
909
- isTTY(): boolean;
910
- /**
911
- * Each platform as a different way to dynamically import modules.
912
- */
913
- dynamicImport?(p: string): Promise<any>;
914
- /**
915
- * Creates the worker controller for the current system.
916
- */
917
- createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
918
- encodeToBase64(str: string): string;
919
- ensureDependencies?(opts: {
920
- rootDir: string;
921
- logger: Logger;
922
- dependencies: CompilerDependency[];
923
- }): Promise<{
924
- rindoPath: string;
925
- diagnostics: Diagnostic[];
926
- }>;
927
- ensureResources?(opts: {
928
- rootDir: string;
929
- logger: Logger;
930
- dependencies: CompilerDependency[];
931
- }): Promise<void>;
932
- /**
933
- * process.exit()
934
- */
935
- exit(exitCode: number): Promise<void>;
936
- /**
937
- * Optionally provide a fetch() function rather than using the built-in fetch().
938
- * First arg is a url string or Request object (RequestInfo).
939
- * Second arg is the RequestInit. Returns the Response object
940
- */
941
- fetch?(input: string | any, init?: any): Promise<any>;
942
- /**
943
- * Generates a sha1 digest encoded as HEX
944
- */
945
- generateContentHash?(content: string | any, length?: number): Promise<string>;
946
- /**
947
- * Generates a sha1 digest encoded as HEX from a file path
948
- */
949
- generateFileHash?(filePath: string | any, length?: number): Promise<string>;
950
- /**
951
- * Get the current directory.
952
- */
953
- getCurrentDirectory(): string;
954
- /**
955
- * The compiler's executing path.
956
- */
957
- getCompilerExecutingPath(): string;
958
- /**
959
- * The dev server's executing path.
960
- */
961
- getDevServerExecutingPath?(): string;
962
- getEnvironmentVar?(key: string): string;
963
- /**
964
- * Gets the absolute file path when for a dependency module.
965
- */
966
- getLocalModulePath(opts: {
967
- rootDir: string;
968
- moduleId: string;
969
- path: string;
970
- }): string;
971
- /**
972
- * Gets the full url when requesting a dependency module to fetch from a CDN.
973
- */
974
- getRemoteModuleUrl(opts: {
975
- moduleId: string;
976
- path?: string;
977
- version?: string;
978
- }): string;
979
- /**
980
- * Aync glob task. Only available in NodeJS compiler system.
981
- */
982
- glob?(pattern: string, options: {
983
- cwd?: string;
984
- nodir?: boolean;
985
- [key: string]: any;
986
- }): Promise<string[]>;
987
- /**
988
- * The number of logical processors available to run threads on the user's computer (cpus).
989
- */
990
- hardwareConcurrency: number;
991
- /**
992
- * Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
993
- */
994
- isSymbolicLink(p: string): Promise<boolean>;
995
- lazyRequire?: LazyRequire;
996
- nextTick(cb: () => void): void;
997
- /**
998
- * Normalize file system path.
999
- */
1000
- normalizePath(p: string): string;
1001
- onProcessInterrupt?(cb: () => void): void;
1002
- parseYarnLockFile?: (content: string) => {
1003
- type: 'success' | 'merge' | 'conflict';
1004
- object: any;
1005
- };
1006
- platformPath: PlatformPath;
1007
- /**
1008
- * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
1009
- */
1010
- readDir(p: string): Promise<string[]>;
1011
- /**
1012
- * SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
1013
- */
1014
- readDirSync(p: string): string[];
1015
- /**
1016
- * Returns undefined if file is not found. Does not throw.
1017
- */
1018
- readFile(p: string): Promise<string>;
1019
- readFile(p: string, encoding: 'utf8'): Promise<string>;
1020
- readFile(p: string, encoding: 'binary'): Promise<any>;
1021
- /**
1022
- * SYNC! Returns undefined if file is not found. Does not throw.
1023
- */
1024
- readFileSync(p: string, encoding?: string): string;
1025
- /**
1026
- * Does not throw.
1027
- */
1028
- realpath(p: string): Promise<CompilerSystemRealpathResults>;
1029
- /**
1030
- * SYNC! Does not throw.
1031
- */
1032
- realpathSync(p: string): CompilerSystemRealpathResults;
1033
- /**
1034
- * Remove a callback which will be ran when destroy() is called.
1035
- */
1036
- removeDestroy(cb: () => void): void;
1037
- /**
1038
- * Rename old path to new path. Does not throw.
1039
- */
1040
- rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
1041
- resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
1042
- resolvePath(p: string): string;
1043
- /**
1044
- * Does not throw.
1045
- */
1046
- removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
1047
- /**
1048
- * SYNC! Does not throw.
1049
- */
1050
- removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
1051
- /**
1052
- * Does not throw.
1053
- */
1054
- removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
1055
- /**
1056
- * SYNC! Does not throw.
1057
- */
1058
- removeFileSync(p: string): CompilerSystemRemoveFileResults;
1059
- setupCompiler?: (c: {
1060
- ts: any;
1061
- }) => void;
1062
- /**
1063
- * Always returns an object. Does not throw. Check for "error" property if there's an error.
1064
- */
1065
- stat(p: string): Promise<CompilerFsStats>;
1066
- /**
1067
- * SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
1068
- */
1069
- statSync(p: string): CompilerFsStats;
1070
- tmpDirSync(): string;
1071
- watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
1072
- watchFile?(p: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
1073
- /**
1074
- * How many milliseconds to wait after a change before calling watch callbacks.
1075
- */
1076
- watchTimeout?: number;
1077
- /**
1078
- * Does not throw.
1079
- */
1080
- writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
1081
- /**
1082
- * SYNC! Does not throw.
1083
- */
1084
- writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
1085
- }
1086
- export interface TranspileOnlyResults {
1087
- diagnostics: Diagnostic[];
1088
- output: string;
1089
- sourceMap: any;
1090
- }
1091
- export interface ParsedPath {
1092
- root: string;
1093
- dir: string;
1094
- base: string;
1095
- ext: string;
1096
- name: string;
1097
- }
1098
- export interface PlatformPath {
1099
- normalize(p: string): string;
1100
- join(...paths: string[]): string;
1101
- resolve(...pathSegments: string[]): string;
1102
- isAbsolute(p: string): boolean;
1103
- relative(from: string, to: string): string;
1104
- dirname(p: string): string;
1105
- basename(p: string, ext?: string): string;
1106
- extname(p: string): string;
1107
- parse(p: string): ParsedPath;
1108
- sep: string;
1109
- delimiter: string;
1110
- posix: any;
1111
- win32: any;
1112
- }
1113
- export interface CompilerDependency {
1114
- name: string;
1115
- version: string;
1116
- main: string;
1117
- resources?: string[];
1118
- }
1119
- export interface ResolveModuleIdOptions {
1120
- moduleId: string;
1121
- containingFile?: string;
1122
- exts?: string[];
1123
- packageFilter?: (pkg: any) => void;
1124
- }
1125
- export interface ResolveModuleIdResults {
1126
- moduleId: string;
1127
- resolveId: string;
1128
- pkgData: {
1129
- name: string;
1130
- version: string;
1131
- [key: string]: any;
1132
- };
1133
- pkgDirPath: string;
1134
- }
1135
- export interface WorkerMainController {
1136
- send(...args: any[]): Promise<any>;
1137
- handler(name: string): (...args: any[]) => Promise<any>;
1138
- destroy(): void;
1139
- maxWorkers: number;
1140
- }
1141
- export interface CopyResults {
1142
- diagnostics: Diagnostic[];
1143
- filePaths: string[];
1144
- dirPaths: string[];
1145
- }
1146
- export interface SystemDetails {
1147
- cpuModel: string;
1148
- freemem(): number;
1149
- platform: 'darwin' | 'windows' | 'linux' | '';
1150
- release: string;
1151
- totalmem: number;
1152
- }
1153
- export interface BuildOnEvents {
1154
- on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
1155
- on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
1156
- on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
1157
- on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
1158
- on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
1159
- on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
1160
- on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
1161
- on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
1162
- on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
1163
- on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
1164
- }
1165
- export interface BuildEmitEvents {
1166
- emit(eventName: CompilerEventName, path: string): void;
1167
- emit(eventName: CompilerEventFileAdd, path: string): void;
1168
- emit(eventName: CompilerEventFileDelete, path: string): void;
1169
- emit(eventName: CompilerEventFileUpdate, path: string): void;
1170
- emit(eventName: CompilerEventDirAdd, path: string): void;
1171
- emit(eventName: CompilerEventDirDelete, path: string): void;
1172
- emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
1173
- emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
1174
- emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
1175
- emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
1176
- emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
1177
- }
1178
- export interface FsWatchResults {
1179
- dirsAdded: string[];
1180
- dirsDeleted: string[];
1181
- filesUpdated: string[];
1182
- filesAdded: string[];
1183
- filesDeleted: string[];
1184
- }
1185
- export interface BuildLog {
1186
- buildId: number;
1187
- messages: string[];
1188
- progress: number;
1189
- }
1190
- export interface BuildNoChangeResults {
1191
- buildId: number;
1192
- noChange: boolean;
1193
- }
1194
- export interface CompilerBuildResults {
1195
- buildId: number;
1196
- componentGraph?: BuildResultsComponentGraph;
1197
- diagnostics: Diagnostic[];
1198
- dirsAdded: string[];
1199
- dirsDeleted: string[];
1200
- duration: number;
1201
- filesAdded: string[];
1202
- filesChanged: string[];
1203
- filesDeleted: string[];
1204
- filesUpdated: string[];
1205
- hasError: boolean;
1206
- hasSuccessfulBuild: boolean;
1207
- hmr?: HotModuleReplacement;
1208
- hydrateAppFilePath?: string;
1209
- isRebuild: boolean;
1210
- namespace: string;
1211
- outputs: BuildOutput[];
1212
- rootDir: string;
1213
- srcDir: string;
1214
- timestamp: string;
1215
- }
1216
- export interface BuildResultsComponentGraph {
1217
- [scopeId: string]: string[];
1218
- }
1219
- export interface BuildOutput {
1220
- type: string;
1221
- files: string[];
1222
- }
1223
- export interface HotModuleReplacement {
1224
- componentsUpdated?: string[];
1225
- excludeHmr?: string[];
1226
- externalStylesUpdated?: string[];
1227
- imagesUpdated?: string[];
1228
- indexHtmlUpdated?: boolean;
1229
- inlineStylesUpdated?: HmrStyleUpdate[];
1230
- reloadStrategy: PageReloadStrategy;
1231
- scriptsAdded?: string[];
1232
- scriptsDeleted?: string[];
1233
- serviceWorkerUpdated?: boolean;
1234
- versionId?: string;
1235
- }
1236
- export interface HmrStyleUpdate {
1237
- styleId: string;
1238
- styleTag: string;
1239
- styleText: string;
1240
- }
1241
- export type BuildOnEventRemove = () => boolean;
1242
- export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
1243
- unsubscribeAll(): void;
1244
- }
1245
- export interface CompilerBuildStart {
1246
- buildId: number;
1247
- timestamp: string;
1248
- }
1249
- export type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
1250
- export type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
1251
- export type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
1252
- export type CompilerEventFsChange = 'fsChange';
1253
- export type CompilerEventFileUpdate = 'fileUpdate';
1254
- export type CompilerEventFileAdd = 'fileAdd';
1255
- export type CompilerEventFileDelete = 'fileDelete';
1256
- export type CompilerEventDirAdd = 'dirAdd';
1257
- export type CompilerEventDirDelete = 'dirDelete';
1258
- export type CompilerEventBuildStart = 'buildStart';
1259
- export type CompilerEventBuildFinish = 'buildFinish';
1260
- export type CompilerEventBuildLog = 'buildLog';
1261
- export type CompilerEventBuildNoChange = 'buildNoChange';
1262
- export interface CompilerFileWatcher {
1263
- close(): void | Promise<void>;
1264
- }
1265
- export interface CompilerFsStats {
1266
- /**
1267
- * If it's a directory. `false` if there was an error.
1268
- */
1269
- isDirectory: boolean;
1270
- /**
1271
- * If it's a file. `false` if there was an error.
1272
- */
1273
- isFile: boolean;
1274
- /**
1275
- * If it's a symlink. `false` if there was an error.
1276
- */
1277
- isSymbolicLink: boolean;
1278
- /**
1279
- * The size of the file in bytes. `0` for directories or if there was an error.
1280
- */
1281
- size: number;
1282
- /**
1283
- * The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
1284
- */
1285
- mtimeMs?: number;
1286
- /**
1287
- * Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
1288
- */
1289
- error: any;
1290
- }
1291
- export interface CompilerSystemCreateDirectoryOptions {
1292
- /**
1293
- * Indicates whether parent directories should be created.
1294
- * @default false
1295
- */
1296
- recursive?: boolean;
1297
- /**
1298
- * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
1299
- * @default 0o777.
1300
- */
1301
- mode?: number;
1302
- }
1303
- export interface CompilerSystemCreateDirectoryResults {
1304
- basename: string;
1305
- dirname: string;
1306
- path: string;
1307
- newDirs: string[];
1308
- error: any;
1309
- }
1310
- export interface CompilerSystemRemoveDirectoryOptions {
1311
- /**
1312
- * Indicates whether child files and subdirectories should be removed.
1313
- * @default false
1314
- */
1315
- recursive?: boolean;
1316
- }
1317
- export interface CompilerSystemRemoveDirectoryResults {
1318
- basename: string;
1319
- dirname: string;
1320
- path: string;
1321
- removedDirs: string[];
1322
- removedFiles: string[];
1323
- error: any;
1324
- }
1325
- export interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
1326
- renamed: CompilerSystemRenamedPath[];
1327
- oldDirs: string[];
1328
- oldFiles: string[];
1329
- newDirs: string[];
1330
- newFiles: string[];
1331
- error: any;
1332
- }
1333
- export interface CompilerSystemRenamedPath {
1334
- oldPath: string;
1335
- newPath: string;
1336
- isFile: boolean;
1337
- isDirectory: boolean;
1338
- }
1339
- export interface CompilerSystemRealpathResults {
1340
- path: string;
1341
- error: any;
1342
- }
1343
- export interface CompilerSystemRemoveFileResults {
1344
- basename: string;
1345
- dirname: string;
1346
- path: string;
1347
- error: any;
1348
- }
1349
- export interface CompilerSystemWriteFileResults {
1350
- path: string;
1351
- error: any;
1352
- }
1353
- export interface Credentials {
1354
- key: string;
1355
- cert: string;
1356
- }
1357
- export interface ConfigBundle {
1358
- components: string[];
1359
- }
1360
- export interface CopyTask {
1361
- src: string;
1362
- dest?: string;
1363
- warn?: boolean;
1364
- keepDirStructure?: boolean;
1365
- }
1366
- export interface BundlingConfig {
1367
- namedExports?: {
1368
- [key: string]: string[];
1369
- };
1370
- }
1371
- export interface NodeResolveConfig {
1372
- module?: boolean;
1373
- jsnext?: boolean;
1374
- main?: boolean;
1375
- browser?: boolean;
1376
- extensions?: string[];
1377
- preferBuiltins?: boolean;
1378
- jail?: string;
1379
- only?: Array<string | RegExp>;
1380
- modulesOnly?: boolean;
1381
- /**
1382
- * @see https://github.com/browserify/resolve#resolveid-opts-cb
1383
- */
1384
- customResolveOptions?: {
1385
- basedir?: string;
1386
- package?: string;
1387
- extensions?: string[];
1388
- readFile?: Function;
1389
- isFile?: Function;
1390
- isDirectory?: Function;
1391
- packageFilter?: Function;
1392
- pathFilter?: Function;
1393
- paths?: Function | string[];
1394
- moduleDirectory?: string | string[];
1395
- preserveSymlinks?: boolean;
1396
- };
1397
- }
1398
- export interface RollupConfig {
1399
- inputOptions?: RollupInputOptions;
1400
- outputOptions?: RollupOutputOptions;
1401
- }
1402
- export interface RollupInputOptions {
1403
- context?: string;
1404
- moduleContext?: ((id: string) => string) | {
1405
- [id: string]: string;
1406
- };
1407
- treeshake?: boolean;
1408
- }
1409
- export interface RollupOutputOptions {
1410
- globals?: {
1411
- [name: string]: string;
1412
- } | ((name: string) => string);
1413
- }
1414
- export interface Testing {
1415
- run(opts: TestingRunOptions): Promise<boolean>;
1416
- destroy(): Promise<void>;
1417
- }
1418
- export interface TestingRunOptions {
1419
- e2e?: boolean;
1420
- screenshot?: boolean;
1421
- spec?: boolean;
1422
- updateScreenshot?: boolean;
1423
- }
1424
- export interface JestConfig {
1425
- /**
1426
- * This option tells Jest that all imported modules in your tests should be mocked automatically.
1427
- * All modules used in your tests will have a replacement implementation, keeping the API surface. Default: false
1428
- */
1429
- automock?: boolean;
1430
- /**
1431
- * By default, Jest runs all tests and produces all errors into the console upon completion.
1432
- * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
1433
- */
1434
- bail?: boolean;
1435
- /**
1436
- * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
1437
- * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
1438
- * customize where Jest stores that cache data on disk. Default: "/tmp/<path>"
1439
- */
1440
- cacheDirectory?: string;
1441
- /**
1442
- * Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks()
1443
- * between each test. This does not remove any mock implementation that may have been provided. Default: false
1444
- */
1445
- clearMocks?: boolean;
1446
- /**
1447
- * Indicates whether the coverage information should be collected while executing the test. Because this retrofits all
1448
- * executed files with coverage collection statements, it may significantly slow down your tests. Default: false
1449
- */
1450
- collectCoverage?: boolean;
1451
- /**
1452
- * An array of glob patterns indicating a set of files for which coverage information should be collected.
1453
- * If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist
1454
- * for this file and it's never required in the test suite. Default: undefined
1455
- */
1456
- collectCoverageFrom?: any[];
1457
- /**
1458
- * The directory where Jest should output its coverage files. Default: undefined
1459
- */
1460
- coverageDirectory?: string;
1461
- /**
1462
- * An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches
1463
- * any of the patterns, coverage information will be skipped. These pattern strings match against the full path.
1464
- * Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally
1465
- * ignoring all of your files in different environments that may have different root directories.
1466
- * Example: ["<rootDir>/build/", "<rootDir>/node_modules/"]. Default: ["/node_modules/"]
1467
- */
1468
- coveragePathIgnorePatterns?: any[];
1469
- /**
1470
- * A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.
1471
- * Default: ["json", "lcov", "text"]
1472
- */
1473
- coverageReporters?: any[];
1474
- /**
1475
- * This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global,
1476
- * as a glob, and as a directory or file path. If thresholds aren't met, jest will fail. Thresholds specified as a positive
1477
- * number are taken to be the minimum percentage required. Thresholds specified as a negative number represent the maximum
1478
- * number of uncovered entities allowed. Default: undefined
1479
- */
1480
- coverageThreshold?: any;
1481
- errorOnDeprecated?: boolean;
1482
- forceCoverageMatch?: any[];
1483
- globals?: any;
1484
- globalSetup?: string;
1485
- globalTeardown?: string;
1486
- /**
1487
- * An array of directory names to be searched recursively up from the requiring module's location. Setting this option will
1488
- * override the default, if you wish to still search node_modules for packages include it along with any other
1489
- * options: ["node_modules", "bower_components"]. Default: ["node_modules"]
1490
- */
1491
- moduleDirectories?: string[];
1492
- /**
1493
- * An array of file extensions your modules use. If you require modules without specifying a file extension,
1494
- * these are the extensions Jest will look for. Default: ['ts', 'tsx', 'js', 'json']
1495
- */
1496
- moduleFileExtensions?: string[];
1497
- moduleNameMapper?: any;
1498
- modulePaths?: any[];
1499
- modulePathIgnorePatterns?: any[];
1500
- notify?: boolean;
1501
- notifyMode?: string;
1502
- preset?: string;
1503
- prettierPath?: string;
1504
- projects?: any;
1505
- reporters?: any;
1506
- resetMocks?: boolean;
1507
- resetModules?: boolean;
1508
- resolver?: string;
1509
- restoreMocks?: string;
1510
- rootDir?: string;
1511
- roots?: any[];
1512
- runner?: string;
1513
- /**
1514
- * The paths to modules that run some code to configure or set up the testing environment before each test.
1515
- * Since every test runs in its own environment, these scripts will be executed in the testing environment
1516
- * immediately before executing the test code itself. Default: []
1517
- */
1518
- setupFiles?: string[];
1519
- setupFilesAfterEnv?: string[];
1520
- snapshotSerializers?: any[];
1521
- testEnvironment?: string;
1522
- testEnvironmentOptions?: any;
1523
- testMatch?: string[];
1524
- testPathIgnorePatterns?: string[];
1525
- testPreset?: string;
1526
- testRegex?: string;
1527
- testResultsProcessor?: string;
1528
- testRunner?: string;
1529
- testURL?: string;
1530
- timers?: string;
1531
- transform?: {
1532
- [key: string]: string;
1533
- };
1534
- transformIgnorePatterns?: any[];
1535
- unmockedModulePathPatterns?: any[];
1536
- verbose?: boolean;
1537
- watchPathIgnorePatterns?: any[];
1538
- }
1539
- export interface TestingConfig extends JestConfig {
1540
- /**
1541
- * The `allowableMismatchedPixels` value is used to determine an acceptable
1542
- * number of pixels that can be mismatched before the image is considered
1543
- * to have changes. Realistically, two screenshots representing the same
1544
- * content may have a small number of pixels that are not identical due to
1545
- * anti-aliasing, which is perfectly normal. If the `allowableMismatchedRatio`
1546
- * is provided it will take precedence, otherwise `allowableMismatchedPixels`
1547
- * will be used.
1548
- */
1549
- allowableMismatchedPixels?: number;
1550
- /**
1551
- * The `allowableMismatchedRatio` ranges from `0` to `1` and is used to
1552
- * determine an acceptable ratio of pixels that can be mismatched before
1553
- * the image is considered to have changes. Realistically, two screenshots
1554
- * representing the same content may have a small number of pixels that
1555
- * are not identical due to anti-aliasing, which is perfectly normal. The
1556
- * `allowableMismatchedRatio` is the number of pixels that were mismatched,
1557
- * divided by the total number of pixels in the screenshot. For example,
1558
- * a ratio value of `0.06` means 6% of the pixels can be mismatched before
1559
- * the image is considered to have changes. If the `allowableMismatchedRatio`
1560
- * is provided it will take precedence, otherwise `allowableMismatchedPixels`
1561
- * will be used.
1562
- */
1563
- allowableMismatchedRatio?: number;
1564
- /**
1565
- * Matching threshold while comparing two screenshots. Value ranges from `0` to `1`.
1566
- * Smaller values make the comparison more sensitive. The `pixelmatchThreshold`
1567
- * value helps to ignore anti-aliasing. Default: `0.1`
1568
- */
1569
- pixelmatchThreshold?: number;
1570
- /**
1571
- * Additional arguments to pass to the browser instance.
1572
- */
1573
- browserArgs?: string[];
1574
- /**
1575
- * Path to a Chromium or Chrome executable to run instead of the bundled Chromium.
1576
- */
1577
- browserExecutablePath?: string;
1578
- /**
1579
- * Url of remote Chrome instance to use instead of local Chrome.
1580
- */
1581
- browserWSEndpoint?: string;
1582
- /**
1583
- * Whether to run browser e2e tests in headless mode. Defaults to true.
1584
- */
1585
- browserHeadless?: boolean;
1586
- /**
1587
- * Slows down e2e browser operations by the specified amount of milliseconds.
1588
- * Useful so that you can see what is going on.
1589
- */
1590
- browserSlowMo?: number;
1591
- /**
1592
- * By default, all E2E pages wait until the "load" event, this global setting can be used
1593
- * to change the default `waitUntil` behavior.
1594
- */
1595
- browserWaitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
1596
- /**
1597
- * Whether to auto-open a DevTools panel for each tab.
1598
- * If this option is true, the headless option will be set false
1599
- */
1600
- browserDevtools?: boolean;
1601
- /**
1602
- * Array of browser emulations to be using during e2e tests. A full e2e
1603
- * test is ran for each emulation.
1604
- */
1605
- emulate?: EmulateConfig[];
1606
- /**
1607
- * Path to the Screenshot Connector module.
1608
- */
1609
- screenshotConnector?: string;
1610
- /**
1611
- * Amount of time in milliseconds to wait before a screenshot is taken.
1612
- */
1613
- waitBeforeScreenshot?: number;
1614
- }
1615
- export interface EmulateConfig {
1616
- /**
1617
- * Predefined device descriptor name, such as "iPhone X" or "Nexus 10".
1618
- * For a complete list please see: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
1619
- */
1620
- device?: string;
1621
- /**
1622
- * User-Agent to be used. Defaults to the user-agent of the installed Puppeteer version.
1623
- */
1624
- userAgent?: string;
1625
- viewport?: EmulateViewport;
1626
- }
1627
- export interface EmulateViewport {
1628
- /**
1629
- * Page width in pixels.
1630
- */
1631
- width: number;
1632
- /**
1633
- * page height in pixels.
1634
- */
1635
- height: number;
1636
- /**
1637
- * Specify device scale factor (can be thought of as dpr). Defaults to 1.
1638
- */
1639
- deviceScaleFactor?: number;
1640
- /**
1641
- * Whether the meta viewport tag is taken into account. Defaults to false.
1642
- */
1643
- isMobile?: boolean;
1644
- /**
1645
- * Specifies if viewport supports touch events. Defaults to false
1646
- */
1647
- hasTouch?: boolean;
1648
- /**
1649
- * Specifies if viewport is in landscape mode. Defaults to false.
1650
- */
1651
- isLandscape?: boolean;
1652
- }
1653
- /**
1654
- * This sets the log level hierarchy for our terminal logger, ranging from
1655
- * most to least verbose.
1656
- *
1657
- * Ordering the levels like this lets us easily check whether we should log a
1658
- * message at a given time. For instance, if the log level is set to `'warn'`,
1659
- * then anything passed to the logger with level `'warn'` or `'error'` should
1660
- * be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
1661
- *
1662
- * If we have a current log level `currentLevel` and a message with level
1663
- * `msgLevel` is passed to the logger, we can determine whether or not we should
1664
- * log it by checking if the log level on the message is further up or at the
1665
- * same level in the hierarchy than `currentLevel`, like so:
1666
- *
1667
- * ```ts
1668
- * LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
1669
- * ```
1670
- *
1671
- * NOTE: for the reasons described above, do not change the order of the entries
1672
- * in this array without good reason!
1673
- */
1674
- export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
1675
- export type LogLevel = (typeof LOG_LEVELS)[number];
1676
- /**
1677
- * Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
1678
- * NodeJS based console logging and colors, and the web will use browser based
1679
- * logs and colors.
1680
- */
1681
- export interface Logger {
1682
- enableColors: (useColors: boolean) => void;
1683
- setLevel: (level: LogLevel) => void;
1684
- getLevel: () => LogLevel;
1685
- debug: (...msg: any[]) => void;
1686
- info: (...msg: any[]) => void;
1687
- warn: (...msg: any[]) => void;
1688
- error: (...msg: any[]) => void;
1689
- createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
1690
- printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
1691
- red: (msg: string) => string;
1692
- green: (msg: string) => string;
1693
- yellow: (msg: string) => string;
1694
- blue: (msg: string) => string;
1695
- magenta: (msg: string) => string;
1696
- cyan: (msg: string) => string;
1697
- gray: (msg: string) => string;
1698
- bold: (msg: string) => string;
1699
- dim: (msg: string) => string;
1700
- bgRed: (msg: string) => string;
1701
- emoji: (e: string) => string;
1702
- setLogFilePath?: (p: string) => void;
1703
- writeLogs?: (append: boolean) => void;
1704
- createLineUpdater?: () => Promise<LoggerLineUpdater>;
1705
- }
1706
- export interface LoggerLineUpdater {
1707
- update(text: string): Promise<void>;
1708
- stop(): Promise<void>;
1709
- }
1710
- export interface LoggerTimeSpan {
1711
- duration(): number;
1712
- finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
1713
- }
1714
- export interface OutputTargetDist extends OutputTargetBase {
1715
- type: 'dist';
1716
- buildDir?: string;
1717
- dir?: string;
1718
- collectionDir?: string | null;
1719
- /**
1720
- * When `true` this flag will transform aliased import paths defined in
1721
- * a project's `tsconfig.json` to relative import paths in the compiled output's
1722
- * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
1723
- *
1724
- * Paths will be left in aliased format if `false` or `undefined`.
1725
- *
1726
- * @example
1727
- * // tsconfig.json
1728
- * {
1729
- * paths: {
1730
- * "@utils/*": ['/src/utils/*']
1731
- * }
1732
- * }
1733
- *
1734
- * // Source file
1735
- * import * as dateUtils from '@utils/date-utils';
1736
- * // Output file
1737
- * import * as dateUtils from '../utils/date-utils';
1738
- */
1739
- transformAliasedImportPathsInCollection?: boolean | null;
1740
- typesDir?: string;
1741
- esmLoaderPath?: string;
1742
- copy?: CopyTask[];
1743
- polyfills?: boolean;
1744
- empty?: boolean;
1745
- }
1746
- export interface OutputTargetDistCollection extends OutputTargetBase {
1747
- type: 'dist-collection';
1748
- empty?: boolean;
1749
- dir: string;
1750
- collectionDir: string;
1751
- /**
1752
- * When `true` this flag will transform aliased import paths defined in
1753
- * a project's `tsconfig.json` to relative import paths in the compiled output.
1754
- *
1755
- * Paths will be left in aliased format if `false` or `undefined`.
1756
- *
1757
- * @example
1758
- * // tsconfig.json
1759
- * {
1760
- * paths: {
1761
- * "@utils/*": ['/src/utils/*']
1762
- * }
1763
- * }
1764
- *
1765
- * // Source file
1766
- * import * as dateUtils from '@utils/date-utils';
1767
- * // Output file
1768
- * import * as dateUtils from '../utils/date-utils';
1769
- */
1770
- transformAliasedImportPaths?: boolean | null;
1771
- }
1772
- export interface OutputTargetDistTypes extends OutputTargetBase {
1773
- type: 'dist-types';
1774
- dir: string;
1775
- typesDir: string;
1776
- }
1777
- export interface OutputTargetDistLazy extends OutputTargetBase {
1778
- type: 'dist-lazy';
1779
- dir?: string;
1780
- esmDir?: string;
1781
- esmEs5Dir?: string;
1782
- systemDir?: string;
1783
- cjsDir?: string;
1784
- polyfills?: boolean;
1785
- isBrowserBuild?: boolean;
1786
- esmIndexFile?: string;
1787
- cjsIndexFile?: string;
1788
- systemLoaderFile?: string;
1789
- legacyLoaderFile?: string;
1790
- empty?: boolean;
1791
- }
1792
- export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
1793
- type: 'dist-global-styles';
1794
- file: string;
1795
- }
1796
- export interface OutputTargetDistLazyLoader extends OutputTargetBase {
1797
- type: 'dist-lazy-loader';
1798
- dir: string;
1799
- esmDir: string;
1800
- esmEs5Dir?: string;
1801
- cjsDir: string;
1802
- componentDts: string;
1803
- empty: boolean;
1804
- }
1805
- export interface OutputTargetHydrate extends OutputTargetBase {
1806
- type: 'dist-hydrate-script';
1807
- dir?: string;
1808
- /**
1809
- * Module IDs that should not be bundled into the script.
1810
- * By default, all node builtin's, such as `fs` or `path`
1811
- * will be considered "external" and not bundled.
1812
- */
1813
- external?: string[];
1814
- empty?: boolean;
1815
- }
1816
- export interface OutputTargetCustom extends OutputTargetBase {
1817
- type: 'custom';
1818
- name: string;
1819
- validate?: (config: Config, diagnostics: Diagnostic[]) => void;
1820
- generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1821
- copy?: CopyTask[];
1822
- }
1823
- /**
1824
- * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
1825
- * file.
1826
- */
1827
- export interface OutputTargetDocsVscode extends OutputTargetBase {
1828
- /**
1829
- * Designates this output target to be used for generating VS Code custom data.
1830
- * @see OutputTargetBase#type
1831
- */
1832
- type: 'docs-vscode';
1833
- /**
1834
- * The location on disk to write the JSON file.
1835
- */
1836
- file: string;
1837
- /**
1838
- * A base URL to find the source code of the component(s) described in the JSON file.
1839
- */
1840
- sourceCodeBaseUrl?: string;
1841
- }
1842
- export interface OutputTargetDocsReadme extends OutputTargetBase {
1843
- type: 'docs-readme';
1844
- dir?: string;
1845
- dependencies?: boolean;
1846
- footer?: string;
1847
- strict?: boolean;
1848
- }
1849
- export interface OutputTargetDocsJson extends OutputTargetBase {
1850
- type: 'docs-json';
1851
- file: string;
1852
- typesFile?: string | null;
1853
- strict?: boolean;
1854
- }
1855
- export interface OutputTargetDocsCustom extends OutputTargetBase {
1856
- type: 'docs-custom';
1857
- generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
1858
- strict?: boolean;
1859
- }
1860
- export interface OutputTargetStats extends OutputTargetBase {
1861
- type: 'stats';
1862
- file?: string;
1863
- }
1864
- export interface OutputTargetBaseNext {
1865
- type: string;
1866
- dir?: string;
1867
- }
1868
- /**
1869
- * The collection of valid export behaviors.
1870
- * Used to generate a type for typed configs as well as output target validation
1871
- * for the `dist-custom-elements` output target.
1872
- *
1873
- * Adding a value to this const array will automatically add it as a valid option on the
1874
- * output target configuration for `customElementsExportBehavior`.
1875
- *
1876
- * - `default`: No additional export or definition behavior will happen.
1877
- * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
1878
- * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
1879
- * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
1880
- * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
1881
- * from `dist-custom-elements-bundle` to `dist-custom-elements`.
1882
- * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
1883
- */
1884
- export declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
1885
- /**
1886
- * This type is auto-generated based on the values in `CustomElementsExportBehaviorOptions` array.
1887
- * This is used on the output target config for intellisense in typed configs.
1888
- */
1889
- export type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
1890
- export interface OutputTargetDistCustomElements extends OutputTargetBaseNext {
1891
- type: 'dist-custom-elements';
1892
- empty?: boolean;
1893
- /**
1894
- * Triggers the following behaviors when enabled:
1895
- * 1. All `@rindo/core/*` module references are treated as external during bundling.
1896
- * 2. File names are not hashed.
1897
- * 3. File minification will follow the behavior defined at the root of the Rindo config.
1898
- */
1899
- externalRuntime?: boolean;
1900
- copy?: CopyTask[];
1901
- includeGlobalScripts?: boolean;
1902
- minify?: boolean;
1903
- /**
1904
- * Enables the generation of type definition files for the output target.
1905
- */
1906
- generateTypeDeclarations?: boolean;
1907
- /**
1908
- * Define the export/definition behavior for the output target's generated output.
1909
- * This controls if/how custom elements will be defined or where components will be exported from.
1910
- * If omitted, no auto-definition behavior or re-exporting will happen.
1911
- */
1912
- customElementsExportBehavior?: CustomElementsExportBehavior;
1913
- }
1914
- export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNext {
1915
- type: 'dist-custom-elements-bundle';
1916
- empty?: boolean;
1917
- externalRuntime?: boolean;
1918
- copy?: CopyTask[];
1919
- includeGlobalScripts?: boolean;
1920
- minify?: boolean;
1921
- }
1922
- /**
1923
- * The base type for output targets. All output targets should extend this base type.
1924
- */
1925
- export interface OutputTargetBase {
1926
- /**
1927
- * A unique string to differentiate one output target from another
1928
- */
1929
- type: string;
1930
- }
1931
- export type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
1932
- export interface OutputTargetCopy extends OutputTargetBase {
1933
- type: 'copy';
1934
- dir: string;
1935
- copy?: CopyTask[];
1936
- copyAssets?: 'collection' | 'dist';
1937
- }
1938
- export interface OutputTargetWww extends OutputTargetBase {
1939
- /**
1940
- * Webapp output target.
1941
- */
1942
- type: 'www';
1943
- /**
1944
- * The directory to write the app's JavaScript and CSS build
1945
- * files to. The default is to place this directory as a child
1946
- * to the `dir` config. Default: `build`
1947
- */
1948
- buildDir?: string;
1949
- /**
1950
- * The directory to write the entire application to.
1951
- * Note, the `buildDir` is where the app's JavaScript and CSS build
1952
- * files are written. Default: `www`
1953
- */
1954
- dir?: string;
1955
- /**
1956
- * Empty the build directory of all files and directories on first build.
1957
- * Default: `true`
1958
- */
1959
- empty?: boolean;
1960
- /**
1961
- * The default index html file of the app, commonly found at the
1962
- * root of the `src` directory.
1963
- * Default: `index.html`
1964
- */
1965
- indexHtml?: string;
1966
- /**
1967
- * The copy config is an array of objects that defines any files or folders that should
1968
- * be copied over to the build directory.
1969
- *
1970
- * Each object in the array must include a src property which can be either an absolute path,
1971
- * a relative path or a glob pattern. The config can also provide an optional dest property
1972
- * which can be either an absolute path or a path relative to the build directory.
1973
- * Also note that any files within src/assets are automatically copied to www/assets for convenience.
1974
- *
1975
- * In the copy config below, it will copy the entire directory from src/docs-content over to www/docs-content.
1976
- */
1977
- copy?: CopyTask[];
1978
- /**
1979
- * The base url of the app, it's required during prerendering to be the absolute path
1980
- * of your app, such as: `https://my.app.com/app`.
1981
- *
1982
- * Default: `/`
1983
- */
1984
- baseUrl?: string;
1985
- /**
1986
- * By default, rindo will include all the polyfills required by legacy browsers in the ES5 build.
1987
- * If it's `false`, rindo will not emit this polyfills anymore and it's your responsibility to provide them before
1988
- * rindo initializes.
1989
- */
1990
- polyfills?: boolean;
1991
- /**
1992
- * Path to an external node module which has exports of the prerender config object.
1993
- * ```
1994
- * module.exports = {
1995
- * afterHydrate(document, url) {
1996
- * document.title = `URL: ${url.href}`;
1997
- * }
1998
- * }
1999
- * ```
2000
- */
2001
- prerenderConfig?: string;
2002
- /**
2003
- * Service worker config for production builds. During development builds
2004
- * service worker script will be injected to automatically unregister existing
2005
- * service workers. When set to `false` neither a service worker registration
2006
- * or unregistration will be added to the index.html.
2007
- */
2008
- serviceWorker?: ServiceWorkerConfig | null | false;
2009
- appDir?: string;
2010
- }
2011
- export type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistCustomElementsBundle | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
2012
- export interface ServiceWorkerConfig {
2013
- unregister?: boolean;
2014
- swDest?: string;
2015
- swSrc?: string;
2016
- globPatterns?: string[];
2017
- globDirectory?: string | string[];
2018
- globIgnores?: string | string[];
2019
- templatedUrls?: any;
2020
- maximumFileSizeToCacheInBytes?: number;
2021
- manifestTransforms?: any;
2022
- modifyUrlPrefix?: any;
2023
- dontCacheBustURLsMatching?: RegExp;
2024
- navigateFallback?: string;
2025
- navigateFallbackWhitelist?: RegExp[];
2026
- navigateFallbackBlacklist?: RegExp[];
2027
- cacheId?: string;
2028
- skipWaiting?: boolean;
2029
- clientsClaim?: boolean;
2030
- directoryIndex?: string;
2031
- runtimeCaching?: any[];
2032
- ignoreUrlParametersMatching?: any[];
2033
- handleFetch?: boolean;
2034
- }
2035
- export interface LoadConfigInit {
2036
- /**
2037
- * User config object to merge into default config and
2038
- * config loaded from a file path.
2039
- */
2040
- config?: UnvalidatedConfig;
2041
- /**
2042
- * Absolute path to a Rindo config file. This path cannot be
2043
- * relative and it does not resolve config files within a directory.
2044
- */
2045
- configPath?: string;
2046
- logger?: Logger;
2047
- sys?: CompilerSystem;
2048
- /**
2049
- * When set to true, if the "tsconfig.json" file is not found
2050
- * it'll automatically generate and save a default tsconfig
2051
- * within the root directory.
2052
- */
2053
- initTsConfig?: boolean;
2054
- }
2055
- /**
2056
- * Results from an attempt to load a config. The values on this interface
2057
- * have not yet been validated and are not ready to be used for arbitrary
2058
- * operations around the codebase.
2059
- */
2060
- export interface LoadConfigResults {
2061
- config: ValidatedConfig;
2062
- diagnostics: Diagnostic[];
2063
- tsconfig: {
2064
- path: string;
2065
- compilerOptions: any;
2066
- files: string[];
2067
- include: string[];
2068
- exclude: string[];
2069
- extends: string;
2070
- };
2071
- }
2072
- export interface Diagnostic {
2073
- absFilePath?: string | undefined;
2074
- code?: string;
2075
- columnNumber?: number | undefined;
2076
- debugText?: string;
2077
- header?: string;
2078
- language?: string;
2079
- level: 'error' | 'warn' | 'info' | 'log' | 'debug';
2080
- lineNumber?: number | undefined;
2081
- lines: PrintLine[];
2082
- messageText: string;
2083
- relFilePath?: string | undefined;
2084
- type: string;
2085
- }
2086
- export interface CacheStorage {
2087
- get(key: string): Promise<any>;
2088
- set(key: string, value: any): Promise<void>;
2089
- }
2090
- export interface WorkerOptions {
2091
- maxConcurrentWorkers?: number;
2092
- maxConcurrentTasksPerWorker?: number;
2093
- logger?: Logger;
2094
- }
2095
- export interface RollupInterface {
2096
- rollup: {
2097
- (config: any): Promise<any>;
2098
- };
2099
- plugins: {
2100
- nodeResolve(opts: any): any;
2101
- replace(opts: any): any;
2102
- commonjs(opts: any): any;
2103
- json(): any;
2104
- };
2105
- }
2106
- export interface ResolveModuleOptions {
2107
- manuallyResolve?: boolean;
2108
- packageJson?: boolean;
2109
- }
2110
- export interface PrerenderStartOptions {
2111
- buildId?: string;
2112
- hydrateAppFilePath: string;
2113
- componentGraph: BuildResultsComponentGraph;
2114
- srcIndexHtmlPath: string;
2115
- }
2116
- export interface PrerenderResults {
2117
- buildId: string;
2118
- diagnostics: Diagnostic[];
2119
- urls: number;
2120
- duration: number;
2121
- average: number;
2122
- }
2123
- /**
2124
- * Input for CSS optimization functions, including the input CSS
2125
- * string and a few boolean options which turn on or off various
2126
- * optimizations.
2127
- */
2128
- export interface OptimizeCssInput {
2129
- input: string;
2130
- filePath?: string;
2131
- autoprefixer?: boolean | null | AutoprefixerOptions;
2132
- minify?: boolean;
2133
- sourceMap?: boolean;
2134
- resolveUrl?: (url: string) => Promise<string> | string;
2135
- }
2136
- /**
2137
- * This is not a real interface describing the options which can
2138
- * be passed to autoprefixer, for that see the docs, here:
2139
- * https://github.com/postcss/autoprefixer#options
2140
- *
2141
- * Instead, this basically just serves as a label type to track
2142
- * that arguments are being passed consistently.
2143
- */
2144
- export type AutoprefixerOptions = Object;
2145
- /**
2146
- * Output from CSS optimization functions, wrapping up optimized
2147
- * CSS and any diagnostics produced during optimization.
2148
- */
2149
- export interface OptimizeCssOutput {
2150
- output: string;
2151
- diagnostics: Diagnostic[];
2152
- }
2153
- export interface OptimizeJsInput {
2154
- input: string;
2155
- filePath?: string;
2156
- target?: 'es5' | 'latest';
2157
- pretty?: boolean;
2158
- sourceMap?: boolean;
2159
- }
2160
- export interface OptimizeJsOutput {
2161
- output: string;
2162
- sourceMap: any;
2163
- diagnostics: Diagnostic[];
2164
- }
2165
- export interface LazyRequire {
2166
- ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
2167
- require(fromDir: string, moduleId: string): any;
2168
- getModulePath(fromDir: string, moduleId: string): string;
2169
- }
2170
- export interface FsWatcherItem {
2171
- close(): void;
2172
- }
2173
- export interface MakeDirectoryOptions {
2174
- /**
2175
- * Indicates whether parent folders should be created.
2176
- * @default false
2177
- */
2178
- recursive?: boolean;
2179
- /**
2180
- * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
2181
- * @default 0o777.
2182
- */
2183
- mode?: number;
2184
- }
2185
- export interface FsStats {
2186
- isFile(): boolean;
2187
- isDirectory(): boolean;
2188
- isBlockDevice(): boolean;
2189
- isCharacterDevice(): boolean;
2190
- isSymbolicLink(): boolean;
2191
- isFIFO(): boolean;
2192
- isSocket(): boolean;
2193
- dev: number;
2194
- ino: number;
2195
- mode: number;
2196
- nlink: number;
2197
- uid: number;
2198
- gid: number;
2199
- rdev: number;
2200
- size: number;
2201
- blksize: number;
2202
- blocks: number;
2203
- atime: Date;
2204
- mtime: Date;
2205
- ctime: Date;
2206
- birthtime: Date;
2207
- }
2208
- export interface Compiler {
2209
- build(): Promise<CompilerBuildResults>;
2210
- createWatcher(): Promise<CompilerWatcher>;
2211
- destroy(): Promise<void>;
2212
- sys: CompilerSystem;
2213
- }
2214
- export interface CompilerWatcher extends BuildOnEvents {
2215
- start: () => Promise<WatcherCloseResults>;
2216
- close: () => Promise<WatcherCloseResults>;
2217
- request: (data: CompilerRequest) => Promise<CompilerRequestResponse>;
2218
- }
2219
- export interface CompilerRequest {
2220
- path?: string;
2221
- }
2222
- export interface WatcherCloseResults {
2223
- exitCode: number;
2224
- }
2225
- export interface CompilerRequestResponse {
2226
- path: string;
2227
- nodeModuleId: string;
2228
- nodeModuleVersion: string;
2229
- nodeResolvedPath: string;
2230
- cachePath: string;
2231
- cacheHit: boolean;
2232
- content: string;
2233
- status: number;
2234
- }
2235
- export interface TranspileOptions {
2236
- /**
2237
- * A component can be defined as a custom element by using `customelement`, or the
2238
- * component class can be exported by using `module`. Default is `customelement`.
2239
- */
2240
- componentExport?: 'customelement' | 'module' | string | undefined;
2241
- /**
2242
- * Sets how and if component metadata should be assigned on the compiled
2243
- * component output. The `compilerstatic` value will set the metadata to
2244
- * a static `COMPILER_META` getter on the component class. This option
2245
- * is useful for unit testing preprocessors. Default is `null`.
2246
- */
2247
- componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
2248
- /**
2249
- * The actual internal import path for any `@rindo/core` imports.
2250
- * Default is `@rindo/core/internal/client`.
2251
- */
2252
- coreImportPath?: string;
2253
- /**
2254
- * The current working directory. Default is `/`.
2255
- */
2256
- currentDirectory?: string;
2257
- /**
2258
- * The filename of the code being compiled. Default is `module.tsx`.
2259
- */
2260
- file?: string;
2261
- /**
2262
- * Module format to use for the compiled code output, which can be either `esm` or `cjs`.
2263
- * Default is `esm`.
2264
- */
2265
- module?: 'cjs' | 'esm' | string;
2266
- /**
2267
- * Sets how and if any properties, methods and events are proxied on the
2268
- * component class. The `defineproperty` value sets the getters and setters
2269
- * using Object.defineProperty. Default is `defineproperty`.
2270
- */
2271
- proxy?: 'defineproperty' | string | undefined;
2272
- /**
2273
- * How component styles should be associated to the component. The `static`
2274
- * setting will assign the styles as a static getter on the component class.
2275
- */
2276
- style?: 'static' | string | undefined;
2277
- /**
2278
- * How style data should be added for imports. For example, the `queryparams` value
2279
- * adds the component's tagname and encapsulation info as querystring parameter
2280
- * to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
2281
- * style data can be used by bundlers to further optimize each component's css.
2282
- * Set to `null` to not include the querystring parameters. Default is `queryparams`.
2283
- */
2284
- styleImportData?: 'queryparams' | string | undefined;
2285
- /**
2286
- * The JavaScript source target TypeScript should to transpile to. Values can be
2287
- * `latest`, `esnext`, `es2017`, `es2015`, or `es5`. Defaults to `latest`.
2288
- */
2289
- target?: CompileTarget;
2290
- /**
2291
- * Create a source map. Using `inline` will inline the source map into the
2292
- * code, otherwise the source map will be in the returned `map` property.
2293
- * Default is `true`.
2294
- */
2295
- sourceMap?: boolean | 'inline';
2296
- /**
2297
- * Base directory to resolve non-relative module names. Same as the `baseUrl`
2298
- * TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
2299
- */
2300
- baseUrl?: string;
2301
- /**
2302
- * List of path mapping entries for module names to locations relative to the `baseUrl`.
2303
- * Same as the `paths` TypeScript compiler option:
2304
- * https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
2305
- */
2306
- paths?: {
2307
- [key: string]: string[];
2308
- };
2309
- /**
2310
- * Passed in Rindo Compiler System, otherwise falls back to the internal in-memory only system.
2311
- */
2312
- sys?: CompilerSystem;
2313
- }
2314
- export type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
2315
- export interface TranspileResults {
2316
- code: string;
2317
- data?: any[];
2318
- diagnostics: Diagnostic[];
2319
- imports?: {
2320
- path: string;
2321
- }[];
2322
- inputFileExtension: string;
2323
- inputFilePath: string;
2324
- map: any;
2325
- outputFilePath: string;
2326
- }
2327
- export interface TransformOptions {
2328
- coreImportPath: string;
2329
- componentExport: 'lazy' | 'module' | 'customelement' | null;
2330
- componentMetadata: 'runtimestatic' | 'compilerstatic' | null;
2331
- currentDirectory: string;
2332
- file?: string;
2333
- isolatedModules?: boolean;
2334
- module?: 'cjs' | 'esm';
2335
- proxy: 'defineproperty' | null;
2336
- style: 'static' | null;
2337
- styleImportData: 'queryparams' | null;
2338
- target?: string;
2339
- }
2340
- export interface CompileScriptMinifyOptions {
2341
- target?: CompileTarget;
2342
- pretty?: boolean;
2343
- }
2344
- export interface DevServer extends BuildEmitEvents {
2345
- address: string;
2346
- basePath: string;
2347
- browserUrl: string;
2348
- protocol: string;
2349
- port: number;
2350
- root: string;
2351
- close(): Promise<void>;
2352
- }
2353
- export interface CliInitOptions {
2354
- args: string[];
2355
- logger: Logger;
2356
- sys: CompilerSystem;
1
+ import type { ConfigFlags } from '../cli/config-flags';
2
+ import type { PrerenderUrlResults, PrintLine } from '../internal';
3
+ import type { JsonDocs } from './rindo-public-docs';
4
+ export * from './rindo-public-docs';
5
+ /**
6
+ * https://rindojs.web.app/docs/config/
7
+ */
8
+ export interface RindoConfig {
9
+ /**
10
+ * By default, Rindo will attempt to optimize small scripts by inlining them in HTML. Setting
11
+ * this flag to `false` will prevent this optimization and keep all scripts separate from HTML.
12
+ */
13
+ allowInlineScripts?: boolean;
14
+ /**
15
+ * By setting `autoprefixCss` to `true`, Rindo will use the appropriate config to automatically
16
+ * prefix css. For example, developers can write modern and standard css properties, such as
17
+ * "transform", and Rindo will automatically add in the prefixed version, such as "-webkit-transform".
18
+ * As of Rindo v2, autoprefixing CSS is no longer the default.
19
+ * Defaults to `false`
20
+ */
21
+ autoprefixCss?: boolean | any;
22
+ /**
23
+ * By default, Rindo will statically analyze the application and generate a component graph of
24
+ * how all the components are interconnected.
25
+ *
26
+ * From the component graph it is able to best decide how components should be grouped
27
+ * depending on their usage with one another within the app.
28
+ * By doing so it's able to bundle components together in order to reduce network requests.
29
+ * However, bundles can be manually generated using the bundles config.
30
+ *
31
+ * The bundles config is an array of objects that represent how components are grouped together
32
+ * in lazy-loaded bundles.
33
+ * This config is rarely needed as Rindo handles this automatically behind the scenes.
34
+ */
35
+ bundles?: ConfigBundle[];
36
+ /**
37
+ * Rindo will cache build results in order to speed up rebuilds.
38
+ * To disable this feature, set enableCache to false.
39
+ */
40
+ enableCache?: boolean;
41
+ /**
42
+ * Rindo is traditionally used to compile many components into an app,
43
+ * and each component comes with its own compartmentalized styles.
44
+ * However, it's still common to have styles which should be "global" across all components and the website.
45
+ * A global CSS file is often useful to set CSS Variables.
46
+ *
47
+ * Additionally, the globalStyle config can be used to precompile styles with Sass, PostCss, etc.
48
+ * Below is an example folder structure containing a webapp's global sass file, named app.css.
49
+ */
50
+ globalStyle?: string;
51
+ /**
52
+ * When the hashFileNames config is set to true, and it is a production build,
53
+ * the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
54
+ */
55
+ hashedFileNameLength?: number;
56
+ /**
57
+ * During production builds, the content of each generated file is hashed to represent the content,
58
+ * and the hashed value is used as the filename. If the content isn't updated between builds,
59
+ * then it receives the same filename. When the content is updated, then the filename is different.
60
+ *
61
+ * By doing this, deployed apps can "forever-cache" the build directory and take full advantage of
62
+ * content delivery networks (CDNs) and heavily caching files for faster apps.
63
+ */
64
+ hashFileNames?: boolean;
65
+ /**
66
+ * The namespace config is a string representing a namespace for the app.
67
+ * For apps that are not meant to be a library of reusable components,
68
+ * the default of App is just fine. However, if the app is meant to be consumed
69
+ * as a third-party library, such as Family, a unique namespace is required.
70
+ */
71
+ namespace?: string;
72
+ /**
73
+ * Rindo is able to take an app's source and compile it to numerous targets,
74
+ * such as an app to be deployed on an http server, or as a third-party library
75
+ * to be distributed on npm. By default, Rindo apps have an output target type of www.
76
+ *
77
+ * The outputTargets config is an array of objects, with types of www and dist.
78
+ */
79
+ outputTargets?: OutputTarget[];
80
+ /**
81
+ * The plugins config can be used to add your own rollup plugins.
82
+ * By default, Rindo does not come with Sass or PostCss support.
83
+ * However, either can be added using the plugin array.
84
+ */
85
+ plugins?: any[];
86
+ /**
87
+ * Generate js source map files for all bundles
88
+ */
89
+ sourceMap?: boolean;
90
+ /**
91
+ * The srcDir config specifies the directory which should contain the source typescript files
92
+ * for each component. The standard for Rindo apps is to use src, which is the default.
93
+ */
94
+ srcDir?: string;
95
+ /**
96
+ * Sets whether or not Rindo should transform path aliases set in a project's
97
+ * `tsconfig.json` from the assigned module aliases to resolved relative paths.
98
+ *
99
+ * This behavior is opt-in and hence this flag defaults to `false`.
100
+ */
101
+ transformAliasedImportPaths?: boolean;
102
+ /**
103
+ * Passes custom configuration down to the "@rollup/plugin-commonjs" that Rindo uses under the hood.
104
+ * For further information: https://rindojs.web.app/docs/module-bundling
105
+ */
106
+ commonjs?: BundlingConfig;
107
+ /**
108
+ * Passes custom configuration down to the "@rollup/plugin-node-resolve" that Rindo uses under the hood.
109
+ * For further information: https://rindojs.web.app/docs/module-bundling
110
+ */
111
+ nodeResolve?: NodeResolveConfig;
112
+ /**
113
+ * Passes custom configuration down to rollup itself, not all rollup options can be overridden.
114
+ */
115
+ rollupConfig?: RollupConfig;
116
+ /**
117
+ * Sets if the ES5 build should be generated or not. Rindo generates a modern build without ES5,
118
+ * whereas this setting to `true` will also create es5 builds for both dev and prod modes. Setting
119
+ * `buildEs5` to `prod` will only build ES5 in prod mode. Basically if the app does not need to run
120
+ * on legacy browsers (IE11 and Edge 18 and below), it's safe to not build ES5, which will also speed
121
+ * up build times. Defaults to `false`.
122
+ */
123
+ buildEs5?: boolean | 'prod';
124
+ /**
125
+ * Sets if the JS browser files are minified or not. Rindo uses `terser` under the hood.
126
+ * Defaults to `false` in dev mode and `true` in production mode.
127
+ */
128
+ minifyJs?: boolean;
129
+ /**
130
+ * Sets if the CSS is minified or not.
131
+ * Defaults to `false` in dev mode and `true` in production mode.
132
+ */
133
+ minifyCss?: boolean;
134
+ /**
135
+ * Forces Rindo to run in `dev` mode if the value is `true` and `production` mode
136
+ * if it's `false`.
137
+ *
138
+ * Defaults to `false` (ie. production) unless the `--dev` flag is used in the CLI.
139
+ */
140
+ devMode?: boolean;
141
+ /**
142
+ * Object to provide a custom logger. By default a `logger` is already provided for the
143
+ * platform the compiler is running on, such as NodeJS or a browser.
144
+ */
145
+ logger?: Logger;
146
+ /**
147
+ * Config to add extra runtime for DOM features that require more polyfills. Note
148
+ * that not all DOM APIs are fully polyfilled when using the slot polyfill. These
149
+ * are opt-in since not all users will require the additional runtime.
150
+ */
151
+ extras?: ConfigExtras;
152
+ /**
153
+ * The hydrated flag identifies if a component and all of its child components
154
+ * have finished hydrating. This helps prevent any flash of unstyled content (FOUC)
155
+ * as various components are asynchronously downloaded and rendered. By default it
156
+ * will add the `hydrated` CSS class to the element. The `hydratedFlag` config can be used
157
+ * to change the name of the CSS class, change it to an attribute, or change which
158
+ * type of CSS properties and values are assigned before and after hydrating. This config
159
+ * can also be used to not include the hydrated flag at all by setting it to `null`.
160
+ */
161
+ hydratedFlag?: HydratedFlag | null;
162
+ /**
163
+ * Family prefers to hide all components prior to hydration with a style tag appended
164
+ * to the head of the document containing some `visibility: hidden;` css rules.
165
+ *
166
+ * Disabling this will remove the style tag that sets `visibility: hidden;` on all
167
+ * unhydrated web components. This more closely follows the HTML spec, and allows
168
+ * you to set your own fallback content.
169
+ *
170
+ */
171
+ invisiblePrehydration?: boolean;
172
+ /**
173
+ * Sets the task queue used by Rindo's runtime. The task queue schedules DOM read and writes
174
+ * across the frames to efficiently render and reduce layout thrashing. By default,
175
+ * `async` is used. It's recommended to also try each setting to decide which works
176
+ * best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
177
+ * main thread to periodically lock-up, it's always recommended to try
178
+ * [Web Workers](https://rindojs.web.app/docs/web-workers) for those tasks.
179
+ *
180
+ * - `async`: DOM read and writes are scheduled in the next frame to prevent layout thrashing.
181
+ * During intensive CPU tasks it will not reschedule rendering to happen in the next frame.
182
+ * `async` is ideal for most apps, and if the app has many intensive tasks causing the main
183
+ * thread to lock-up, it's recommended to try [Web Workers](https://rindojs.web.app/docs/web-workers)
184
+ * rather than the congestion async queue.
185
+ *
186
+ * - `congestionAsync`: DOM reads and writes are scheduled in the next frame to prevent layout
187
+ * thrashing. When the app is heavily tasked and the queue becomes congested it will then
188
+ * split the work across multiple frames to prevent blocking the main thread. However, it can
189
+ * also introduce unnecessary reflows in some cases, especially during startup. `congestionAsync`
190
+ * is ideal for apps running animations while also simultaneously executing intensive tasks
191
+ * which may lock-up the main thread.
192
+ *
193
+ * - `immediate`: Makes writeTask() and readTask() callbacks to be executed synchronously. Tasks
194
+ * are not scheduled to run in the next frame, but do note there is at least one microtask.
195
+ * The `immediate` setting is ideal for apps that do not provide long running and smooth
196
+ * animations. Like the async setting, if the app has intensive tasks causing the main thread
197
+ * to lock-up, it's recommended to try [Web Workers](https://rindojs.web.app/docs/web-workers).
198
+ */
199
+ taskQueue?: 'async' | 'immediate' | 'congestionAsync';
200
+ /**
201
+ * Provide a object of key/values accessible within the app, using the `Env` object.
202
+ */
203
+ env?: {
204
+ [prop: string]: string | undefined;
205
+ };
206
+ globalScript?: string;
207
+ srcIndexHtml?: string;
208
+ watch?: boolean;
209
+ testing?: TestingConfig;
210
+ maxConcurrentWorkers?: number;
211
+ preamble?: string;
212
+ rollupPlugins?: {
213
+ before?: any[];
214
+ after?: any[];
215
+ };
216
+ entryComponentsHint?: string[];
217
+ buildDist?: boolean;
218
+ buildLogFilePath?: string;
219
+ cacheDir?: string;
220
+ devInspector?: boolean;
221
+ devServer?: RindoDevServerConfig;
222
+ enableCacheStats?: boolean;
223
+ sys?: CompilerSystem;
224
+ tsconfig?: string;
225
+ validateTypes?: boolean;
226
+ /**
227
+ * An array of RegExp patterns that are matched against all source files before adding
228
+ * to the watch list in watch mode. If the file path matches any of the patterns, when it
229
+ * is updated, it will not trigger a re-run of tests.
230
+ */
231
+ watchIgnoredRegex?: RegExp | RegExp[];
232
+ /**
233
+ * Set whether unused dependencies should be excluded from the built output.
234
+ */
235
+ excludeUnusedDependencies?: boolean;
236
+ rindoCoreResolvedId?: string;
237
+ }
238
+ export interface ConfigExtras {
239
+ /**
240
+ * By default, the slot polyfill does not update `appendChild()` so that it appends
241
+ * new child nodes into the correct child slot like how shadow dom works. This is an opt-in
242
+ * polyfill for those who need it when using `element.appendChild(node)` and expecting the
243
+ * child to be appended in the same location shadow dom would. This is not required for
244
+ * IE11 or Edge 18, but can be enabled if the app is using `appendChild()`. Defaults to `false`.
245
+ */
246
+ appendChildSlotFix?: boolean;
247
+ /**
248
+ * By default, the runtime does not polyfill `cloneNode()` when cloning a component
249
+ * that uses the slot polyfill. This is an opt-in polyfill for those who need it.
250
+ * This is not required for IE11 or Edge 18, but can be enabled if the app is using
251
+ * `cloneNode()` and unexpected node are being cloned due to the slot polyfill
252
+ * simulating shadow dom. Defaults to `false`.
253
+ */
254
+ cloneNodeFix?: boolean;
255
+ /**
256
+ * Include the CSS Custom Property polyfill/shim for legacy browsers. ESM builds will
257
+ * not include the css vars shim. Defaults to `false`
258
+ *
259
+ * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
260
+ * versions are no longer supported.
261
+ */
262
+ __deprecated__cssVarsShim?: boolean;
263
+ /**
264
+ * Dynamic `import()` shim. This is only needed for Edge 18 and below, and
265
+ * Firefox 67 and below. Defaults to `false`.
266
+ * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari
267
+ * versions are no longer supported.
268
+ */
269
+ __deprecated__dynamicImportShim?: boolean;
270
+ /**
271
+ * Experimental flag. Projects that use a Rindo library built using the `dist` output target may have trouble lazily
272
+ * loading components when using a bundler such as Wite or Parcel. Setting this flag to `true` will change how Rindo
273
+ * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
274
+ * the size of the compiled output. Defaults to `false`.
275
+ * @deprecated This flag has been deprecated in favor of `enableImportInjection`, which provides the same
276
+ * functionality. `experimentalImportInjection` will be removed in a future major version of Rindo.
277
+ */
278
+ experimentalImportInjection?: boolean;
279
+ /**
280
+ * Projects that use a Rindo library built using the `dist` output target may have trouble lazily
281
+ * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Rindo
282
+ * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
283
+ * the size of the compiled output. Defaults to `false`.
284
+ */
285
+ enableImportInjection?: boolean;
286
+ /**
287
+ * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
288
+ */
289
+ lifecycleDOMEvents?: boolean;
290
+ /**
291
+ * Safari 10 supports ES modules with `<script type="module">`, however, it did not implement
292
+ * `<script nomodule>`. When set to `true`, the runtime will patch support for Safari 10
293
+ * due to its lack of `nomodule` support.
294
+ * Defaults to `false`.
295
+ *
296
+ * @deprecated Since Rindo v3.0.0, Safari 10 is no longer supported.
297
+ */
298
+ __deprecated__safari10?: boolean;
299
+ /**
300
+ * It is possible to assign data to the actual `<script>` element's `data-opts` property,
301
+ * which then gets passed to Rindo's initial bootstrap. This feature is only required
302
+ * for very special cases and rarely needed. Defaults to `false`.
303
+ */
304
+ scriptDataOpts?: boolean;
305
+ /**
306
+ * Experimental flag to align the behavior of invoking `textContent` on a scoped component to act more like a
307
+ * component that uses the shadow DOM. Defaults to `false`
308
+ */
309
+ scopedSlotTextContentFix?: boolean;
310
+ /**
311
+ * If enabled `true`, the runtime will check if the shadow dom shim is required. However,
312
+ * if it's determined that shadow dom is already natively supported by the browser then
313
+ * it does not request the shim. When set to `false` it will avoid all shadow dom tests.
314
+ * Defaults to `false`.
315
+ *
316
+ * @deprecated Since Rindo v3.0.0. IE 11, Edge <= 18, and old Safari versions
317
+ * are no longer supported.
318
+ */
319
+ __deprecated__shadowDomShim?: boolean;
320
+ /**
321
+ * When a component is first attached to the DOM, this setting will wait a single tick before
322
+ * rendering. This works around an Angular issue, where Angular attaches the elements before
323
+ * settings their initial state, leading to double renders and unnecessary event dispatches.
324
+ * Defaults to `false`.
325
+ */
326
+ initializeNextTick?: boolean;
327
+ /**
328
+ * For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled
329
+ * to simulate the same behavior. However, the host element's `childNodes` and `children`
330
+ * getters are not patched to only show the child nodes and elements of the default slot.
331
+ * Defaults to `false`.
332
+ */
333
+ slotChildNodesFix?: boolean;
334
+ /**
335
+ * Enables the tagNameTransform option of `defineCustomElements()`, so the component tagName
336
+ * can be customized at runtime. Defaults to `false`.
337
+ */
338
+ tagNameTransform?: boolean;
339
+ }
340
+ export interface Config extends RindoConfig {
341
+ buildAppCore?: boolean;
342
+ buildDocs?: boolean;
343
+ configPath?: string;
344
+ writeLog?: boolean;
345
+ devServer?: DevServerConfig;
346
+ flags?: ConfigFlags;
347
+ fsNamespace?: string;
348
+ logLevel?: LogLevel;
349
+ rootDir?: string;
350
+ packageJsonFilePath?: string;
351
+ suppressLogs?: boolean;
352
+ profile?: boolean;
353
+ tsCompilerOptions?: any;
354
+ _isValidated?: boolean;
355
+ _isTesting?: boolean;
356
+ }
357
+ /**
358
+ * A 'loose' type useful for wrapping an incomplete / possible malformed
359
+ * object as we work on getting it comply with a particular Interface T.
360
+ *
361
+ * Example:
362
+ *
363
+ * ```ts
364
+ * interface Foo {
365
+ * bar: string
366
+ * }
367
+ *
368
+ * function validateFoo(foo: Loose<Foo>): Foo {
369
+ * let validatedFoo = {
370
+ * ...foo,
371
+ * bar: foo.bar || DEFAULT_BAR
372
+ * }
373
+ *
374
+ * return validatedFoo
375
+ * }
376
+ * ```
377
+ *
378
+ * Use this when you need to take user input or something from some other part
379
+ * of the world that we don't control and transform it into something
380
+ * conforming to a given interface. For best results, pair with a validation
381
+ * function as shown in the example.
382
+ */
383
+ type Loose<T extends Object> = Record<string, any> & Partial<T>;
384
+ /**
385
+ * A Loose version of the Config interface. This is intended to let us load a partial config
386
+ * and have type information carry though as we construct an object which is a valid `Config`.
387
+ */
388
+ export type UnvalidatedConfig = Loose<Config>;
389
+ /**
390
+ * Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
391
+ * This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
392
+ *
393
+ * ```typescript
394
+ * type Foo { bar?: number, baz?: string }
395
+ * type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
396
+ * ```
397
+ */
398
+ type RequireFields<T, K extends keyof T> = T & {
399
+ [P in K]-?: T[P];
400
+ };
401
+ /**
402
+ * Fields in {@link Config} to make required for {@link ValidatedConfig}
403
+ */
404
+ type StrictConfigFields = 'flags' | 'hydratedFlag' | 'logger' | 'outputTargets' | 'packageJsonFilePath' | 'rootDir' | 'sys' | 'testing' | 'transformAliasedImportPaths';
405
+ /**
406
+ * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
407
+ * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
408
+ * about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
409
+ * validations have occurred at runtime.
410
+ */
411
+ export type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
412
+ export interface HydratedFlag {
413
+ /**
414
+ * Defaults to `hydrated`.
415
+ */
416
+ name?: string;
417
+ /**
418
+ * Can be either `class` or `attribute`. Defaults to `class`.
419
+ */
420
+ selector?: 'class' | 'attribute';
421
+ /**
422
+ * The CSS property used to show and hide components. Defaults to use the CSS `visibility`
423
+ * property. Other commonly used CSS properties would be `display` with the `initialValue`
424
+ * setting as `none`, or `opacity` with the `initialValue` as `0`. Defaults to `visibility`
425
+ * and the default `initialValue` is `hidden`.
426
+ */
427
+ property?: string;
428
+ /**
429
+ * This is the CSS value to give all components before it has been hydrated.
430
+ * Defaults to `hidden`.
431
+ */
432
+ initialValue?: string;
433
+ /**
434
+ * This is the CSS value to assign once a component has finished hydrating.
435
+ * This is the CSS value that'll allow the component to show. Defaults to `inherit`.
436
+ */
437
+ hydratedValue?: string;
438
+ }
439
+ export interface RindoDevServerConfig {
440
+ /**
441
+ * IP address used by the dev server. The default is `0.0.0.0`, which points to all IPv4 addresses
442
+ * on the local machine, such as `localhost`.
443
+ */
444
+ address?: string;
445
+ /**
446
+ * Base path to be used by the server. Defaults to the root pathname.
447
+ */
448
+ basePath?: string;
449
+ /**
450
+ * EXPERIMENTAL!
451
+ * During development, node modules can be independently requested and bundled, making for
452
+ * faster build times. This is only available using the Rindo Dev Server throughout
453
+ * development. Production builds and builds with the `es5` flag will override
454
+ * this setting to `false`. Default is `false`.
455
+ */
456
+ experimentalDevModules?: boolean;
457
+ /**
458
+ * If the dev server should respond with gzip compressed content. Defaults to `true`.
459
+ */
460
+ gzip?: boolean;
461
+ /**
462
+ * When set, the dev server will run via https using the SSL certificate and key you provide
463
+ * (use `fs` if you want to read them from files).
464
+ */
465
+ https?: Credentials;
466
+ /**
467
+ * The URL the dev server should first open to. Defaults to `/`.
468
+ */
469
+ initialLoadUrl?: string;
470
+ /**
471
+ * When `true`, every request to the server will be logged within the terminal.
472
+ * Defaults to `false`.
473
+ */
474
+ logRequests?: boolean;
475
+ /**
476
+ * By default, when dev server is started the local dev URL is opened in your default browser.
477
+ * However, to prevent this URL to be opened change this value to `false`. Defaults to `true`.
478
+ */
479
+ openBrowser?: boolean;
480
+ /**
481
+ * Sets the server's port. Defaults to `3333`.
482
+ */
483
+ port?: number;
484
+ /**
485
+ * When files are watched and updated, by default the dev server will use `hmr` (Hot Module Replacement)
486
+ * to update the page without a full page refresh. To have the page do a full refresh use `pageReload`.
487
+ * To disable any reloading, use `null`. Defaults to `hmr`.
488
+ */
489
+ reloadStrategy?: PageReloadStrategy;
490
+ /**
491
+ * Local path to a NodeJs file with a dev server request listener as the default export.
492
+ * The user's request listener is given the first chance to handle every request the dev server
493
+ * receives, and can choose to handle it or instead pass it on to the default dev server
494
+ * by calling `next()`.
495
+ *
496
+ * Below is an example of a NodeJs file the `requestListenerPath` config is using.
497
+ * The request and response arguments are the same as Node's `http` module and `RequestListener`
498
+ * callback. https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener
499
+ *
500
+ * ```js
501
+ * module.exports = function (req, res, next) {
502
+ * if (req.url === '/ping') {
503
+ * // custom response overriding the dev server
504
+ * res.setHeader('Content-Type', 'text/plain');
505
+ * res.writeHead(200);
506
+ * res.end('pong');
507
+ * } else {
508
+ * // pass request on to the default dev server
509
+ * next();
510
+ * }
511
+ * };
512
+ * ```
513
+ */
514
+ requestListenerPath?: string;
515
+ /**
516
+ * The root directory to serve the files from.
517
+ */
518
+ root?: string;
519
+ /**
520
+ * If the dev server should Server-Side Render (SSR) each page, meaning it'll dynamically generate
521
+ * server-side rendered html on each page load. The `--ssr` flag will most commonly be used with
522
+ * the`--dev --watch --serve` flags during development. Note that this is for development purposes
523
+ * only, and the built-in dev server should not be used for production. Defaults to `false`.
524
+ */
525
+ ssr?: boolean;
526
+ /**
527
+ * If the dev server fails to start up within the given timeout (in milliseconds), the startup will
528
+ * be canceled. Set to zero to disable the timeout. Defaults to `15000`.
529
+ */
530
+ startupTimeout?: number;
531
+ /**
532
+ * Whether to use the dev server's websocket client or not. Defaults to `true`.
533
+ */
534
+ websocket?: boolean;
535
+ /**
536
+ * If the dev server should fork a worker for the server process or not. A singled-threaded dev server
537
+ * is slower, however it is useful for debugging http requests and responses. Defaults to `true`.
538
+ */
539
+ worker?: boolean;
540
+ }
541
+ export interface DevServerConfig extends RindoDevServerConfig {
542
+ browserUrl?: string;
543
+ devServerDir?: string;
544
+ /**
545
+ * A list of glob patterns like `subdir/*.js` to exclude from hot-module
546
+ * reloading updates.
547
+ */
548
+ excludeHmr?: string[];
549
+ historyApiFallback?: HistoryApiFallback;
550
+ openBrowser?: boolean;
551
+ prerenderConfig?: string;
552
+ protocol?: 'http' | 'https';
553
+ srcIndexHtml?: string;
554
+ }
555
+ export interface HistoryApiFallback {
556
+ index?: string;
557
+ disableDotRule?: boolean;
558
+ }
559
+ export interface DevServerEditor {
560
+ id: string;
561
+ name?: string;
562
+ supported?: boolean;
563
+ priority?: number;
564
+ }
565
+ export type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
566
+ export type PageReloadStrategy = 'hmr' | 'pageReload' | null;
567
+ /**
568
+ * The prerender config is used when prerendering a `www` output target.
569
+ * Within `rindo.config.ts`, set the path to the prerendering
570
+ * config file path using the `prerenderConfig` property, such as:
571
+ *
572
+ * ```tsx
573
+ * import { Config } from '@rindo/core';
574
+ * export const config: Config = {
575
+ * outputTargets: [
576
+ * {
577
+ * type: 'www',
578
+ * baseUrl: 'https://rindojs.web.app/',
579
+ * prerenderConfig: './prerender.config.ts',
580
+ * }
581
+ * ]
582
+ * };
583
+ * ```
584
+ *
585
+ * The `prerender.config.ts` should export a `config` object using
586
+ * the `PrerenderConfig` interface.
587
+ *
588
+ * ```tsx
589
+ * import { PrerenderConfig } from '@rindo/core';
590
+ * export const config: PrerenderConfig = {
591
+ * ...
592
+ * };
593
+ * ```
594
+ *
595
+ * For more info: https://rindojs.web.app/docs/static-site-generation
596
+ */
597
+ export interface PrerenderConfig {
598
+ /**
599
+ * Run after each `document` is hydrated, but before it is serialized
600
+ * into an HTML string. Hook is passed the `document` and its `URL`.
601
+ */
602
+ afterHydrate?(document: Document, url: URL, results: PrerenderUrlResults): any | Promise<any>;
603
+ /**
604
+ * Run before each `document` is hydrated. Hook is passed the `document` it's `URL`.
605
+ */
606
+ beforeHydrate?(document: Document, url: URL): any | Promise<any>;
607
+ /**
608
+ * Runs after the template Document object has serialize into an
609
+ * HTML formatted string. Returns an HTML string to be used as the
610
+ * base template for all prerendered pages.
611
+ */
612
+ afterSerializeTemplate?(html: string): string | Promise<string>;
613
+ /**
614
+ * Runs before the template Document object is serialize into an
615
+ * HTML formatted string. Returns the Document to be serialized which
616
+ * will become the base template html for all prerendered pages.
617
+ */
618
+ beforeSerializeTemplate?(document: Document): Document | Promise<Document>;
619
+ /**
620
+ * A hook to be used to generate the canonical `<link>` tag
621
+ * which goes in the `<head>` of every prerendered page. Returning `null`
622
+ * will not add a canonical url tag to the page.
623
+ */
624
+ canonicalUrl?(url: URL): string | null;
625
+ /**
626
+ * While prerendering, crawl same-origin URLs found within `<a href>` elements.
627
+ * Defaults to `true`.
628
+ */
629
+ crawlUrls?: boolean;
630
+ /**
631
+ * URLs to start the prerendering from. By default the root URL of `/` is used.
632
+ */
633
+ entryUrls?: string[];
634
+ /**
635
+ * Return `true` the given `<a>` element should be crawled or not.
636
+ */
637
+ filterAnchor?(attrs: {
638
+ [attrName: string]: string;
639
+ }, base?: URL): boolean;
640
+ /**
641
+ * Return `true` if the given URL should be prerendered or not.
642
+ */
643
+ filterUrl?(url: URL, base: URL): boolean;
644
+ /**
645
+ * Returns the file path which the prerendered HTML content
646
+ * should be written to.
647
+ */
648
+ filePath?(url: URL, filePath: string): string;
649
+ /**
650
+ * Returns the hydrate options to use for each individual prerendered page.
651
+ */
652
+ hydrateOptions?(url: URL): PrerenderHydrateOptions;
653
+ /**
654
+ * Returns the template file's content. The template is the base
655
+ * HTML used for all prerendered pages.
656
+ */
657
+ loadTemplate?(filePath: string): string | Promise<string>;
658
+ /**
659
+ * Used to normalize the page's URL from a given a string and the current
660
+ * page's base URL. Largely used when reading an anchor's `href` attribute
661
+ * value and normalizing it into a `URL`.
662
+ */
663
+ normalizeUrl?(href: string, base: URL): URL;
664
+ robotsTxt?(opts: RobotsTxtOpts): string | RobotsTxtResults;
665
+ sitemapXml?(opts: SitemapXmpOpts): string | SitemapXmpResults;
666
+ /**
667
+ * Static Site Generated (SSG). Does not include Rindo's clientside
668
+ * JavaScript, custom elements or preload modules.
669
+ */
670
+ staticSite?: boolean;
671
+ /**
672
+ * If the prerenndered URLs should have a trailing "/"" or not. Defaults to `false`.
673
+ */
674
+ trailingSlash?: boolean;
675
+ }
676
+ export interface HydrateDocumentOptions {
677
+ /**
678
+ * Build ID that will be added to `<html data-rindo-build="BUILD_ID">`. By default
679
+ * a random ID will be generated
680
+ */
681
+ buildId?: string;
682
+ /**
683
+ * Sets the `href` attribute on the `<link rel="canonical">`
684
+ * tag within the `<head>`. If the value is not defined it will
685
+ * ensure a canonical link tag is no included in the `<head>`.
686
+ */
687
+ canonicalUrl?: string;
688
+ /**
689
+ * Include the HTML comments and attributes used by the clientside
690
+ * JavaScript to read the structure of the HTML and rebuild each
691
+ * component. Defaults to `true`.
692
+ */
693
+ clientHydrateAnnotations?: boolean;
694
+ /**
695
+ * Constrain `setTimeout()` to 1ms, but still async. Also
696
+ * only allows `setInterval()` to fire once, also constrained to 1ms.
697
+ * Defaults to `true`.
698
+ */
699
+ constrainTimeouts?: boolean;
700
+ /**
701
+ * Sets `document.cookie`
702
+ */
703
+ cookie?: string;
704
+ /**
705
+ * Sets the `dir` attribute on the top level `<html>`.
706
+ */
707
+ direction?: string;
708
+ /**
709
+ * Component tag names listed here will not be prerendered, nor will
710
+ * hydrated on the clientside. Components listed here will be ignored
711
+ * as custom elements and treated no differently than a `<div>`.
712
+ */
713
+ excludeComponents?: string[];
714
+ /**
715
+ * Sets the `lang` attribute on the top level `<html>`.
716
+ */
717
+ language?: string;
718
+ /**
719
+ * Maximum number of components to hydrate on one page. Defaults to `300`.
720
+ */
721
+ maxHydrateCount?: number;
722
+ /**
723
+ * Sets `document.referrer`
724
+ */
725
+ referrer?: string;
726
+ /**
727
+ * Removes every `<script>` element found in the `document`. Defaults to `false`.
728
+ */
729
+ removeScripts?: boolean;
730
+ /**
731
+ * Removes CSS not used by elements within the `document`. Defaults to `true`.
732
+ */
733
+ removeUnusedStyles?: boolean;
734
+ /**
735
+ * The url the runtime uses for the resources, such as the assets directory.
736
+ */
737
+ resourcesUrl?: string;
738
+ /**
739
+ * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
740
+ */
741
+ runtimeLogging?: boolean;
742
+ /**
743
+ * Component tags listed here will only be prerendered or serverside-rendered
744
+ * and will not be clientside hydrated. This is useful for components that
745
+ * are not dynamic and do not need to be defined as a custom element within the
746
+ * browser. For example, a header or footer component would be a good example that
747
+ * may not require any clientside JavaScript.
748
+ */
749
+ staticComponents?: string[];
750
+ /**
751
+ * The amount of milliseconds to wait for a page to finish rendering until
752
+ * a timeout error is thrown. Defaults to `15000`.
753
+ */
754
+ timeout?: number;
755
+ /**
756
+ * Sets `document.title`.
757
+ */
758
+ title?: string;
759
+ /**
760
+ * Sets `location.href`
761
+ */
762
+ url?: string;
763
+ /**
764
+ * Sets `navigator.userAgent`
765
+ */
766
+ userAgent?: string;
767
+ }
768
+ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
769
+ /**
770
+ * Runs after the `document` has been hydrated.
771
+ */
772
+ afterHydrate?(document: any): any | Promise<any>;
773
+ /**
774
+ * Sets an approximate line width the HTML should attempt to stay within.
775
+ * Note that this is "approximate", in that HTML may often not be able
776
+ * to be split at an exact line width. Additionally, new lines created
777
+ * is where HTML naturally already has whitespace, such as before an
778
+ * attribute or spaces between words. Defaults to `100`.
779
+ */
780
+ approximateLineWidth?: number;
781
+ /**
782
+ * Runs before the `document` has been hydrated.
783
+ */
784
+ beforeHydrate?(document: any): any | Promise<any>;
785
+ /**
786
+ * Format the HTML in a nicely indented format.
787
+ * Defaults to `false`.
788
+ */
789
+ prettyHtml?: boolean;
790
+ /**
791
+ * Remove quotes from attribute values when possible.
792
+ * Defaults to `true`.
793
+ */
794
+ removeAttributeQuotes?: boolean;
795
+ /**
796
+ * Remove the `=""` from standardized `boolean` attributes,
797
+ * such as `hidden` or `checked`. Defaults to `true`.
798
+ */
799
+ removeBooleanAttributeQuotes?: boolean;
800
+ /**
801
+ * Remove these standardized attributes when their value is empty:
802
+ * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
803
+ */
804
+ removeEmptyAttributes?: boolean;
805
+ /**
806
+ * Remove HTML comments. Defaults to `true`.
807
+ */
808
+ removeHtmlComments?: boolean;
809
+ }
810
+ export interface HydrateFactoryOptions extends SerializeDocumentOptions {
811
+ serializeToHtml: boolean;
812
+ destroyWindow: boolean;
813
+ destroyDocument: boolean;
814
+ }
815
+ export interface PrerenderHydrateOptions extends SerializeDocumentOptions {
816
+ /**
817
+ * Adds `<link rel="modulepreload">` for modules that will eventually be requested.
818
+ * Defaults to `true`.
819
+ */
820
+ addModulePreloads?: boolean;
821
+ /**
822
+ * Hash the content of assets, such as images, fonts and css files,
823
+ * and add the hashed value as `v` querystring. For example,
824
+ * `/assets/image.png?v=abcd1234`. This allows for assets to be
825
+ * heavily cached by setting the server's response header with
826
+ * `Cache-Control: max-age=31536000, immutable`.
827
+ */
828
+ hashAssets?: 'querystring';
829
+ /**
830
+ * External stylesheets from `<link rel="stylesheet">` are instead inlined
831
+ * into `<style>` elements. Defaults to `false`.
832
+ */
833
+ inlineExternalStyleSheets?: boolean;
834
+ /**
835
+ * Minify CSS content within `<style>` elements. Defaults to `true`.
836
+ */
837
+ minifyStyleElements?: boolean;
838
+ /**
839
+ * Minify JavaScript content within `<script>` elements. Defaults to `true`.
840
+ */
841
+ minifyScriptElements?: boolean;
842
+ /**
843
+ * Entire `document` should be static. This is useful for specific pages that
844
+ * should be static, rather than the entire site. If the whole site should be static,
845
+ * use the `staticSite` property on the prerender config instead. If only certain
846
+ * components should be static then use `staticComponents` instead.
847
+ */
848
+ staticDocument?: boolean;
849
+ }
850
+ export interface RobotsTxtOpts {
851
+ urls: string[];
852
+ sitemapUrl: string;
853
+ baseUrl: string;
854
+ dir: string;
855
+ }
856
+ export interface RobotsTxtResults {
857
+ content: string;
858
+ filePath: string;
859
+ url: string;
860
+ }
861
+ export interface SitemapXmpOpts {
862
+ urls: string[];
863
+ baseUrl: string;
864
+ dir: string;
865
+ }
866
+ export interface SitemapXmpResults {
867
+ content: string;
868
+ filePath: string;
869
+ url: string;
870
+ }
871
+ /**
872
+ * Common system used by the compiler. All file reads, writes, access, etc. will all use
873
+ * this system. Additionally, throughout each build, the compiler will use an internal
874
+ * in-memory file system as to prevent unnecessary fs reads and writes. At the end of each
875
+ * build all actions the in-memory fs performed will be written to disk using this system.
876
+ * A NodeJS based system will use APIs such as `fs` and `crypto`, and a web-based system
877
+ * will use in-memory Maps and browser APIs. Either way, the compiler itself is unaware
878
+ * of the actual platform it's being ran on top of.
879
+ */
880
+ export interface CompilerSystem {
881
+ name: 'node' | 'in-memory';
882
+ version: string;
883
+ events?: BuildEvents;
884
+ details?: SystemDetails;
885
+ /**
886
+ * Add a callback which will be ran when destroy() is called.
887
+ */
888
+ addDestroy(cb: () => void): void;
889
+ /**
890
+ * Always returns a boolean, does not throw.
891
+ */
892
+ access(p: string): Promise<boolean>;
893
+ /**
894
+ * SYNC! Always returns a boolean, does not throw.
895
+ */
896
+ accessSync(p: string): boolean;
897
+ applyGlobalPatch?(fromDir: string): Promise<void>;
898
+ applyPrerenderGlobalPatch?(opts: {
899
+ devServerHostUrl: string;
900
+ window: any;
901
+ }): void;
902
+ cacheStorage?: CacheStorage;
903
+ checkVersion?: (logger: Logger, currentVersion: string) => Promise<() => void>;
904
+ copy?(copyTasks: Required<CopyTask>[], srcDir: string): Promise<CopyResults>;
905
+ /**
906
+ * Always returns a boolean if the files were copied or not. Does not throw.
907
+ */
908
+ copyFile(src: string, dst: string): Promise<boolean>;
909
+ /**
910
+ * Used to destroy any listeners, file watchers or child processes.
911
+ */
912
+ destroy(): Promise<void>;
913
+ /**
914
+ * Does not throw.
915
+ */
916
+ createDir(p: string, opts?: CompilerSystemCreateDirectoryOptions): Promise<CompilerSystemCreateDirectoryResults>;
917
+ /**
918
+ * SYNC! Does not throw.
919
+ */
920
+ createDirSync(p: string, opts?: CompilerSystemCreateDirectoryOptions): CompilerSystemCreateDirectoryResults;
921
+ homeDir(): string;
922
+ /**
923
+ * Used to determine if the current context of the terminal is TTY.
924
+ */
925
+ isTTY(): boolean;
926
+ /**
927
+ * Each platform as a different way to dynamically import modules.
928
+ */
929
+ dynamicImport?(p: string): Promise<any>;
930
+ /**
931
+ * Creates the worker controller for the current system.
932
+ */
933
+ createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
934
+ encodeToBase64(str: string): string;
935
+ /**
936
+ * @deprecated
937
+ */
938
+ ensureDependencies?(opts: {
939
+ rootDir: string;
940
+ logger: Logger;
941
+ dependencies: CompilerDependency[];
942
+ }): Promise<{
943
+ rindoPath: string;
944
+ diagnostics: Diagnostic[];
945
+ }>;
946
+ /**
947
+ * @deprecated
948
+ */
949
+ ensureResources?(opts: {
950
+ rootDir: string;
951
+ logger: Logger;
952
+ dependencies: CompilerDependency[];
953
+ }): Promise<void>;
954
+ /**
955
+ * process.exit()
956
+ */
957
+ exit(exitCode: number): Promise<void>;
958
+ /**
959
+ * Optionally provide a fetch() function rather than using the built-in fetch().
960
+ * First arg is a url string or Request object (RequestInfo).
961
+ * Second arg is the RequestInit. Returns the Response object
962
+ */
963
+ fetch?(input: string | any, init?: any): Promise<any>;
964
+ /**
965
+ * Generates a sha1 digest encoded as HEX
966
+ */
967
+ generateContentHash?(content: string | any, length?: number): Promise<string>;
968
+ /**
969
+ * Generates a sha1 digest encoded as HEX from a file path
970
+ */
971
+ generateFileHash?(filePath: string | any, length?: number): Promise<string>;
972
+ /**
973
+ * Get the current directory.
974
+ */
975
+ getCurrentDirectory(): string;
976
+ /**
977
+ * The compiler's executing path.
978
+ */
979
+ getCompilerExecutingPath(): string;
980
+ /**
981
+ * The dev server's executing path.
982
+ */
983
+ getDevServerExecutingPath?(): string;
984
+ getEnvironmentVar?(key: string): string;
985
+ /**
986
+ * Gets the absolute file path when for a dependency module.
987
+ */
988
+ getLocalModulePath(opts: {
989
+ rootDir: string;
990
+ moduleId: string;
991
+ path: string;
992
+ }): string;
993
+ /**
994
+ * Gets the full url when requesting a dependency module to fetch from a CDN.
995
+ */
996
+ getRemoteModuleUrl(opts: {
997
+ moduleId: string;
998
+ path?: string;
999
+ version?: string;
1000
+ }): string;
1001
+ /**
1002
+ * Aync glob task. Only available in NodeJS compiler system.
1003
+ */
1004
+ glob?(pattern: string, options: {
1005
+ cwd?: string;
1006
+ nodir?: boolean;
1007
+ [key: string]: any;
1008
+ }): Promise<string[]>;
1009
+ /**
1010
+ * The number of logical processors available to run threads on the user's computer (cpus).
1011
+ */
1012
+ hardwareConcurrency: number;
1013
+ /**
1014
+ * Tests if the path is a symbolic link or not. Always resolves a boolean. Does not throw.
1015
+ */
1016
+ isSymbolicLink(p: string): Promise<boolean>;
1017
+ lazyRequire?: LazyRequire;
1018
+ nextTick(cb: () => void): void;
1019
+ /**
1020
+ * Normalize file system path.
1021
+ */
1022
+ normalizePath(p: string): string;
1023
+ onProcessInterrupt?(cb: () => void): void;
1024
+ parseYarnLockFile?: (content: string) => {
1025
+ type: 'success' | 'merge' | 'conflict';
1026
+ object: any;
1027
+ };
1028
+ platformPath: PlatformPath;
1029
+ /**
1030
+ * All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
1031
+ */
1032
+ readDir(p: string): Promise<string[]>;
1033
+ /**
1034
+ * SYNC! All return paths are full normalized paths, not just the basenames. Always returns an array, does not throw.
1035
+ */
1036
+ readDirSync(p: string): string[];
1037
+ /**
1038
+ * Returns undefined if file is not found. Does not throw.
1039
+ */
1040
+ readFile(p: string): Promise<string>;
1041
+ readFile(p: string, encoding: 'utf8'): Promise<string>;
1042
+ readFile(p: string, encoding: 'binary'): Promise<any>;
1043
+ /**
1044
+ * SYNC! Returns undefined if file is not found. Does not throw.
1045
+ */
1046
+ readFileSync(p: string, encoding?: string): string;
1047
+ /**
1048
+ * Does not throw.
1049
+ */
1050
+ realpath(p: string): Promise<CompilerSystemRealpathResults>;
1051
+ /**
1052
+ * SYNC! Does not throw.
1053
+ */
1054
+ realpathSync(p: string): CompilerSystemRealpathResults;
1055
+ /**
1056
+ * Remove a callback which will be ran when destroy() is called.
1057
+ */
1058
+ removeDestroy(cb: () => void): void;
1059
+ /**
1060
+ * Rename old path to new path. Does not throw.
1061
+ */
1062
+ rename(oldPath: string, newPath: string): Promise<CompilerSystemRenameResults>;
1063
+ resolveModuleId?(opts: ResolveModuleIdOptions): Promise<ResolveModuleIdResults>;
1064
+ resolvePath(p: string): string;
1065
+ /**
1066
+ * Does not throw.
1067
+ */
1068
+ removeDir(p: string, opts?: CompilerSystemRemoveDirectoryOptions): Promise<CompilerSystemRemoveDirectoryResults>;
1069
+ /**
1070
+ * SYNC! Does not throw.
1071
+ */
1072
+ removeDirSync(p: string, opts?: CompilerSystemRemoveDirectoryOptions): CompilerSystemRemoveDirectoryResults;
1073
+ /**
1074
+ * Does not throw.
1075
+ */
1076
+ removeFile(p: string): Promise<CompilerSystemRemoveFileResults>;
1077
+ /**
1078
+ * SYNC! Does not throw.
1079
+ */
1080
+ removeFileSync(p: string): CompilerSystemRemoveFileResults;
1081
+ setupCompiler?: (c: {
1082
+ ts: any;
1083
+ }) => void;
1084
+ /**
1085
+ * Always returns an object. Does not throw. Check for "error" property if there's an error.
1086
+ */
1087
+ stat(p: string): Promise<CompilerFsStats>;
1088
+ /**
1089
+ * SYNC! Always returns an object. Does not throw. Check for "error" property if there's an error.
1090
+ */
1091
+ statSync(p: string): CompilerFsStats;
1092
+ tmpDirSync(): string;
1093
+ watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
1094
+ /**
1095
+ * A `watchFile` implementation in order to hook into the rest of the {@link CompilerSystem} implementation that is
1096
+ * used when running Rindo's compiler in "watch mode".
1097
+ *
1098
+ * It is analogous to TypeScript's `watchFile` implementation.
1099
+ *
1100
+ * Note, this function may be called for full builds of Rindo projects by the TypeScript compiler. It should not
1101
+ * assume that it will only be called in watch mode.
1102
+ *
1103
+ * This function should not perform any file watcher registration itself. Each `path` provided to it when called
1104
+ * should already have been registered as a file to watch.
1105
+ *
1106
+ * @param path the path to the file that is being watched
1107
+ * @param callback a callback to invoke when a file that is being watched has changed in some way
1108
+ * @returns an object with a method for unhooking the file watcher from the system
1109
+ */
1110
+ watchFile?(path: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
1111
+ /**
1112
+ * How many milliseconds to wait after a change before calling watch callbacks.
1113
+ */
1114
+ watchTimeout?: number;
1115
+ /**
1116
+ * Does not throw.
1117
+ */
1118
+ writeFile(p: string, content: string): Promise<CompilerSystemWriteFileResults>;
1119
+ /**
1120
+ * SYNC! Does not throw.
1121
+ */
1122
+ writeFileSync(p: string, content: string): CompilerSystemWriteFileResults;
1123
+ }
1124
+ export interface TranspileOnlyResults {
1125
+ diagnostics: Diagnostic[];
1126
+ output: string;
1127
+ sourceMap: any;
1128
+ }
1129
+ export interface ParsedPath {
1130
+ root: string;
1131
+ dir: string;
1132
+ base: string;
1133
+ ext: string;
1134
+ name: string;
1135
+ }
1136
+ export interface PlatformPath {
1137
+ normalize(p: string): string;
1138
+ join(...paths: string[]): string;
1139
+ resolve(...pathSegments: string[]): string;
1140
+ isAbsolute(p: string): boolean;
1141
+ relative(from: string, to: string): string;
1142
+ dirname(p: string): string;
1143
+ basename(p: string, ext?: string): string;
1144
+ extname(p: string): string;
1145
+ parse(p: string): ParsedPath;
1146
+ sep: string;
1147
+ delimiter: string;
1148
+ posix: any;
1149
+ win32: any;
1150
+ }
1151
+ export interface CompilerDependency {
1152
+ name: string;
1153
+ version: string;
1154
+ main: string;
1155
+ resources?: string[];
1156
+ }
1157
+ export interface ResolveModuleIdOptions {
1158
+ moduleId: string;
1159
+ containingFile?: string;
1160
+ exts?: string[];
1161
+ packageFilter?: (pkg: any) => void;
1162
+ }
1163
+ export interface ResolveModuleIdResults {
1164
+ moduleId: string;
1165
+ resolveId: string;
1166
+ pkgData: {
1167
+ name: string;
1168
+ version: string;
1169
+ [key: string]: any;
1170
+ };
1171
+ pkgDirPath: string;
1172
+ }
1173
+ export interface WorkerMainController {
1174
+ send(...args: any[]): Promise<any>;
1175
+ handler(name: string): (...args: any[]) => Promise<any>;
1176
+ destroy(): void;
1177
+ maxWorkers: number;
1178
+ }
1179
+ export interface CopyResults {
1180
+ diagnostics: Diagnostic[];
1181
+ filePaths: string[];
1182
+ dirPaths: string[];
1183
+ }
1184
+ export interface SystemDetails {
1185
+ cpuModel: string;
1186
+ freemem(): number;
1187
+ platform: 'darwin' | 'windows' | 'linux' | '';
1188
+ release: string;
1189
+ totalmem: number;
1190
+ }
1191
+ export interface BuildOnEvents {
1192
+ on(cb: (eventName: CompilerEventName, data: any) => void): BuildOnEventRemove;
1193
+ on(eventName: CompilerEventFileAdd, cb: (path: string) => void): BuildOnEventRemove;
1194
+ on(eventName: CompilerEventFileDelete, cb: (path: string) => void): BuildOnEventRemove;
1195
+ on(eventName: CompilerEventFileUpdate, cb: (path: string) => void): BuildOnEventRemove;
1196
+ on(eventName: CompilerEventDirAdd, cb: (path: string) => void): BuildOnEventRemove;
1197
+ on(eventName: CompilerEventDirDelete, cb: (path: string) => void): BuildOnEventRemove;
1198
+ on(eventName: CompilerEventBuildStart, cb: (buildStart: CompilerBuildStart) => void): BuildOnEventRemove;
1199
+ on(eventName: CompilerEventBuildFinish, cb: (buildResults: CompilerBuildResults) => void): BuildOnEventRemove;
1200
+ on(eventName: CompilerEventBuildLog, cb: (buildLog: BuildLog) => void): BuildOnEventRemove;
1201
+ on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
1202
+ }
1203
+ export interface BuildEmitEvents {
1204
+ emit(eventName: CompilerEventName, path: string): void;
1205
+ emit(eventName: CompilerEventFileAdd, path: string): void;
1206
+ emit(eventName: CompilerEventFileDelete, path: string): void;
1207
+ emit(eventName: CompilerEventFileUpdate, path: string): void;
1208
+ emit(eventName: CompilerEventDirAdd, path: string): void;
1209
+ emit(eventName: CompilerEventDirDelete, path: string): void;
1210
+ emit(eventName: CompilerEventBuildStart, buildStart: CompilerBuildStart): void;
1211
+ emit(eventName: CompilerEventBuildFinish, buildResults: CompilerBuildResults): void;
1212
+ emit(eventName: CompilerEventBuildNoChange, buildNoChange: BuildNoChangeResults): void;
1213
+ emit(eventName: CompilerEventBuildLog, buildLog: BuildLog): void;
1214
+ emit(eventName: CompilerEventFsChange, fsWatchResults: FsWatchResults): void;
1215
+ }
1216
+ export interface FsWatchResults {
1217
+ dirsAdded: string[];
1218
+ dirsDeleted: string[];
1219
+ filesUpdated: string[];
1220
+ filesAdded: string[];
1221
+ filesDeleted: string[];
1222
+ }
1223
+ export interface BuildLog {
1224
+ buildId: number;
1225
+ messages: string[];
1226
+ progress: number;
1227
+ }
1228
+ export interface BuildNoChangeResults {
1229
+ buildId: number;
1230
+ noChange: boolean;
1231
+ }
1232
+ export interface CompilerBuildResults {
1233
+ buildId: number;
1234
+ componentGraph?: BuildResultsComponentGraph;
1235
+ diagnostics: Diagnostic[];
1236
+ dirsAdded: string[];
1237
+ dirsDeleted: string[];
1238
+ duration: number;
1239
+ filesAdded: string[];
1240
+ filesChanged: string[];
1241
+ filesDeleted: string[];
1242
+ filesUpdated: string[];
1243
+ hasError: boolean;
1244
+ hasSuccessfulBuild: boolean;
1245
+ hmr?: HotModuleReplacement;
1246
+ hydrateAppFilePath?: string;
1247
+ isRebuild: boolean;
1248
+ namespace: string;
1249
+ outputs: BuildOutput[];
1250
+ rootDir: string;
1251
+ srcDir: string;
1252
+ timestamp: string;
1253
+ }
1254
+ export interface BuildResultsComponentGraph {
1255
+ [scopeId: string]: string[];
1256
+ }
1257
+ export interface BuildOutput {
1258
+ type: string;
1259
+ files: string[];
1260
+ }
1261
+ export interface HotModuleReplacement {
1262
+ componentsUpdated?: string[];
1263
+ excludeHmr?: string[];
1264
+ externalStylesUpdated?: string[];
1265
+ imagesUpdated?: string[];
1266
+ indexHtmlUpdated?: boolean;
1267
+ inlineStylesUpdated?: HmrStyleUpdate[];
1268
+ reloadStrategy: PageReloadStrategy;
1269
+ scriptsAdded?: string[];
1270
+ scriptsDeleted?: string[];
1271
+ serviceWorkerUpdated?: boolean;
1272
+ versionId?: string;
1273
+ }
1274
+ export interface HmrStyleUpdate {
1275
+ styleId: string;
1276
+ styleTag: string;
1277
+ styleText: string;
1278
+ }
1279
+ export type BuildOnEventRemove = () => boolean;
1280
+ export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
1281
+ unsubscribeAll(): void;
1282
+ }
1283
+ export interface CompilerBuildStart {
1284
+ buildId: number;
1285
+ timestamp: string;
1286
+ }
1287
+ /**
1288
+ * A type describing a function to call when an event is emitted by a file watcher
1289
+ * @param fileName the path of the file tied to event
1290
+ * @param eventKind a variant describing the type of event that was emitter (added, edited, etc.)
1291
+ */
1292
+ export type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
1293
+ /**
1294
+ * A type describing the different types of events that Rindo expects may happen when a file being watched is altered
1295
+ * in some way
1296
+ */
1297
+ export type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
1298
+ export type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
1299
+ export type CompilerEventFsChange = 'fsChange';
1300
+ export type CompilerEventFileUpdate = 'fileUpdate';
1301
+ export type CompilerEventFileAdd = 'fileAdd';
1302
+ export type CompilerEventFileDelete = 'fileDelete';
1303
+ export type CompilerEventDirAdd = 'dirAdd';
1304
+ export type CompilerEventDirDelete = 'dirDelete';
1305
+ export type CompilerEventBuildStart = 'buildStart';
1306
+ export type CompilerEventBuildFinish = 'buildFinish';
1307
+ export type CompilerEventBuildLog = 'buildLog';
1308
+ export type CompilerEventBuildNoChange = 'buildNoChange';
1309
+ export interface CompilerFileWatcher {
1310
+ close(): void | Promise<void>;
1311
+ }
1312
+ export interface CompilerFsStats {
1313
+ /**
1314
+ * If it's a directory. `false` if there was an error.
1315
+ */
1316
+ isDirectory: boolean;
1317
+ /**
1318
+ * If it's a file. `false` if there was an error.
1319
+ */
1320
+ isFile: boolean;
1321
+ /**
1322
+ * If it's a symlink. `false` if there was an error.
1323
+ */
1324
+ isSymbolicLink: boolean;
1325
+ /**
1326
+ * The size of the file in bytes. `0` for directories or if there was an error.
1327
+ */
1328
+ size: number;
1329
+ /**
1330
+ * The timestamp indicating the last time this file was modified expressed in milliseconds since the POSIX Epoch.
1331
+ */
1332
+ mtimeMs?: number;
1333
+ /**
1334
+ * Error if there was one, otherwise `null`. `stat` and `statSync` do not throw errors but always returns this interface.
1335
+ */
1336
+ error: any;
1337
+ }
1338
+ export interface CompilerSystemCreateDirectoryOptions {
1339
+ /**
1340
+ * Indicates whether parent directories should be created.
1341
+ * @default false
1342
+ */
1343
+ recursive?: boolean;
1344
+ /**
1345
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
1346
+ * @default 0o777.
1347
+ */
1348
+ mode?: number;
1349
+ }
1350
+ export interface CompilerSystemCreateDirectoryResults {
1351
+ basename: string;
1352
+ dirname: string;
1353
+ path: string;
1354
+ newDirs: string[];
1355
+ error: any;
1356
+ }
1357
+ export interface CompilerSystemRemoveDirectoryOptions {
1358
+ /**
1359
+ * Indicates whether child files and subdirectories should be removed.
1360
+ * @default false
1361
+ */
1362
+ recursive?: boolean;
1363
+ }
1364
+ export interface CompilerSystemRemoveDirectoryResults {
1365
+ basename: string;
1366
+ dirname: string;
1367
+ path: string;
1368
+ removedDirs: string[];
1369
+ removedFiles: string[];
1370
+ error: any;
1371
+ }
1372
+ export interface CompilerSystemRenameResults extends CompilerSystemRenamedPath {
1373
+ renamed: CompilerSystemRenamedPath[];
1374
+ oldDirs: string[];
1375
+ oldFiles: string[];
1376
+ newDirs: string[];
1377
+ newFiles: string[];
1378
+ error: any;
1379
+ }
1380
+ export interface CompilerSystemRenamedPath {
1381
+ oldPath: string;
1382
+ newPath: string;
1383
+ isFile: boolean;
1384
+ isDirectory: boolean;
1385
+ }
1386
+ export interface CompilerSystemRealpathResults {
1387
+ path: string;
1388
+ error: any;
1389
+ }
1390
+ export interface CompilerSystemRemoveFileResults {
1391
+ basename: string;
1392
+ dirname: string;
1393
+ path: string;
1394
+ error: any;
1395
+ }
1396
+ export interface CompilerSystemWriteFileResults {
1397
+ path: string;
1398
+ error: any;
1399
+ }
1400
+ export interface Credentials {
1401
+ key: string;
1402
+ cert: string;
1403
+ }
1404
+ export interface ConfigBundle {
1405
+ components: string[];
1406
+ }
1407
+ export interface CopyTask {
1408
+ src: string;
1409
+ dest?: string;
1410
+ warn?: boolean;
1411
+ keepDirStructure?: boolean;
1412
+ }
1413
+ export interface BundlingConfig {
1414
+ namedExports?: {
1415
+ [key: string]: string[];
1416
+ };
1417
+ }
1418
+ export interface NodeResolveConfig {
1419
+ module?: boolean;
1420
+ jsnext?: boolean;
1421
+ main?: boolean;
1422
+ browser?: boolean;
1423
+ extensions?: string[];
1424
+ preferBuiltins?: boolean;
1425
+ jail?: string;
1426
+ only?: Array<string | RegExp>;
1427
+ modulesOnly?: boolean;
1428
+ /**
1429
+ * @see https://github.com/browserify/resolve#resolveid-opts-cb
1430
+ */
1431
+ customResolveOptions?: {
1432
+ basedir?: string;
1433
+ package?: string;
1434
+ extensions?: string[];
1435
+ readFile?: Function;
1436
+ isFile?: Function;
1437
+ isDirectory?: Function;
1438
+ packageFilter?: Function;
1439
+ pathFilter?: Function;
1440
+ paths?: Function | string[];
1441
+ moduleDirectory?: string | string[];
1442
+ preserveSymlinks?: boolean;
1443
+ };
1444
+ }
1445
+ export interface RollupConfig {
1446
+ inputOptions?: RollupInputOptions;
1447
+ outputOptions?: RollupOutputOptions;
1448
+ }
1449
+ export interface RollupInputOptions {
1450
+ context?: string;
1451
+ moduleContext?: ((id: string) => string) | {
1452
+ [id: string]: string;
1453
+ };
1454
+ treeshake?: boolean;
1455
+ }
1456
+ export interface RollupOutputOptions {
1457
+ globals?: {
1458
+ [name: string]: string;
1459
+ } | ((name: string) => string);
1460
+ }
1461
+ export interface Testing {
1462
+ run(opts: TestingRunOptions): Promise<boolean>;
1463
+ destroy(): Promise<void>;
1464
+ }
1465
+ export interface TestingRunOptions {
1466
+ e2e?: boolean;
1467
+ screenshot?: boolean;
1468
+ spec?: boolean;
1469
+ updateScreenshot?: boolean;
1470
+ }
1471
+ export interface JestConfig {
1472
+ /**
1473
+ * This option tells Jest that all imported modules in your tests should be mocked automatically.
1474
+ * All modules used in your tests will have a replacement implementation, keeping the API surface. Default: false
1475
+ */
1476
+ automock?: boolean;
1477
+ /**
1478
+ * By default, Jest runs all tests and produces all errors into the console upon completion.
1479
+ * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
1480
+ */
1481
+ bail?: boolean;
1482
+ /**
1483
+ * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
1484
+ * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
1485
+ * customize where Jest stores that cache data on disk. Default: "/tmp/<path>"
1486
+ */
1487
+ cacheDirectory?: string;
1488
+ /**
1489
+ * Automatically clear mock calls and instances between every test. Equivalent to calling jest.clearAllMocks()
1490
+ * between each test. This does not remove any mock implementation that may have been provided. Default: false
1491
+ */
1492
+ clearMocks?: boolean;
1493
+ /**
1494
+ * Indicates whether the coverage information should be collected while executing the test. Because this retrofits all
1495
+ * executed files with coverage collection statements, it may significantly slow down your tests. Default: false
1496
+ */
1497
+ collectCoverage?: boolean;
1498
+ /**
1499
+ * An array of glob patterns indicating a set of files for which coverage information should be collected.
1500
+ * If a file matches the specified glob pattern, coverage information will be collected for it even if no tests exist
1501
+ * for this file and it's never required in the test suite. Default: undefined
1502
+ */
1503
+ collectCoverageFrom?: any[];
1504
+ /**
1505
+ * The directory where Jest should output its coverage files. Default: undefined
1506
+ */
1507
+ coverageDirectory?: string;
1508
+ /**
1509
+ * An array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches
1510
+ * any of the patterns, coverage information will be skipped. These pattern strings match against the full path.
1511
+ * Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally
1512
+ * ignoring all of your files in different environments that may have different root directories.
1513
+ * Example: ["<rootDir>/build/", "<rootDir>/node_modules/"]. Default: ["/node_modules/"]
1514
+ */
1515
+ coveragePathIgnorePatterns?: any[];
1516
+ /**
1517
+ * A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used.
1518
+ * Default: ["json", "lcov", "text"]
1519
+ */
1520
+ coverageReporters?: any[];
1521
+ /**
1522
+ * This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global,
1523
+ * as a glob, and as a directory or file path. If thresholds aren't met, jest will fail. Thresholds specified as a positive
1524
+ * number are taken to be the minimum percentage required. Thresholds specified as a negative number represent the maximum
1525
+ * number of uncovered entities allowed. Default: undefined
1526
+ */
1527
+ coverageThreshold?: any;
1528
+ errorOnDeprecated?: boolean;
1529
+ forceCoverageMatch?: any[];
1530
+ globals?: any;
1531
+ globalSetup?: string;
1532
+ globalTeardown?: string;
1533
+ /**
1534
+ * An array of directory names to be searched recursively up from the requiring module's location. Setting this option will
1535
+ * override the default, if you wish to still search node_modules for packages include it along with any other
1536
+ * options: ["node_modules", "bower_components"]. Default: ["node_modules"]
1537
+ */
1538
+ moduleDirectories?: string[];
1539
+ /**
1540
+ * An array of file extensions your modules use. If you require modules without specifying a file extension,
1541
+ * these are the extensions Jest will look for. Default: ['ts', 'tsx', 'js', 'json']
1542
+ */
1543
+ moduleFileExtensions?: string[];
1544
+ moduleNameMapper?: any;
1545
+ modulePaths?: any[];
1546
+ modulePathIgnorePatterns?: any[];
1547
+ notify?: boolean;
1548
+ notifyMode?: string;
1549
+ preset?: string;
1550
+ prettierPath?: string;
1551
+ projects?: any;
1552
+ reporters?: any;
1553
+ resetMocks?: boolean;
1554
+ resetModules?: boolean;
1555
+ resolver?: string;
1556
+ restoreMocks?: string;
1557
+ rootDir?: string;
1558
+ roots?: any[];
1559
+ runner?: string;
1560
+ /**
1561
+ * The paths to modules that run some code to configure or set up the testing environment before each test.
1562
+ * Since every test runs in its own environment, these scripts will be executed in the testing environment
1563
+ * immediately before executing the test code itself. Default: []
1564
+ */
1565
+ setupFiles?: string[];
1566
+ setupFilesAfterEnv?: string[];
1567
+ snapshotSerializers?: any[];
1568
+ testEnvironment?: string;
1569
+ testEnvironmentOptions?: any;
1570
+ testMatch?: string[];
1571
+ testPathIgnorePatterns?: string[];
1572
+ testPreset?: string;
1573
+ testRegex?: string;
1574
+ testResultsProcessor?: string;
1575
+ testRunner?: string;
1576
+ testURL?: string;
1577
+ timers?: string;
1578
+ transform?: {
1579
+ [key: string]: string;
1580
+ };
1581
+ transformIgnorePatterns?: any[];
1582
+ unmockedModulePathPatterns?: any[];
1583
+ verbose?: boolean;
1584
+ watchPathIgnorePatterns?: any[];
1585
+ }
1586
+ export interface TestingConfig extends JestConfig {
1587
+ /**
1588
+ * The `allowableMismatchedPixels` value is used to determine an acceptable
1589
+ * number of pixels that can be mismatched before the image is considered
1590
+ * to have changes. Realistically, two screenshots representing the same
1591
+ * content may have a small number of pixels that are not identical due to
1592
+ * anti-aliasing, which is perfectly normal. If the `allowableMismatchedRatio`
1593
+ * is provided it will take precedence, otherwise `allowableMismatchedPixels`
1594
+ * will be used.
1595
+ */
1596
+ allowableMismatchedPixels?: number;
1597
+ /**
1598
+ * The `allowableMismatchedRatio` ranges from `0` to `1` and is used to
1599
+ * determine an acceptable ratio of pixels that can be mismatched before
1600
+ * the image is considered to have changes. Realistically, two screenshots
1601
+ * representing the same content may have a small number of pixels that
1602
+ * are not identical due to anti-aliasing, which is perfectly normal. The
1603
+ * `allowableMismatchedRatio` is the number of pixels that were mismatched,
1604
+ * divided by the total number of pixels in the screenshot. For example,
1605
+ * a ratio value of `0.06` means 6% of the pixels can be mismatched before
1606
+ * the image is considered to have changes. If the `allowableMismatchedRatio`
1607
+ * is provided it will take precedence, otherwise `allowableMismatchedPixels`
1608
+ * will be used.
1609
+ */
1610
+ allowableMismatchedRatio?: number;
1611
+ /**
1612
+ * Matching threshold while comparing two screenshots. Value ranges from `0` to `1`.
1613
+ * Smaller values make the comparison more sensitive. The `pixelmatchThreshold`
1614
+ * value helps to ignore anti-aliasing. Default: `0.1`
1615
+ */
1616
+ pixelmatchThreshold?: number;
1617
+ /**
1618
+ * Additional arguments to pass to the browser instance.
1619
+ */
1620
+ browserArgs?: string[];
1621
+ /**
1622
+ * Path to a Chromium or Chrome executable to run instead of the bundled Chromium.
1623
+ */
1624
+ browserExecutablePath?: string;
1625
+ /**
1626
+ * Url of remote Chrome instance to use instead of local Chrome.
1627
+ */
1628
+ browserWSEndpoint?: string;
1629
+ /**
1630
+ * Whether to run browser e2e tests in headless mode. Defaults to true.
1631
+ */
1632
+ browserHeadless?: boolean;
1633
+ /**
1634
+ * Slows down e2e browser operations by the specified amount of milliseconds.
1635
+ * Useful so that you can see what is going on.
1636
+ */
1637
+ browserSlowMo?: number;
1638
+ /**
1639
+ * By default, all E2E pages wait until the "load" event, this global setting can be used
1640
+ * to change the default `waitUntil` behavior.
1641
+ */
1642
+ browserWaitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
1643
+ /**
1644
+ * Whether to auto-open a DevTools panel for each tab.
1645
+ * If this option is true, the headless option will be set false
1646
+ */
1647
+ browserDevtools?: boolean;
1648
+ /**
1649
+ * Array of browser emulations to be using during e2e tests. A full e2e
1650
+ * test is ran for each emulation.
1651
+ */
1652
+ emulate?: EmulateConfig[];
1653
+ /**
1654
+ * Path to the Screenshot Connector module.
1655
+ */
1656
+ screenshotConnector?: string;
1657
+ /**
1658
+ * Amount of time in milliseconds to wait before a screenshot is taken.
1659
+ */
1660
+ waitBeforeScreenshot?: number;
1661
+ }
1662
+ export interface EmulateConfig {
1663
+ /**
1664
+ * Predefined device descriptor name, such as "iPhone X" or "Nexus 10".
1665
+ * For a complete list please see: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
1666
+ */
1667
+ device?: string;
1668
+ /**
1669
+ * User-Agent to be used. Defaults to the user-agent of the installed Puppeteer version.
1670
+ */
1671
+ userAgent?: string;
1672
+ viewport?: EmulateViewport;
1673
+ }
1674
+ export interface EmulateViewport {
1675
+ /**
1676
+ * Page width in pixels.
1677
+ */
1678
+ width: number;
1679
+ /**
1680
+ * page height in pixels.
1681
+ */
1682
+ height: number;
1683
+ /**
1684
+ * Specify device scale factor (can be thought of as dpr). Defaults to 1.
1685
+ */
1686
+ deviceScaleFactor?: number;
1687
+ /**
1688
+ * Whether the meta viewport tag is taken into account. Defaults to false.
1689
+ */
1690
+ isMobile?: boolean;
1691
+ /**
1692
+ * Specifies if viewport supports touch events. Defaults to false
1693
+ */
1694
+ hasTouch?: boolean;
1695
+ /**
1696
+ * Specifies if viewport is in landscape mode. Defaults to false.
1697
+ */
1698
+ isLandscape?: boolean;
1699
+ }
1700
+ /**
1701
+ * This sets the log level hierarchy for our terminal logger, ranging from
1702
+ * most to least verbose.
1703
+ *
1704
+ * Ordering the levels like this lets us easily check whether we should log a
1705
+ * message at a given time. For instance, if the log level is set to `'warn'`,
1706
+ * then anything passed to the logger with level `'warn'` or `'error'` should
1707
+ * be logged, but we should _not_ log anything with level `'info'` or `'debug'`.
1708
+ *
1709
+ * If we have a current log level `currentLevel` and a message with level
1710
+ * `msgLevel` is passed to the logger, we can determine whether or not we should
1711
+ * log it by checking if the log level on the message is further up or at the
1712
+ * same level in the hierarchy than `currentLevel`, like so:
1713
+ *
1714
+ * ```ts
1715
+ * LOG_LEVELS.indexOf(msgLevel) >= LOG_LEVELS.indexOf(currentLevel)
1716
+ * ```
1717
+ *
1718
+ * NOTE: for the reasons described above, do not change the order of the entries
1719
+ * in this array without good reason!
1720
+ */
1721
+ export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
1722
+ export type LogLevel = (typeof LOG_LEVELS)[number];
1723
+ /**
1724
+ * Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
1725
+ * NodeJS based console logging and colors, and the web will use browser based
1726
+ * logs and colors.
1727
+ */
1728
+ export interface Logger {
1729
+ enableColors: (useColors: boolean) => void;
1730
+ setLevel: (level: LogLevel) => void;
1731
+ getLevel: () => LogLevel;
1732
+ debug: (...msg: any[]) => void;
1733
+ info: (...msg: any[]) => void;
1734
+ warn: (...msg: any[]) => void;
1735
+ error: (...msg: any[]) => void;
1736
+ createTimeSpan: (startMsg: string, debug?: boolean, appendTo?: string[]) => LoggerTimeSpan;
1737
+ printDiagnostics: (diagnostics: Diagnostic[], cwd?: string) => void;
1738
+ red: (msg: string) => string;
1739
+ green: (msg: string) => string;
1740
+ yellow: (msg: string) => string;
1741
+ blue: (msg: string) => string;
1742
+ magenta: (msg: string) => string;
1743
+ cyan: (msg: string) => string;
1744
+ gray: (msg: string) => string;
1745
+ bold: (msg: string) => string;
1746
+ dim: (msg: string) => string;
1747
+ bgRed: (msg: string) => string;
1748
+ emoji: (e: string) => string;
1749
+ setLogFilePath?: (p: string) => void;
1750
+ writeLogs?: (append: boolean) => void;
1751
+ createLineUpdater?: () => Promise<LoggerLineUpdater>;
1752
+ }
1753
+ export interface LoggerLineUpdater {
1754
+ update(text: string): Promise<void>;
1755
+ stop(): Promise<void>;
1756
+ }
1757
+ export interface LoggerTimeSpan {
1758
+ duration(): number;
1759
+ finish(finishedMsg: string, color?: string, bold?: boolean, newLineSuffix?: boolean): number;
1760
+ }
1761
+ export interface OutputTargetDist extends OutputTargetBase {
1762
+ type: 'dist';
1763
+ buildDir?: string;
1764
+ dir?: string;
1765
+ collectionDir?: string | null;
1766
+ /**
1767
+ * When `true` this flag will transform aliased import paths defined in
1768
+ * a project's `tsconfig.json` to relative import paths in the compiled output's
1769
+ * `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
1770
+ *
1771
+ * Paths will be left in aliased format if `false` or `undefined`.
1772
+ *
1773
+ * @example
1774
+ * // tsconfig.json
1775
+ * {
1776
+ * paths: {
1777
+ * "@utils/*": ['/src/utils/*']
1778
+ * }
1779
+ * }
1780
+ *
1781
+ * // Source file
1782
+ * import * as dateUtils from '@utils/date-utils';
1783
+ * // Output file
1784
+ * import * as dateUtils from '../utils/date-utils';
1785
+ */
1786
+ transformAliasedImportPathsInCollection?: boolean | null;
1787
+ typesDir?: string;
1788
+ esmLoaderPath?: string;
1789
+ copy?: CopyTask[];
1790
+ polyfills?: boolean;
1791
+ empty?: boolean;
1792
+ }
1793
+ export interface OutputTargetDistCollection extends OutputTargetBase {
1794
+ type: 'dist-collection';
1795
+ empty?: boolean;
1796
+ dir: string;
1797
+ collectionDir: string;
1798
+ /**
1799
+ * When `true` this flag will transform aliased import paths defined in
1800
+ * a project's `tsconfig.json` to relative import paths in the compiled output.
1801
+ *
1802
+ * Paths will be left in aliased format if `false` or `undefined`.
1803
+ *
1804
+ * @example
1805
+ * // tsconfig.json
1806
+ * {
1807
+ * paths: {
1808
+ * "@utils/*": ['/src/utils/*']
1809
+ * }
1810
+ * }
1811
+ *
1812
+ * // Source file
1813
+ * import * as dateUtils from '@utils/date-utils';
1814
+ * // Output file
1815
+ * import * as dateUtils from '../utils/date-utils';
1816
+ */
1817
+ transformAliasedImportPaths?: boolean | null;
1818
+ }
1819
+ export interface OutputTargetDistTypes extends OutputTargetBase {
1820
+ type: 'dist-types';
1821
+ dir: string;
1822
+ typesDir: string;
1823
+ }
1824
+ export interface OutputTargetDistLazy extends OutputTargetBase {
1825
+ type: 'dist-lazy';
1826
+ dir?: string;
1827
+ esmDir?: string;
1828
+ esmEs5Dir?: string;
1829
+ systemDir?: string;
1830
+ cjsDir?: string;
1831
+ polyfills?: boolean;
1832
+ isBrowserBuild?: boolean;
1833
+ esmIndexFile?: string;
1834
+ cjsIndexFile?: string;
1835
+ systemLoaderFile?: string;
1836
+ legacyLoaderFile?: string;
1837
+ empty?: boolean;
1838
+ }
1839
+ export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
1840
+ type: 'dist-global-styles';
1841
+ file: string;
1842
+ }
1843
+ export interface OutputTargetDistLazyLoader extends OutputTargetBase {
1844
+ type: 'dist-lazy-loader';
1845
+ dir: string;
1846
+ esmDir: string;
1847
+ esmEs5Dir?: string;
1848
+ cjsDir: string;
1849
+ componentDts: string;
1850
+ empty: boolean;
1851
+ }
1852
+ export interface OutputTargetHydrate extends OutputTargetBase {
1853
+ type: 'dist-hydrate-script';
1854
+ dir?: string;
1855
+ /**
1856
+ * Module IDs that should not be bundled into the script.
1857
+ * By default, all node builtin's, such as `fs` or `path`
1858
+ * will be considered "external" and not bundled.
1859
+ */
1860
+ external?: string[];
1861
+ empty?: boolean;
1862
+ }
1863
+ export interface OutputTargetCustom extends OutputTargetBase {
1864
+ type: 'custom';
1865
+ name: string;
1866
+ validate?: (config: Config, diagnostics: Diagnostic[]) => void;
1867
+ generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1868
+ copy?: CopyTask[];
1869
+ }
1870
+ /**
1871
+ * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
1872
+ * file.
1873
+ */
1874
+ export interface OutputTargetDocsVscode extends OutputTargetBase {
1875
+ /**
1876
+ * Designates this output target to be used for generating VS Code custom data.
1877
+ * @see OutputTargetBase#type
1878
+ */
1879
+ type: 'docs-vscode';
1880
+ /**
1881
+ * The location on disk to write the JSON file.
1882
+ */
1883
+ file: string;
1884
+ /**
1885
+ * A base URL to find the source code of the component(s) described in the JSON file.
1886
+ */
1887
+ sourceCodeBaseUrl?: string;
1888
+ }
1889
+ export interface OutputTargetDocsReadme extends OutputTargetBase {
1890
+ type: 'docs-readme';
1891
+ dir?: string;
1892
+ dependencies?: boolean;
1893
+ footer?: string;
1894
+ strict?: boolean;
1895
+ }
1896
+ export interface OutputTargetDocsJson extends OutputTargetBase {
1897
+ type: 'docs-json';
1898
+ file: string;
1899
+ /**
1900
+ * Set an optional file path where Rindo should write a `d.ts` file to disk
1901
+ * at build-time containing type declarations for {@link JsonDocs} and related
1902
+ * interfaces. If this is omitted or set to `null` Rindo will not write such
1903
+ * a file.
1904
+ */
1905
+ typesFile?: string | null;
1906
+ strict?: boolean;
1907
+ }
1908
+ export interface OutputTargetDocsCustom extends OutputTargetBase {
1909
+ type: 'docs-custom';
1910
+ generator: (docs: JsonDocs, config: Config) => void | Promise<void>;
1911
+ strict?: boolean;
1912
+ }
1913
+ export interface OutputTargetStats extends OutputTargetBase {
1914
+ type: 'stats';
1915
+ file?: string;
1916
+ }
1917
+ export interface OutputTargetBaseNext {
1918
+ type: string;
1919
+ dir?: string;
1920
+ }
1921
+ /**
1922
+ * The collection of valid export behaviors.
1923
+ * Used to generate a type for typed configs as well as output target validation
1924
+ * for the `dist-custom-elements` output target.
1925
+ *
1926
+ * Adding a value to this const array will automatically add it as a valid option on the
1927
+ * output target configuration for `customElementsExportBehavior`.
1928
+ *
1929
+ * - `default`: No additional export or definition behavior will happen.
1930
+ * - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
1931
+ * functionality allows consumers to bypass the explicit call to define a component, its children, its children's
1932
+ * children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
1933
+ * - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
1934
+ * from `dist-custom-elements-bundle` to `dist-custom-elements`.
1935
+ * - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
1936
+ */
1937
+ export declare const CustomElementsExportBehaviorOptions: readonly ["default", "auto-define-custom-elements", "bundle", "single-export-module"];
1938
+ /**
1939
+ * This type is auto-generated based on the values in `CustomElementsExportBehaviorOptions` array.
1940
+ * This is used on the output target config for intellisense in typed configs.
1941
+ */
1942
+ export type CustomElementsExportBehavior = (typeof CustomElementsExportBehaviorOptions)[number];
1943
+ export interface OutputTargetDistCustomElements extends OutputTargetBaseNext {
1944
+ type: 'dist-custom-elements';
1945
+ empty?: boolean;
1946
+ /**
1947
+ * Triggers the following behaviors when enabled:
1948
+ * 1. All `@rindo/core/*` module references are treated as external during bundling.
1949
+ * 2. File names are not hashed.
1950
+ * 3. File minification will follow the behavior defined at the root of the Rindo config.
1951
+ */
1952
+ externalRuntime?: boolean;
1953
+ copy?: CopyTask[];
1954
+ includeGlobalScripts?: boolean;
1955
+ minify?: boolean;
1956
+ /**
1957
+ * Enables the generation of type definition files for the output target.
1958
+ */
1959
+ generateTypeDeclarations?: boolean;
1960
+ /**
1961
+ * Define the export/definition behavior for the output target's generated output.
1962
+ * This controls if/how custom elements will be defined or where components will be exported from.
1963
+ * If omitted, no auto-definition behavior or re-exporting will happen.
1964
+ */
1965
+ customElementsExportBehavior?: CustomElementsExportBehavior;
1966
+ }
1967
+ export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNext {
1968
+ type: 'dist-custom-elements-bundle';
1969
+ empty?: boolean;
1970
+ externalRuntime?: boolean;
1971
+ copy?: CopyTask[];
1972
+ includeGlobalScripts?: boolean;
1973
+ minify?: boolean;
1974
+ }
1975
+ /**
1976
+ * The base type for output targets. All output targets should extend this base type.
1977
+ */
1978
+ export interface OutputTargetBase {
1979
+ /**
1980
+ * A unique string to differentiate one output target from another
1981
+ */
1982
+ type: string;
1983
+ }
1984
+ export type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
1985
+ export interface OutputTargetCopy extends OutputTargetBase {
1986
+ type: 'copy';
1987
+ dir: string;
1988
+ copy?: CopyTask[];
1989
+ copyAssets?: 'collection' | 'dist';
1990
+ }
1991
+ export interface OutputTargetWww extends OutputTargetBase {
1992
+ /**
1993
+ * Webapp output target.
1994
+ */
1995
+ type: 'www';
1996
+ /**
1997
+ * The directory to write the app's JavaScript and CSS build
1998
+ * files to. The default is to place this directory as a child
1999
+ * to the `dir` config. Default: `build`
2000
+ */
2001
+ buildDir?: string;
2002
+ /**
2003
+ * The directory to write the entire application to.
2004
+ * Note, the `buildDir` is where the app's JavaScript and CSS build
2005
+ * files are written. Default: `www`
2006
+ */
2007
+ dir?: string;
2008
+ /**
2009
+ * Empty the build directory of all files and directories on first build.
2010
+ * Default: `true`
2011
+ */
2012
+ empty?: boolean;
2013
+ /**
2014
+ * The default index html file of the app, commonly found at the
2015
+ * root of the `src` directory.
2016
+ * Default: `index.html`
2017
+ */
2018
+ indexHtml?: string;
2019
+ /**
2020
+ * The copy config is an array of objects that defines any files or folders that should
2021
+ * be copied over to the build directory.
2022
+ *
2023
+ * Each object in the array must include a src property which can be either an absolute path,
2024
+ * a relative path or a glob pattern. The config can also provide an optional dest property
2025
+ * which can be either an absolute path or a path relative to the build directory.
2026
+ * Also note that any files within src/assets are automatically copied to www/assets for convenience.
2027
+ *
2028
+ * In the copy config below, it will copy the entire directory from src/docs-content over to www/docs-content.
2029
+ */
2030
+ copy?: CopyTask[];
2031
+ /**
2032
+ * The base url of the app, it's required during prerendering to be the absolute path
2033
+ * of your app, such as: `https://my.app.com/app`.
2034
+ *
2035
+ * Default: `/`
2036
+ */
2037
+ baseUrl?: string;
2038
+ /**
2039
+ * By default, rindo will include all the polyfills required by legacy browsers in the ES5 build.
2040
+ * If it's `false`, rindo will not emit this polyfills anymore and it's your responsibility to provide them before
2041
+ * rindo initializes.
2042
+ */
2043
+ polyfills?: boolean;
2044
+ /**
2045
+ * Path to an external node module which has exports of the prerender config object.
2046
+ * ```
2047
+ * module.exports = {
2048
+ * afterHydrate(document, url) {
2049
+ * document.title = `URL: ${url.href}`;
2050
+ * }
2051
+ * }
2052
+ * ```
2053
+ */
2054
+ prerenderConfig?: string;
2055
+ /**
2056
+ * Service worker config for production builds. During development builds
2057
+ * service worker script will be injected to automatically unregister existing
2058
+ * service workers. When set to `false` neither a service worker registration
2059
+ * or unregistration will be added to the index.html.
2060
+ */
2061
+ serviceWorker?: ServiceWorkerConfig | null | false;
2062
+ appDir?: string;
2063
+ }
2064
+ export type OutputTarget = OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistCustomElementsBundle | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
2065
+ export interface ServiceWorkerConfig {
2066
+ unregister?: boolean;
2067
+ swDest?: string;
2068
+ swSrc?: string;
2069
+ globPatterns?: string[];
2070
+ globDirectory?: string | string[];
2071
+ globIgnores?: string | string[];
2072
+ templatedUrls?: any;
2073
+ maximumFileSizeToCacheInBytes?: number;
2074
+ manifestTransforms?: any;
2075
+ modifyUrlPrefix?: any;
2076
+ dontCacheBustURLsMatching?: RegExp;
2077
+ navigateFallback?: string;
2078
+ navigateFallbackWhitelist?: RegExp[];
2079
+ navigateFallbackBlacklist?: RegExp[];
2080
+ cacheId?: string;
2081
+ skipWaiting?: boolean;
2082
+ clientsClaim?: boolean;
2083
+ directoryIndex?: string;
2084
+ runtimeCaching?: any[];
2085
+ ignoreUrlParametersMatching?: any[];
2086
+ handleFetch?: boolean;
2087
+ }
2088
+ export interface LoadConfigInit {
2089
+ /**
2090
+ * User config object to merge into default config and
2091
+ * config loaded from a file path.
2092
+ */
2093
+ config?: UnvalidatedConfig;
2094
+ /**
2095
+ * Absolute path to a Rindo config file. This path cannot be
2096
+ * relative and it does not resolve config files within a directory.
2097
+ */
2098
+ configPath?: string;
2099
+ logger?: Logger;
2100
+ sys?: CompilerSystem;
2101
+ /**
2102
+ * When set to true, if the "tsconfig.json" file is not found
2103
+ * it'll automatically generate and save a default tsconfig
2104
+ * within the root directory.
2105
+ */
2106
+ initTsConfig?: boolean;
2107
+ }
2108
+ /**
2109
+ * Results from an attempt to load a config. The values on this interface
2110
+ * have not yet been validated and are not ready to be used for arbitrary
2111
+ * operations around the codebase.
2112
+ */
2113
+ export interface LoadConfigResults {
2114
+ config: ValidatedConfig;
2115
+ diagnostics: Diagnostic[];
2116
+ tsconfig: {
2117
+ path: string;
2118
+ compilerOptions: any;
2119
+ files: string[];
2120
+ include: string[];
2121
+ exclude: string[];
2122
+ extends: string;
2123
+ };
2124
+ }
2125
+ export interface Diagnostic {
2126
+ absFilePath?: string | undefined;
2127
+ code?: string;
2128
+ columnNumber?: number | undefined;
2129
+ debugText?: string;
2130
+ header?: string;
2131
+ language?: string;
2132
+ level: 'error' | 'warn' | 'info' | 'log' | 'debug';
2133
+ lineNumber?: number | undefined;
2134
+ lines: PrintLine[];
2135
+ messageText: string;
2136
+ relFilePath?: string | undefined;
2137
+ type: string;
2138
+ }
2139
+ export interface CacheStorage {
2140
+ get(key: string): Promise<any>;
2141
+ set(key: string, value: any): Promise<void>;
2142
+ }
2143
+ export interface WorkerOptions {
2144
+ maxConcurrentWorkers?: number;
2145
+ maxConcurrentTasksPerWorker?: number;
2146
+ logger?: Logger;
2147
+ }
2148
+ export interface RollupInterface {
2149
+ rollup: {
2150
+ (config: any): Promise<any>;
2151
+ };
2152
+ plugins: {
2153
+ nodeResolve(opts: any): any;
2154
+ replace(opts: any): any;
2155
+ commonjs(opts: any): any;
2156
+ json(): any;
2157
+ };
2158
+ }
2159
+ export interface ResolveModuleOptions {
2160
+ manuallyResolve?: boolean;
2161
+ packageJson?: boolean;
2162
+ }
2163
+ export interface PrerenderStartOptions {
2164
+ buildId?: string;
2165
+ hydrateAppFilePath: string;
2166
+ componentGraph: BuildResultsComponentGraph;
2167
+ srcIndexHtmlPath: string;
2168
+ }
2169
+ export interface PrerenderResults {
2170
+ buildId: string;
2171
+ diagnostics: Diagnostic[];
2172
+ urls: number;
2173
+ duration: number;
2174
+ average: number;
2175
+ }
2176
+ /**
2177
+ * Input for CSS optimization functions, including the input CSS
2178
+ * string and a few boolean options which turn on or off various
2179
+ * optimizations.
2180
+ */
2181
+ export interface OptimizeCssInput {
2182
+ input: string;
2183
+ filePath?: string;
2184
+ autoprefixer?: boolean | null | AutoprefixerOptions;
2185
+ minify?: boolean;
2186
+ sourceMap?: boolean;
2187
+ resolveUrl?: (url: string) => Promise<string> | string;
2188
+ }
2189
+ /**
2190
+ * This is not a real interface describing the options which can
2191
+ * be passed to autoprefixer, for that see the docs, here:
2192
+ * https://github.com/postcss/autoprefixer#options
2193
+ *
2194
+ * Instead, this basically just serves as a label type to track
2195
+ * that arguments are being passed consistently.
2196
+ */
2197
+ export type AutoprefixerOptions = Object;
2198
+ /**
2199
+ * Output from CSS optimization functions, wrapping up optimized
2200
+ * CSS and any diagnostics produced during optimization.
2201
+ */
2202
+ export interface OptimizeCssOutput {
2203
+ output: string;
2204
+ diagnostics: Diagnostic[];
2205
+ }
2206
+ export interface OptimizeJsInput {
2207
+ input: string;
2208
+ filePath?: string;
2209
+ target?: 'es5' | 'latest';
2210
+ pretty?: boolean;
2211
+ sourceMap?: boolean;
2212
+ }
2213
+ export interface OptimizeJsOutput {
2214
+ output: string;
2215
+ sourceMap: any;
2216
+ diagnostics: Diagnostic[];
2217
+ }
2218
+ export interface LazyRequire {
2219
+ ensure(fromDir: string, moduleIds: string[]): Promise<Diagnostic[]>;
2220
+ require(fromDir: string, moduleId: string): any;
2221
+ getModulePath(fromDir: string, moduleId: string): string;
2222
+ }
2223
+ /**
2224
+ * @deprecated This interface is no longer used by Rindo
2225
+ * TODO: Remove this interface
2226
+ */
2227
+ export interface FsWatcherItem {
2228
+ close(): void;
2229
+ }
2230
+ /**
2231
+ * @deprecated This interface is no longer used by Rindo
2232
+ * TODO: Remove this interface
2233
+ */
2234
+ export interface MakeDirectoryOptions {
2235
+ /**
2236
+ * Indicates whether parent folders should be created.
2237
+ * @default false
2238
+ */
2239
+ recursive?: boolean;
2240
+ /**
2241
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
2242
+ * @default 0o777.
2243
+ */
2244
+ mode?: number;
2245
+ }
2246
+ /**
2247
+ * @deprecated This interface is no longer used by Rindo
2248
+ * TODO: Remove this interface
2249
+ */
2250
+ export interface FsStats {
2251
+ isFile(): boolean;
2252
+ isDirectory(): boolean;
2253
+ isBlockDevice(): boolean;
2254
+ isCharacterDevice(): boolean;
2255
+ isSymbolicLink(): boolean;
2256
+ isFIFO(): boolean;
2257
+ isSocket(): boolean;
2258
+ dev: number;
2259
+ ino: number;
2260
+ mode: number;
2261
+ nlink: number;
2262
+ uid: number;
2263
+ gid: number;
2264
+ rdev: number;
2265
+ size: number;
2266
+ blksize: number;
2267
+ blocks: number;
2268
+ atime: Date;
2269
+ mtime: Date;
2270
+ ctime: Date;
2271
+ birthtime: Date;
2272
+ }
2273
+ export interface Compiler {
2274
+ build(): Promise<CompilerBuildResults>;
2275
+ createWatcher(): Promise<CompilerWatcher>;
2276
+ destroy(): Promise<void>;
2277
+ sys: CompilerSystem;
2278
+ }
2279
+ export interface CompilerWatcher extends BuildOnEvents {
2280
+ start: () => Promise<WatcherCloseResults>;
2281
+ close: () => Promise<WatcherCloseResults>;
2282
+ request: (data: CompilerRequest) => Promise<CompilerRequestResponse>;
2283
+ }
2284
+ export interface CompilerRequest {
2285
+ path?: string;
2286
+ }
2287
+ export interface WatcherCloseResults {
2288
+ exitCode: number;
2289
+ }
2290
+ export interface CompilerRequestResponse {
2291
+ path: string;
2292
+ nodeModuleId: string;
2293
+ nodeModuleVersion: string;
2294
+ nodeResolvedPath: string;
2295
+ cachePath: string;
2296
+ cacheHit: boolean;
2297
+ content: string;
2298
+ status: number;
2299
+ }
2300
+ /**
2301
+ * Options for Rindo's string-to-string transpiler
2302
+ */
2303
+ export interface TranspileOptions {
2304
+ /**
2305
+ * A component can be defined as a custom element by using `customelement`, or the
2306
+ * component class can be exported by using `module`. Default is `customelement`.
2307
+ */
2308
+ componentExport?: 'customelement' | 'module' | string | undefined;
2309
+ /**
2310
+ * Sets how and if component metadata should be assigned on the compiled
2311
+ * component output. The `compilerstatic` value will set the metadata to
2312
+ * a static `COMPILER_META` getter on the component class. This option
2313
+ * is useful for unit testing preprocessors. Default is `null`.
2314
+ */
2315
+ componentMetadata?: 'runtimestatic' | 'compilerstatic' | string | undefined;
2316
+ /**
2317
+ * The actual internal import path for any `@rindo/core` imports.
2318
+ * Default is `@rindo/core/internal/client`.
2319
+ */
2320
+ coreImportPath?: string;
2321
+ /**
2322
+ * The current working directory. Default is `/`.
2323
+ */
2324
+ currentDirectory?: string;
2325
+ /**
2326
+ * The filename of the code being compiled. Default is `module.tsx`.
2327
+ */
2328
+ file?: string;
2329
+ /**
2330
+ * Module format to use for the compiled code output, which can be either `esm` or `cjs`.
2331
+ * Default is `esm`.
2332
+ */
2333
+ module?: 'cjs' | 'esm' | string;
2334
+ /**
2335
+ * Sets how and if any properties, methods and events are proxied on the
2336
+ * component class. The `defineproperty` value sets the getters and setters
2337
+ * using Object.defineProperty. Default is `defineproperty`.
2338
+ */
2339
+ proxy?: 'defineproperty' | string | undefined;
2340
+ /**
2341
+ * How component styles should be associated to the component. The `static`
2342
+ * setting will assign the styles as a static getter on the component class.
2343
+ */
2344
+ style?: 'static' | string | undefined;
2345
+ /**
2346
+ * How style data should be added for imports. For example, the `queryparams` value
2347
+ * adds the component's tagname and encapsulation info as querystring parameter
2348
+ * to the style's import, such as `style.css?tag=my-tag&encapsulation=shadow`. This
2349
+ * style data can be used by bundlers to further optimize each component's css.
2350
+ * Set to `null` to not include the querystring parameters. Default is `queryparams`.
2351
+ */
2352
+ styleImportData?: 'queryparams' | string | undefined;
2353
+ /**
2354
+ * The JavaScript source target TypeScript should to transpile to. Values can be
2355
+ * `latest`, `esnext`, `es2017`, `es2015`, or `es5`. Defaults to `latest`.
2356
+ */
2357
+ target?: CompileTarget;
2358
+ /**
2359
+ * Create a source map. Using `inline` will inline the source map into the
2360
+ * code, otherwise the source map will be in the returned `map` property.
2361
+ * Default is `true`.
2362
+ */
2363
+ sourceMap?: boolean | 'inline';
2364
+ /**
2365
+ * Base directory to resolve non-relative module names. Same as the `baseUrl`
2366
+ * TypeScript compiler option: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
2367
+ */
2368
+ baseUrl?: string;
2369
+ /**
2370
+ * List of path mapping entries for module names to locations relative to the `baseUrl`.
2371
+ * Same as the `paths` TypeScript compiler option:
2372
+ * https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
2373
+ */
2374
+ paths?: {
2375
+ [key: string]: string[];
2376
+ };
2377
+ /**
2378
+ * Passed in Rindo Compiler System, otherwise falls back to the internal in-memory only system.
2379
+ */
2380
+ sys?: CompilerSystem;
2381
+ /**
2382
+ * This option enables the same behavior as {@link Config.transformAliasedImportPaths}, transforming paths aliased in
2383
+ * `tsconfig.json` to relative paths.
2384
+ */
2385
+ transformAliasedImportPaths?: boolean;
2386
+ }
2387
+ export type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
2388
+ export interface TranspileResults {
2389
+ code: string;
2390
+ data?: any[];
2391
+ diagnostics: Diagnostic[];
2392
+ imports?: {
2393
+ path: string;
2394
+ }[];
2395
+ inputFileExtension: string;
2396
+ inputFilePath: string;
2397
+ map: any;
2398
+ outputFilePath: string;
2399
+ }
2400
+ export interface TransformOptions {
2401
+ coreImportPath: string;
2402
+ componentExport: 'lazy' | 'module' | 'customelement' | null;
2403
+ componentMetadata: 'runtimestatic' | 'compilerstatic' | null;
2404
+ currentDirectory: string;
2405
+ file?: string;
2406
+ isolatedModules?: boolean;
2407
+ module?: 'cjs' | 'esm';
2408
+ proxy: 'defineproperty' | null;
2409
+ style: 'static' | null;
2410
+ styleImportData: 'queryparams' | null;
2411
+ target?: string;
2412
+ }
2413
+ export interface CompileScriptMinifyOptions {
2414
+ target?: CompileTarget;
2415
+ pretty?: boolean;
2416
+ }
2417
+ export interface DevServer extends BuildEmitEvents {
2418
+ address: string;
2419
+ basePath: string;
2420
+ browserUrl: string;
2421
+ protocol: string;
2422
+ port: number;
2423
+ root: string;
2424
+ close(): Promise<void>;
2425
+ }
2426
+ export interface CliInitOptions {
2427
+ args: string[];
2428
+ logger: Logger;
2429
+ sys: CompilerSystem;
2357
2430
  }