@rindo/core 2.17.0 → 2.17.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 (49) hide show
  1. package/cli/config-flags.d.ts +110 -0
  2. package/cli/index.cjs +612 -220
  3. package/cli/index.d.ts +2 -1
  4. package/cli/index.js +612 -220
  5. package/cli/package.json +1 -1
  6. package/compiler/package.json +1 -1
  7. package/compiler/rindo.js +391 -178
  8. package/compiler/rindo.min.js +2 -2
  9. package/dependencies.json +1 -1
  10. package/dev-server/client/index.js +1 -1
  11. package/dev-server/client/package.json +1 -1
  12. package/dev-server/connector.html +2 -2
  13. package/dev-server/index.js +1 -1
  14. package/dev-server/package.json +1 -1
  15. package/dev-server/server-process.js +2 -2
  16. package/internal/app-data/package.json +1 -1
  17. package/internal/client/css-shim.js +1 -1
  18. package/internal/client/dom.js +1 -1
  19. package/internal/client/index.js +11 -6
  20. package/internal/client/package.json +1 -1
  21. package/internal/client/patch-browser.js +1 -1
  22. package/internal/client/patch-esm.js +1 -1
  23. package/internal/client/shadow-css.js +1 -1
  24. package/internal/hydrate/index.js +2 -2
  25. package/internal/hydrate/package.json +1 -1
  26. package/internal/package.json +1 -1
  27. package/internal/rindo-private.d.ts +2 -2
  28. package/internal/rindo-public-compiler.d.ts +67 -48
  29. package/internal/testing/index.js +1 -1
  30. package/internal/testing/package.json +1 -1
  31. package/mock-doc/index.cjs +26 -3
  32. package/mock-doc/index.d.ts +10 -0
  33. package/mock-doc/index.js +26 -3
  34. package/mock-doc/package.json +1 -1
  35. package/package.json +5 -3
  36. package/screenshot/package.json +1 -1
  37. package/sys/node/index.js +4 -4
  38. package/sys/node/package.json +1 -1
  39. package/sys/node/worker.js +1 -1
  40. package/testing/index.d.ts +1 -1
  41. package/testing/index.js +49 -25
  42. package/testing/jest/jest-config.d.ts +1 -1
  43. package/testing/jest/jest-runner.d.ts +3 -2
  44. package/testing/jest/jest-screenshot.d.ts +1 -1
  45. package/testing/mocks.d.ts +27 -2
  46. package/testing/package.json +1 -1
  47. package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
  48. package/testing/testing-utils.d.ts +74 -2
  49. package/testing/testing.d.ts +2 -2
package/compiler/rindo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Compiler v2.17.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Compiler v2.17.2-0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -727,12 +727,27 @@ const trimFalsy = (data) => {
727
727
  return arr;
728
728
  };
729
729
 
730
- const toLowerCase = (str) => str.toLowerCase();
731
- const toDashCase = (str) => toLowerCase(str
732
- .replace(/([A-Z0-9])/g, (g) => ' ' + g[0])
730
+ /**
731
+ * Convert a string from PascalCase to dash-case
732
+ *
733
+ * @param str the string to convert
734
+ * @returns a converted string
735
+ */
736
+ const toDashCase = (str) => str
737
+ .replace(/([A-Z0-9])/g, (match) => ` ${match[0]}`)
733
738
  .trim()
734
- .replace(/ /g, '-'));
735
- const dashToPascalCase$1 = (str) => toLowerCase(str)
739
+ .split(' ')
740
+ .join('-')
741
+ .toLowerCase();
742
+ /**
743
+ * Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
744
+ * or whatever you call it!)
745
+ *
746
+ * @param str a string to convert
747
+ * @returns a converted string
748
+ */
749
+ const dashToPascalCase$1 = (str) => str
750
+ .toLowerCase()
736
751
  .split('-')
737
752
  .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
738
753
  .join('');
@@ -789,8 +804,8 @@ const pluck = (obj, keys) => {
789
804
  return final;
790
805
  }, {});
791
806
  };
792
- const isBoolean$1 = (v) => typeof v === 'boolean';
793
807
  const isDefined = (v) => v !== null && v !== undefined;
808
+ const isBoolean$1 = (v) => typeof v === 'boolean';
794
809
  const isFunction = (v) => typeof v === 'function';
795
810
  const isNumber$1 = (v) => typeof v === 'number';
796
811
  const isObject$4 = (val) => val != null && typeof val === 'object' && Array.isArray(val) === false;
@@ -1631,7 +1646,7 @@ const isDtsFile$1 = (filePath) => {
1631
1646
  /**
1632
1647
  * Generate the preamble to be placed atop the main file of the build
1633
1648
  * @param config the Rindo configuration file
1634
- * @return the generated preamble
1649
+ * @returns the generated preamble
1635
1650
  */
1636
1651
  const generatePreamble = (config) => {
1637
1652
  const { preamble } = config;
@@ -2026,10 +2041,14 @@ const buildEvents = () => {
2026
2041
  };
2027
2042
  };
2028
2043
 
2044
+ /**
2045
+ * Creates an instance of a logger
2046
+ * @returns the new logger instance
2047
+ */
2029
2048
  const createLogger = () => {
2030
2049
  let useColors = IS_BROWSER_ENV;
2031
2050
  let level = 'info';
2032
- const logger = {
2051
+ return {
2033
2052
  enableColors: (uc) => (useColors = uc),
2034
2053
  getLevel: () => level,
2035
2054
  setLevel: (l) => (level = l),
@@ -2056,7 +2075,6 @@ const createLogger = () => {
2056
2075
  diagnostics.forEach((diagnostic) => logDiagnostic(diagnostic, useColors));
2057
2076
  },
2058
2077
  };
2059
- return logger;
2060
2078
  };
2061
2079
  const logDiagnostic = (diagnostic, useColors) => {
2062
2080
  let color = BLUE;
@@ -2346,8 +2364,16 @@ const getPackageDirPath = (p, moduleId) => {
2346
2364
  return null;
2347
2365
  };
2348
2366
 
2367
+ /**
2368
+ * A fetch wrapper which dispatches to `sys.fetch` if present, and otherwise
2369
+ * uses `global.fetch`.
2370
+ *
2371
+ * @param sys a compiler system object
2372
+ * @param input a `RequestInfo` object
2373
+ * @param init an optional `RequestInit` object
2374
+ * @returns a Promise wrapping a response
2375
+ */
2349
2376
  const httpFetch = (sys, input, init) => {
2350
- console.trace(input);
2351
2377
  if (sys && isFunction(sys.fetch)) {
2352
2378
  return sys.fetch(input, init);
2353
2379
  }
@@ -2355,10 +2381,16 @@ const httpFetch = (sys, input, init) => {
2355
2381
  };
2356
2382
  const packageVersions = new Map();
2357
2383
  const known404Urls = new Set();
2358
- const getRindoRootUrl = (compilerExe) => new URL('../', compilerExe).href;
2359
- const getRindoModuleUrl = (compilerExe, p) => {
2360
- p = normalizePath$1(p);
2361
- let parts = p.split('/');
2384
+ /**
2385
+ * Get the URL for a Rindo module given the path to the compiler
2386
+ *
2387
+ * @param compilerExe the path to the compiler executable
2388
+ * @param path the path to the module or file in question
2389
+ * @returns a URL for the file of interest
2390
+ */
2391
+ const getRindoModuleUrl = (compilerExe, path) => {
2392
+ path = normalizePath$1(path);
2393
+ let parts = path.split('/');
2362
2394
  const nmIndex = parts.lastIndexOf('node_modules');
2363
2395
  if (nmIndex > -1 && nmIndex < parts.length - 1) {
2364
2396
  parts = parts.slice(nmIndex + 1);
@@ -2368,9 +2400,10 @@ const getRindoModuleUrl = (compilerExe, p) => {
2368
2400
  else {
2369
2401
  parts = parts.slice(1);
2370
2402
  }
2371
- p = parts.join('/');
2403
+ path = parts.join('/');
2372
2404
  }
2373
- return new URL('./' + p, getRindoRootUrl(compilerExe)).href;
2405
+ const rindoRootUrl = new URL('../', compilerExe).href;
2406
+ return new URL('./' + path, rindoRootUrl).href;
2374
2407
  };
2375
2408
  const getCommonDirUrl = (sys, pkgVersions, dirPath, fileName) => getNodeModuleFetchUrl(sys, pkgVersions, dirPath) + '/' + fileName;
2376
2409
  const getNodeModuleFetchUrl = (sys, pkgVersions, filePath) => {
@@ -4542,7 +4575,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4542
4575
  };
4543
4576
  };
4544
4577
 
4545
- const buildId = '20220812090622';
4578
+ const buildId = '20230111105534';
4546
4579
  const minfyJsId = 'terser5.6.1_7';
4547
4580
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.4.16_7';
4548
4581
  const parse5Version = '6.0.1';
@@ -4550,8 +4583,8 @@ const rollupVersion = '2.42.3';
4550
4583
  const sizzleVersion = '2.42.3';
4551
4584
  const terserVersion = '5.6.1';
4552
4585
  const typescriptVersion = '4.5.4';
4553
- const vermoji = '🏉';
4554
- const version$3 = '2.17.0';
4586
+ const vermoji = '📬';
4587
+ const version$3 = '2.17.2-0';
4555
4588
  const versions = {
4556
4589
  rindo: version$3,
4557
4590
  parse5: parse5Version,
@@ -5100,6 +5133,17 @@ const createSystem = (c) => {
5100
5133
  };
5101
5134
 
5102
5135
  let cssProcessor;
5136
+ /**
5137
+ * Autoprefix a CSS string, adding vendor prefixes to make sure that what
5138
+ * is written in the CSS will render correctly in our range of supported browsers.
5139
+ * This function uses PostCSS in compbination with the Autoprefix plugin to
5140
+ * automatically add vendor prefixes based on a list of browsers which we want
5141
+ * to support.
5142
+ *
5143
+ * @param cssText the text to be prefixed
5144
+ * @param opts an optional param with options for Autoprefixer
5145
+ * @returns a Promise wrapping some prefixed CSS as well as diagnostics
5146
+ */
5103
5147
  const autoprefixCss = async (cssText, opts) => {
5104
5148
  const output = {
5105
5149
  output: cssText,
@@ -5109,7 +5153,7 @@ const autoprefixCss = async (cssText, opts) => {
5109
5153
  return output;
5110
5154
  }
5111
5155
  try {
5112
- const autoprefixerOpts = opts != null && typeof opts === 'object' ? opts : DEFAULT_AUTOPREFIX_LEGACY;
5156
+ const autoprefixerOpts = opts != null && typeof opts === 'object' ? opts : DEFAULT_AUTOPREFIX_OPTIONS;
5113
5157
  const processor = getProcessor(autoprefixerOpts);
5114
5158
  const result = await processor.process(cssText, { map: null });
5115
5159
  result.warnings().forEach((warning) => {
@@ -5165,6 +5209,12 @@ const autoprefixCss = async (cssText, opts) => {
5165
5209
  }
5166
5210
  return output;
5167
5211
  };
5212
+ /**
5213
+ * Get the processor for PostCSS and the Autoprefixer plugin
5214
+ *
5215
+ * @param autoprefixerOpts Options for Autoprefixer
5216
+ * @returns postCSS with the Autoprefixer plugin applied
5217
+ */
5168
5218
  const getProcessor = (autoprefixerOpts) => {
5169
5219
  const { postcss, autoprefixer } = requireFunc('../sys/node/autoprefixer.js');
5170
5220
  if (!cssProcessor) {
@@ -5172,7 +5222,19 @@ const getProcessor = (autoprefixerOpts) => {
5172
5222
  }
5173
5223
  return cssProcessor;
5174
5224
  };
5175
- const DEFAULT_AUTOPREFIX_LEGACY = {
5225
+ /**
5226
+ * Default options for the Autoprefixer PostCSS plugin. See the documentation:
5227
+ * https://github.com/postcss/autoprefixer#options for a complete list.
5228
+ *
5229
+ * This default option set will:
5230
+ *
5231
+ * - override the default browser list (`overrideBrowserslist`)
5232
+ * - turn off the visual cascade (`cascade`)
5233
+ * - disable auto-removing outdated prefixes (`remove`)
5234
+ * - set `flexbox` to `"no-2009"`, which limits prefixing for flexbox to the
5235
+ * final and IE 10 versions of the specification
5236
+ */
5237
+ const DEFAULT_AUTOPREFIX_OPTIONS = {
5176
5238
  overrideBrowserslist: ['last 2 versions', 'iOS >= 9', 'Android >= 4.4', 'Explorer >= 11', 'ExplorerMobile >= 11'],
5177
5239
  cascade: false,
5178
5240
  remove: false,
@@ -5968,6 +6030,13 @@ const resolveStylesheetUrl = async (nodes, resolveUrl, resolved) => {
5968
6030
  }
5969
6031
  };
5970
6032
 
6033
+ /**
6034
+ * Optimize a CSS file, optionally running an autoprefixer and a minifier
6035
+ * depending on the options set on the input options argument.
6036
+ *
6037
+ * @param inputOpts input CSS options
6038
+ * @returns a promise wrapping the optimized output
6039
+ */
5971
6040
  const optimizeCss$1 = async (inputOpts) => {
5972
6041
  let result = {
5973
6042
  output: inputOpts.input,
@@ -12026,6 +12095,12 @@ const parseImportPath = (importPath) => {
12026
12095
  return parsedPath;
12027
12096
  };
12028
12097
 
12098
+ /**
12099
+ * Strip out comments from some CSS
12100
+ *
12101
+ * @param input the string we'd like to de-comment
12102
+ * @returns de-commented CSS!
12103
+ */
12029
12104
  const stripCssComments = (input) => {
12030
12105
  let isInsideString = null;
12031
12106
  let currentCharacter = '';
@@ -15385,6 +15460,25 @@ class MockMouseEvent extends MockEvent {
15385
15460
  }
15386
15461
  }
15387
15462
  }
15463
+ class MockUIEvent extends MockEvent {
15464
+ constructor(type, uiEventInitDic) {
15465
+ super(type);
15466
+ this.detail = null;
15467
+ this.view = null;
15468
+ if (uiEventInitDic != null) {
15469
+ Object.assign(this, uiEventInitDic);
15470
+ }
15471
+ }
15472
+ }
15473
+ class MockFocusEvent extends MockUIEvent {
15474
+ constructor(type, focusEventInitDic) {
15475
+ super(type);
15476
+ this.relatedTarget = null;
15477
+ if (focusEventInitDic != null) {
15478
+ Object.assign(this, focusEventInitDic);
15479
+ }
15480
+ }
15481
+ }
15388
15482
  class MockEventListener {
15389
15483
  constructor(type, handler) {
15390
15484
  this.type = type;
@@ -16299,7 +16393,7 @@ class MockElement extends MockNode {
16299
16393
  return shadowRoot;
16300
16394
  }
16301
16395
  blur() {
16302
- /**/
16396
+ dispatchEvent(this, new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
16303
16397
  }
16304
16398
  get shadowRoot() {
16305
16399
  return this.__shadowRoot || null;
@@ -16369,7 +16463,9 @@ class MockElement extends MockNode {
16369
16463
  get firstElementChild() {
16370
16464
  return this.children[0] || null;
16371
16465
  }
16372
- focus(_options) { }
16466
+ focus(_options) {
16467
+ dispatchEvent(this, new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
16468
+ }
16373
16469
  getAttribute(attrName) {
16374
16470
  if (attrName === 'style') {
16375
16471
  if (this.__style != null && this.__style.length > 0) {
@@ -18019,6 +18115,7 @@ const GLOBAL_CONSTRUCTORS = [
18019
18115
  ['CustomEvent', MockCustomEvent],
18020
18116
  ['Event', MockEvent],
18021
18117
  ['Headers', MockHeaders],
18118
+ ['FocusEvent', MockFocusEvent],
18022
18119
  ['KeyboardEvent', MockKeyboardEvent],
18023
18120
  ['MouseEvent', MockMouseEvent],
18024
18121
  ['Request', MockRequest],
@@ -19350,48 +19447,88 @@ const emptyOutputTargets = async (config, compilerCtx, buildCtx) => {
19350
19447
  timeSpan.finish('cleaning dirs finished');
19351
19448
  };
19352
19449
 
19450
+ /**
19451
+ * Parse CSS imports into an object which contains a manifest of imports and a
19452
+ * stylesheet with all imports resolved and concatenated.
19453
+ *
19454
+ * @param config the current config
19455
+ * @param compilerCtx the compiler context (we need filesystem access)
19456
+ * @param buildCtx the build context, we'll need access to diagnostics
19457
+ * @param srcFilePath the source filepath
19458
+ * @param resolvedFilePath the resolved filepath
19459
+ * @param styleText style text we start with
19460
+ * @param styleDocs optional array of style document objects
19461
+ * @returns an object with concatenated styleText and imports
19462
+ */
19353
19463
  const parseCssImports = async (config, compilerCtx, buildCtx, srcFilePath, resolvedFilePath, styleText, styleDocs) => {
19354
19464
  const isCssEntry = resolvedFilePath.toLowerCase().endsWith('.css');
19355
19465
  const allCssImports = [];
19356
- const concatStyleText = await updateCssImports(config, compilerCtx, buildCtx, isCssEntry, srcFilePath, resolvedFilePath, styleText, allCssImports, new Set(), styleDocs);
19466
+ // a Set of previously-resolved file paths that we add to as we traverse the
19467
+ // import tree (to avoid a possible circular dependency and infinite loop)
19468
+ const resolvedFilePaths = new Set();
19469
+ const concatStyleText = await resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText);
19357
19470
  return {
19358
19471
  imports: allCssImports,
19359
19472
  styleText: concatStyleText,
19360
19473
  };
19361
- };
19362
- const updateCssImports = async (config, compilerCtx, buildCtx, isCssEntry, srcFilePath, resolvedFilePath, styleText, allCssImports, noLoop, styleDocs) => {
19363
- if (noLoop.has(resolvedFilePath)) {
19364
- return styleText;
19365
- }
19366
- noLoop.add(resolvedFilePath);
19367
- if (styleDocs != null) {
19368
- parseStyleDocs(styleDocs, styleText);
19369
- }
19370
- const cssImports = await getCssImports(config, compilerCtx, buildCtx, resolvedFilePath, styleText);
19371
- if (cssImports.length === 0) {
19372
- return styleText;
19373
- }
19374
- for (const cssImport of cssImports) {
19375
- if (!allCssImports.includes(cssImport.filePath)) {
19376
- allCssImports.push(cssImport.filePath);
19474
+ /**
19475
+ * Resolve and flatten all imports for a given CSS file, recursively crawling
19476
+ * the tree of imports to resolve them all and produce a concatenated
19477
+ * stylesheet. We declare this function here, within `parseCssImports`, in order
19478
+ * to get access to `compilerCtx`, `buildCtx`, and more without having to pass
19479
+ * a whole bunch of arguments.
19480
+ *
19481
+ * @param srcFilePath the source filepath
19482
+ * @param resolvedFilePath the resolved filepath
19483
+ * @param styleText style text we start with*
19484
+ * @returns concatenated styles assembled from the various imported stylesheets
19485
+ */
19486
+ async function resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText) {
19487
+ // if we've seen this path before we early return
19488
+ if (resolvedFilePaths.has(resolvedFilePath)) {
19489
+ return styleText;
19490
+ }
19491
+ resolvedFilePaths.add(resolvedFilePath);
19492
+ if (styleDocs != null) {
19493
+ parseStyleDocs(styleDocs, styleText);
19494
+ }
19495
+ const cssImports = await getCssImports(config, compilerCtx, buildCtx, resolvedFilePath, styleText);
19496
+ if (cssImports.length === 0) {
19497
+ return styleText;
19498
+ }
19499
+ // add any newly-found imports to the 'global' list
19500
+ for (const cssImport of cssImports) {
19501
+ if (!allCssImports.includes(cssImport.filePath)) {
19502
+ allCssImports.push(cssImport.filePath);
19503
+ }
19377
19504
  }
19378
- }
19379
- await Promise.all(cssImports.map(async (cssImportData) => {
19380
- await concatCssImport(config, compilerCtx, buildCtx, isCssEntry, srcFilePath, cssImportData, allCssImports, noLoop, styleDocs);
19381
- }));
19382
- return replaceImportDeclarations(styleText, cssImports, isCssEntry);
19383
- };
19384
- const concatCssImport = async (config, compilerCtx, buildCtx, isCssEntry, srcFilePath, cssImportData, allCssImports, noLoop, styleDocs) => {
19385
- cssImportData.styleText = await loadStyleText(compilerCtx, cssImportData);
19386
- if (typeof cssImportData.styleText === 'string') {
19387
- cssImportData.styleText = await updateCssImports(config, compilerCtx, buildCtx, isCssEntry, cssImportData.filePath, cssImportData.filePath, cssImportData.styleText, allCssImports, noLoop, styleDocs);
19388
- }
19389
- else {
19390
- const err = buildError(buildCtx.diagnostics);
19391
- err.messageText = `Unable to read css import: ${cssImportData.srcImport}`;
19392
- err.absFilePath = srcFilePath;
19505
+ // Recur down the tree of CSS imports, resolving all the imports in
19506
+ // the children of the current file (and, by extension, in their children
19507
+ // and so on)
19508
+ await Promise.all(cssImports.map(async (cssImportData) => {
19509
+ cssImportData.styleText = await loadStyleText(compilerCtx, cssImportData);
19510
+ if (typeof cssImportData.styleText === 'string') {
19511
+ cssImportData.styleText = await resolveAndFlattenImports(cssImportData.filePath, cssImportData.filePath, cssImportData.styleText);
19512
+ }
19513
+ else {
19514
+ // we had some error loading the file from disk, so write a diagnostic
19515
+ const err = buildError(buildCtx.diagnostics);
19516
+ err.messageText = `Unable to read css import: ${cssImportData.srcImport}`;
19517
+ err.absFilePath = srcFilePath;
19518
+ }
19519
+ }));
19520
+ // replace import statements with the actual CSS code in children modules
19521
+ return replaceImportDeclarations(styleText, cssImports, isCssEntry);
19393
19522
  }
19394
19523
  };
19524
+ /**
19525
+ * Load the style text for a CSS file from disk, based on the filepaths set in
19526
+ * our import data.
19527
+ *
19528
+ * @param compilerCtx the compiler context
19529
+ * @param cssImportData the import data for the file we want to read
19530
+ * @returns the contents of the file, if it can be read without error
19531
+ */
19395
19532
  const loadStyleText = async (compilerCtx, cssImportData) => {
19396
19533
  let styleText = null;
19397
19534
  try {
@@ -19407,7 +19544,18 @@ const loadStyleText = async (compilerCtx, cssImportData) => {
19407
19544
  }
19408
19545
  return styleText;
19409
19546
  };
19547
+ /**
19548
+ * Get a manifest of all the CSS imports in a given CSS file
19549
+ *
19550
+ * @param config the current config
19551
+ * @param compilerCtx the compiler context (we need the filesystem)
19552
+ * @param buildCtx the build context, in case we need to set a diagnostic
19553
+ * @param filePath the filepath we're working with
19554
+ * @param styleText the CSS for which we want to retrieve import data
19555
+ * @returns a Promise wrapping a list of CSS import data objects
19556
+ */
19410
19557
  const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText) => {
19558
+ var _a;
19411
19559
  const imports = [];
19412
19560
  if (!styleText.includes('@import')) {
19413
19561
  // no @import at all, so don't bother
@@ -19415,13 +19563,14 @@ const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText)
19415
19563
  }
19416
19564
  styleText = stripCssComments(styleText);
19417
19565
  const dir = dirname(filePath);
19418
- const importeeExt = filePath.split('.').pop().toLowerCase();
19566
+ const importeeExt = ((_a = filePath.split('.').pop()) !== null && _a !== void 0 ? _a : '').toLowerCase();
19419
19567
  let r;
19420
19568
  const IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
19421
19569
  while ((r = IMPORT_RE.exec(styleText))) {
19422
19570
  const cssImportData = {
19423
19571
  srcImport: r[0],
19424
19572
  url: r[4].replace(/[\"\'\)]/g, ''),
19573
+ filePath: '',
19425
19574
  };
19426
19575
  if (!isLocalCssImport(cssImportData.srcImport)) {
19427
19576
  // do nothing for @import url(http://external.css)
@@ -19448,7 +19597,10 @@ const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText)
19448
19597
  cssImportData.altFilePath = normalizePath$1(join(dirPath, fileName));
19449
19598
  }
19450
19599
  }
19451
- if (typeof cssImportData.filePath === 'string') {
19600
+ // we set `filePath` to `""` when the object is created above, so if it
19601
+ // hasn't been changed in the intervening conditionals then we didn't resolve
19602
+ // a filepath for it.
19603
+ if (cssImportData.filePath !== '') {
19452
19604
  imports.push(cssImportData);
19453
19605
  }
19454
19606
  }
@@ -19490,6 +19642,16 @@ const isLocalCssImport = (srcImport) => {
19490
19642
  }
19491
19643
  return true;
19492
19644
  };
19645
+ /**
19646
+ * Replace import declarations (like '@import "foobar";') with the actual CSS
19647
+ * written in the imported module, allowing us to produce a single file from a
19648
+ * tree of stylesheets.
19649
+ *
19650
+ * @param styleText the text within which we want to replace @import statements
19651
+ * @param cssImports information about imported modules
19652
+ * @param isCssEntry whether we're dealing with a CSS file
19653
+ * @returns an updated string with the requisite substitutions
19654
+ */
19493
19655
  const replaceImportDeclarations = (styleText, cssImports, isCssEntry) => {
19494
19656
  for (const cssImport of cssImports) {
19495
19657
  if (isCssEntry) {
@@ -42299,7 +42461,7 @@ const createCustomResolverSync = (sys, inMemoryFs, exts) => {
42299
42461
  * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d121716ed123957f6a86f8985eb013fcaddab345/types/node/globals.d.ts#L183-L188
42300
42462
  * in mind.
42301
42463
  * @param err the entity to check the type of
42302
- * @return true if the provided value is an instance of `ErrnoException`, `false` otherwise
42464
+ * @returns true if the provided value is an instance of `ErrnoException`, `false` otherwise
42303
42465
  */
42304
42466
  function isErrnoException(err) {
42305
42467
  return err instanceof Error && err.hasOwnProperty('code');
@@ -56515,7 +56677,7 @@ const addCustomElementInputs = (buildCtx, bundleOpts) => {
56515
56677
  exp.push(`import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';`);
56516
56678
  exp.push(`export const ${exportName} = ${importAs};`);
56517
56679
  exp.push(`export const defineCustomElement = cmpDefCustomEle;`);
56518
- // Here we push an export (with a rename for `defineCustomElement` for
56680
+ // Here we push an export (with a rename for `defineCustomElement`) for
56519
56681
  // this component onto our array which references the `coreKey` (prefixed
56520
56682
  // with `\0`). We have to do this so that our import is referencing the
56521
56683
  // correct virtual module, if we instead referenced, for instance,
@@ -58336,6 +58498,16 @@ const lazyComponentTransform = (compilerCtx, transformOpts) => {
58336
58498
  };
58337
58499
  };
58338
58500
 
58501
+ /**
58502
+ * Generate rollup output based on a rollup build and a series of options.
58503
+ *
58504
+ * @param build a rollup build
58505
+ * @param options output options for rollup
58506
+ * @param config a user-supplied configuration object
58507
+ * @param entryModules a list of entry modules, for checking which chunks
58508
+ * contain components
58509
+ * @returns a Promise wrapping either build results or `null`
58510
+ */
58339
58511
  const generateRollupOutput = async (build, options, config, entryModules) => {
58340
58512
  if (build == null) {
58341
58513
  return null;
@@ -58343,7 +58515,7 @@ const generateRollupOutput = async (build, options, config, entryModules) => {
58343
58515
  const { output } = await build.generate(options);
58344
58516
  return output.map((chunk) => {
58345
58517
  if (chunk.type === 'chunk') {
58346
- const isCore = Object.keys(chunk.modules).some((m) => m.includes('@rindo/core'));
58518
+ const isCore = Object.keys(chunk.modules).some((m) => m.includes(RINDO_CORE_ID));
58347
58519
  return {
58348
58520
  type: 'chunk',
58349
58521
  fileName: chunk.fileName,
@@ -58842,7 +59014,8 @@ const getSystemLoader = async (config, compilerCtx, corePath, includePolyfills)
58842
59014
 
58843
59015
  var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
58844
59016
  var start = function() {
58845
- var url = new URL('${corePath}', new URL(resourcesUrl, window.location.origin));
59017
+ // if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
59018
+ var url = new URL('${corePath}', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
58846
59019
  System.import(url.href);
58847
59020
  };
58848
59021
 
@@ -60556,7 +60729,7 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60556
60729
  // the path where we're going to write the typedef for the whole dist-custom-elements output
60557
60730
  const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
60558
60731
  // the directory where types for the individual components are written
60559
- const componentsTypeDirectoryPath = relative$1(outputTarget.dir, join(typesDir, 'components'));
60732
+ const componentsTypeDirectoryRelPath = relative$1(outputTarget.dir, typesDir);
60560
60733
  const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
60561
60734
  const code = [
60562
60735
  `/* ${config.namespace} custom elements */`,
@@ -60565,7 +60738,14 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60565
60738
  const importName = component.componentClassName;
60566
60739
  // typedefs for individual components can be found under paths like
60567
60740
  // $TYPES_DIR/components/my-component/my-component.d.ts
60568
- const componentDTSPath = join(componentsTypeDirectoryPath, component.tagName, component.tagName);
60741
+ //
60742
+ // To construct this path we:
60743
+ //
60744
+ // - get the relative path to the component's source file from the source directory
60745
+ // - join that relative path to the relative path from the `index.d.ts` file to the
60746
+ // directory where typedefs are saved
60747
+ const componentSourceRelPath = relative$1(config.srcDir, component.sourceFilePath).replace('.tsx', '');
60748
+ const componentDTSPath = join(componentsTypeDirectoryRelPath, componentSourceRelPath);
60569
60749
  return `export { ${importName} as ${exportName} } from '${componentDTSPath}';`;
60570
60750
  }),
60571
60751
  ``,
@@ -64766,16 +64946,35 @@ const updateCompilerCtxCache = (config, compilerCtx, path, kind) => {
64766
64946
  }
64767
64947
  };
64768
64948
 
64949
+ /**
64950
+ * All the Boolean options supported by the Rindo CLI
64951
+ */
64952
+ /**
64953
+ * Helper function for initializing a `ConfigFlags` object. Provide any overrides
64954
+ * for default values and off you go!
64955
+ *
64956
+ * @param init an object with any overrides for default values
64957
+ * @returns a complete CLI flag object
64958
+ */
64959
+ const createConfigFlags = (init = {}) => {
64960
+ const flags = {
64961
+ task: null,
64962
+ args: [],
64963
+ knownArgs: [],
64964
+ unknownArgs: [],
64965
+ ...init,
64966
+ };
64967
+ return flags;
64968
+ };
64969
+
64769
64970
  const getConfig = (userConfig) => {
64770
- const config = { ...userConfig };
64771
- if (!config.logger) {
64772
- config.logger = createLogger();
64773
- }
64971
+ var _a, _b;
64972
+ const logger = (_a = userConfig.logger) !== null && _a !== void 0 ? _a : createLogger();
64973
+ const config = { ...userConfig, flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}), logger };
64774
64974
  if (!config.sys) {
64775
64975
  config.sys = createSystem({ logger: config.logger });
64776
64976
  }
64777
64977
  setPlatformPath(config.sys.platformPath);
64778
- config.flags = config.flags || {};
64779
64978
  if (config.flags.debug || config.flags.verbose) {
64780
64979
  config.logLevel = 'debug';
64781
64980
  }
@@ -64796,14 +64995,15 @@ const patchFs = (userSys) => {
64796
64995
 
64797
64996
  /**
64798
64997
  * Generate a Rindo compiler instance
64799
- * @param config a Rindo configuration to apply to the compiler instance
64998
+ * @param userConfig a user-provided a Rindo configuration to apply to the compiler instance
64800
64999
  * @returns a new instance of a Rindo compiler
65000
+ * @public
64801
65001
  */
64802
- const createCompiler = async (config) => {
65002
+ const createCompiler = async (userConfig) => {
64803
65003
  // actual compiler code
64804
65004
  // could be in a web worker on the browser
64805
65005
  // or the main thread in node
64806
- config = getConfig(config);
65006
+ const config = getConfig(userConfig);
64807
65007
  const diagnostics = [];
64808
65008
  const sys = config.sys;
64809
65009
  const compilerCtx = new CompilerContext();
@@ -65479,7 +65679,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65479
65679
  const dependencies = [
65480
65680
  {
65481
65681
  name: "@rindo/core",
65482
- version: "2.17.0",
65682
+ version: "2.17.2-0",
65483
65683
  main: "compiler/rindo.js",
65484
65684
  resources: [
65485
65685
  "package.json",
@@ -65651,11 +65851,11 @@ const getUserConfigName = (config, correctConfigName) => {
65651
65851
  };
65652
65852
 
65653
65853
  const validateDevServer = (config, diagnostics) => {
65654
- var _a, _b, _c, _d, _e, _f, _g;
65854
+ var _a, _b, _c, _d, _e;
65655
65855
  if ((config.devServer === null || config.devServer) === false) {
65656
65856
  return undefined;
65657
65857
  }
65658
- const flags = (_a = config.flags) !== null && _a !== void 0 ? _a : {};
65858
+ const { flags } = config;
65659
65859
  const devServer = { ...config.devServer };
65660
65860
  if (flags.address && isString$1(flags.address)) {
65661
65861
  devServer.address = flags.address;
@@ -65713,14 +65913,14 @@ const validateDevServer = (config, diagnostics) => {
65713
65913
  if (!isBoolean$1(devServer.websocket)) {
65714
65914
  devServer.websocket = true;
65715
65915
  }
65716
- if ((_b = config === null || config === void 0 ? void 0 : config.flags) === null || _b === void 0 ? void 0 : _b.ssr) {
65916
+ if (flags.ssr) {
65717
65917
  devServer.ssr = true;
65718
65918
  }
65719
65919
  else {
65720
65920
  devServer.ssr = !!devServer.ssr;
65721
65921
  }
65722
65922
  if (devServer.ssr) {
65723
- const wwwOutput = ((_c = config.outputTargets) !== null && _c !== void 0 ? _c : []).find(isOutputTargetWww);
65923
+ const wwwOutput = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).find(isOutputTargetWww);
65724
65924
  devServer.prerenderConfig = wwwOutput === null || wwwOutput === void 0 ? void 0 : wwwOutput.prerenderConfig;
65725
65925
  }
65726
65926
  if (isString$1(config.srcIndexHtml)) {
@@ -65746,15 +65946,15 @@ const validateDevServer = (config, diagnostics) => {
65746
65946
  }
65747
65947
  let serveDir;
65748
65948
  let basePath;
65749
- const wwwOutputTarget = ((_d = config.outputTargets) !== null && _d !== void 0 ? _d : []).find(isOutputTargetWww);
65949
+ const wwwOutputTarget = ((_b = config.outputTargets) !== null && _b !== void 0 ? _b : []).find(isOutputTargetWww);
65750
65950
  if (wwwOutputTarget) {
65751
- const baseUrl = new URL((_e = wwwOutputTarget.baseUrl) !== null && _e !== void 0 ? _e : '', 'http://config-rindojs.web.app');
65951
+ const baseUrl = new URL((_c = wwwOutputTarget.baseUrl) !== null && _c !== void 0 ? _c : '', 'http://config-rindojs.web.app');
65752
65952
  basePath = baseUrl.pathname;
65753
- serveDir = (_f = wwwOutputTarget.appDir) !== null && _f !== void 0 ? _f : '';
65953
+ serveDir = (_d = wwwOutputTarget.appDir) !== null && _d !== void 0 ? _d : '';
65754
65954
  }
65755
65955
  else {
65756
65956
  basePath = '';
65757
- serveDir = (_g = config.rootDir) !== null && _g !== void 0 ? _g : '';
65957
+ serveDir = (_e = config.rootDir) !== null && _e !== void 0 ? _e : '';
65758
65958
  }
65759
65959
  if (!isString$1(basePath) || basePath.trim() === '') {
65760
65960
  basePath = `/`;
@@ -65888,11 +66088,19 @@ const validateHydrated = (config) => {
65888
66088
  return hydratedFlag;
65889
66089
  };
65890
66090
 
66091
+ /**
66092
+ * Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
66093
+ * property is set on them.
66094
+ *
66095
+ * @param config the user-supplied configuration object
66096
+ * @param userOutputs an array of output targets
66097
+ * @returns an array of validated DIST_COLLECTION output targets
66098
+ */
65891
66099
  const validateCollection = (config, userOutputs) => {
65892
- return userOutputs.filter(isOutputTargetDistCollection).map((o) => {
66100
+ return userOutputs.filter(isOutputTargetDistCollection).map((outputTarget) => {
65893
66101
  return {
65894
- ...o,
65895
- dir: getAbsolutePath(config, o.dir || 'dist/collection'),
66102
+ ...outputTarget,
66103
+ dir: getAbsolutePath(config, outputTarget.dir || 'dist/collection'),
65896
66104
  };
65897
66105
  });
65898
66106
  };
@@ -66226,7 +66434,7 @@ const validateHydrateScript = (config, userOutputs) => {
66226
66434
  // we don't already have a hydrate output target
66227
66435
  // let's still see if we require one because of other output targets
66228
66436
  const hasWwwOutput = userOutputs.filter(isOutputTargetWww).some((o) => isString$1(o.indexHtml));
66229
- const shouldBuildHydrate = (config === null || config === void 0 ? void 0 : config.flags.prerender) || (config === null || config === void 0 ? void 0 : config.flags.ssr);
66437
+ const shouldBuildHydrate = config.flags.prerender || config.flags.ssr;
66230
66438
  if (hasWwwOutput && shouldBuildHydrate) {
66231
66439
  // we're prerendering a www output target, so we'll need a hydrate app
66232
66440
  let hydrateDir;
@@ -66302,7 +66510,7 @@ const validateStats = (userConfig, userOutputs) => {
66302
66510
  };
66303
66511
 
66304
66512
  const validatePrerender = (config, diagnostics, outputTarget) => {
66305
- if (!config.flags || (!config.flags.ssr && !config.flags.prerender && config.flags.task !== 'prerender')) {
66513
+ if (!config.flags.ssr && !config.flags.prerender && config.flags.task !== 'prerender') {
66306
66514
  return;
66307
66515
  }
66308
66516
  outputTarget.baseUrl = normalizePath$1(outputTarget.baseUrl);
@@ -66327,8 +66535,6 @@ const validatePrerender = (config, diagnostics, outputTarget) => {
66327
66535
  }
66328
66536
  };
66329
66537
 
66330
- const HOST_CONFIG_FILENAME = 'host.config.json';
66331
-
66332
66538
  const validateServiceWorker = (config, outputTarget) => {
66333
66539
  if (outputTarget.serviceWorker === false) {
66334
66540
  return;
@@ -66381,14 +66587,15 @@ const validateServiceWorker = (config, outputTarget) => {
66381
66587
  }
66382
66588
  };
66383
66589
  const addGlobIgnores = (config, globIgnores) => {
66384
- globIgnores.push(`**/${HOST_CONFIG_FILENAME}`, `**/*.system.entry.js`, `**/*.system.js`, `**/${config.fsNamespace}.js`, `**/${config.fsNamespace}.esm.js`, `**/${config.fsNamespace}.css`);
66590
+ globIgnores.push(`**/host.config.json`, // the filename of the host configuration
66591
+ `**/*.system.entry.js`, `**/*.system.js`, `**/${config.fsNamespace}.js`, `**/${config.fsNamespace}.esm.js`, `**/${config.fsNamespace}.css`);
66385
66592
  };
66386
66593
  const DEFAULT_GLOB_PATTERNS = ['*.html', '**/*.{js,css,json}'];
66387
66594
  const DEFAULT_FILENAME = 'sw.js';
66388
66595
 
66389
66596
  const validateWww = (config, diagnostics, userOutputs) => {
66390
66597
  const hasOutputTargets = userOutputs.length > 0;
66391
- const hasE2eTests = !!(config.flags && config.flags.e2e);
66598
+ const hasE2eTests = !!config.flags.e2e;
66392
66599
  const userWwwOutputs = userOutputs.filter(isOutputTargetWww);
66393
66600
  if (!hasOutputTargets ||
66394
66601
  (hasE2eTests && !userOutputs.some(isOutputTargetWww) && !userOutputs.some(isOutputTargetDist))) {
@@ -66642,7 +66849,7 @@ const DEFAULT_ROLLUP_CONFIG = {
66642
66849
  const validateTesting = (config, diagnostics) => {
66643
66850
  var _a;
66644
66851
  const testing = (config.testing = Object.assign({}, config.testing || {}));
66645
- if (!config.flags || (!config.flags.e2e && !config.flags.spec)) {
66852
+ if (!config.flags.e2e && !config.flags.spec) {
66646
66853
  return;
66647
66854
  }
66648
66855
  let configPathDir = config.configPath;
@@ -66680,7 +66887,7 @@ const validateTesting = (config, diagnostics) => {
66680
66887
  else {
66681
66888
  testing.rootDir = config.rootDir;
66682
66889
  }
66683
- if (config.flags && typeof config.flags.screenshotConnector === 'string') {
66890
+ if (typeof config.flags.screenshotConnector === 'string') {
66684
66891
  testing.screenshotConnector = config.flags.screenshotConnector;
66685
66892
  }
66686
66893
  if (typeof testing.screenshotConnector === 'string') {
@@ -66802,13 +67009,11 @@ const validateWorkers = (config) => {
66802
67009
  if (typeof config.maxConcurrentWorkers !== 'number') {
66803
67010
  config.maxConcurrentWorkers = 8;
66804
67011
  }
66805
- if (config.flags) {
66806
- if (typeof config.flags.maxWorkers === 'number') {
66807
- config.maxConcurrentWorkers = config.flags.maxWorkers;
66808
- }
66809
- else if (config.flags.ci) {
66810
- config.maxConcurrentWorkers = 4;
66811
- }
67012
+ if (typeof config.flags.maxWorkers === 'number') {
67013
+ config.maxConcurrentWorkers = config.flags.maxWorkers;
67014
+ }
67015
+ else if (config.flags.ci) {
67016
+ config.maxConcurrentWorkers = 4;
66812
67017
  }
66813
67018
  config.maxConcurrentWorkers = Math.max(Math.min(config.maxConcurrentWorkers, 16), 0);
66814
67019
  if (config.devServer) {
@@ -66822,111 +67027,119 @@ const validateWorkers = (config) => {
66822
67027
  * `UnvalidatedConfig` to a `Config`.
66823
67028
  *
66824
67029
  * @param userConfig an unvalidated config that we've gotten from a user
67030
+ * @param bootstrapConfig the initial configuration provided by the user (or generated by Rindo) used to bootstrap
67031
+ * configuration loading and validation
66825
67032
  * @returns an object with config and diagnostics props
66826
67033
  */
66827
- const validateConfig = (userConfig = {}) => {
67034
+ const validateConfig = (userConfig = {}, bootstrapConfig) => {
66828
67035
  const config = Object.assign({}, userConfig || {}); // not positive it's json safe
66829
67036
  const diagnostics = [];
66830
- // copy flags (we know it'll be json safe)
66831
- config.flags = JSON.parse(JSON.stringify(config.flags || {}));
67037
+ const logger = bootstrapConfig.logger || config.logger || createLogger();
67038
+ const validatedConfig = {
67039
+ ...config,
67040
+ // flags _should_ be JSON safe
67041
+ flags: JSON.parse(JSON.stringify(config.flags || {})),
67042
+ logger,
67043
+ };
66832
67044
  // default devMode false
66833
- if (config.flags.prod) {
66834
- config.devMode = false;
66835
- }
66836
- else if (config.flags.dev) {
66837
- config.devMode = true;
66838
- }
66839
- else if (!isBoolean$1(config.devMode)) {
66840
- config.devMode = DEFAULT_DEV_MODE;
66841
- }
66842
- config.extras = config.extras || {};
66843
- config.extras.appendChildSlotFix = !!config.extras.appendChildSlotFix;
66844
- config.extras.cloneNodeFix = !!config.extras.cloneNodeFix;
66845
- config.extras.cssVarsShim = !!config.extras.cssVarsShim;
66846
- config.extras.dynamicImportShim = !!config.extras.dynamicImportShim;
66847
- config.extras.lifecycleDOMEvents = !!config.extras.lifecycleDOMEvents;
66848
- config.extras.safari10 = !!config.extras.safari10;
66849
- config.extras.scriptDataOpts = !!config.extras.scriptDataOpts;
66850
- config.extras.shadowDomShim = !!config.extras.shadowDomShim;
66851
- config.extras.slotChildNodesFix = !!config.extras.slotChildNodesFix;
66852
- config.extras.initializeNextTick = !!config.extras.initializeNextTick;
66853
- config.extras.tagNameTransform = !!config.extras.tagNameTransform;
66854
- config.buildEs5 = config.buildEs5 === true || (!config.devMode && config.buildEs5 === 'prod');
66855
- setBooleanConfig(config, 'minifyCss', null, !config.devMode);
66856
- setBooleanConfig(config, 'minifyJs', null, !config.devMode);
66857
- setBooleanConfig(config, 'sourceMap', null, typeof config.sourceMap === 'undefined' ? false : config.sourceMap);
66858
- setBooleanConfig(config, 'watch', 'watch', false);
66859
- setBooleanConfig(config, 'buildDocs', 'docs', !config.devMode);
66860
- setBooleanConfig(config, 'buildDist', 'esm', !config.devMode || config.buildEs5);
66861
- setBooleanConfig(config, 'profile', 'profile', config.devMode);
66862
- setBooleanConfig(config, 'writeLog', 'log', false);
66863
- setBooleanConfig(config, 'buildAppCore', null, true);
66864
- setBooleanConfig(config, 'autoprefixCss', null, config.buildEs5);
66865
- setBooleanConfig(config, 'validateTypes', null, !config._isTesting);
66866
- setBooleanConfig(config, 'allowInlineScripts', null, true);
66867
- if (!isString$1(config.taskQueue)) {
66868
- config.taskQueue = 'async';
67045
+ if (validatedConfig.flags.prod) {
67046
+ validatedConfig.devMode = false;
67047
+ }
67048
+ else if (validatedConfig.flags.dev) {
67049
+ validatedConfig.devMode = true;
67050
+ }
67051
+ else if (!isBoolean$1(validatedConfig.devMode)) {
67052
+ validatedConfig.devMode = DEFAULT_DEV_MODE;
67053
+ }
67054
+ validatedConfig.extras = validatedConfig.extras || {};
67055
+ validatedConfig.extras.appendChildSlotFix = !!validatedConfig.extras.appendChildSlotFix;
67056
+ validatedConfig.extras.cloneNodeFix = !!validatedConfig.extras.cloneNodeFix;
67057
+ validatedConfig.extras.cssVarsShim = !!validatedConfig.extras.cssVarsShim;
67058
+ validatedConfig.extras.dynamicImportShim = !!validatedConfig.extras.dynamicImportShim;
67059
+ validatedConfig.extras.lifecycleDOMEvents = !!validatedConfig.extras.lifecycleDOMEvents;
67060
+ validatedConfig.extras.safari10 = !!validatedConfig.extras.safari10;
67061
+ validatedConfig.extras.scriptDataOpts = !!validatedConfig.extras.scriptDataOpts;
67062
+ validatedConfig.extras.shadowDomShim = !!validatedConfig.extras.shadowDomShim;
67063
+ validatedConfig.extras.slotChildNodesFix = !!validatedConfig.extras.slotChildNodesFix;
67064
+ validatedConfig.extras.initializeNextTick = !!validatedConfig.extras.initializeNextTick;
67065
+ validatedConfig.extras.tagNameTransform = !!validatedConfig.extras.tagNameTransform;
67066
+ validatedConfig.buildEs5 =
67067
+ validatedConfig.buildEs5 === true || (!validatedConfig.devMode && validatedConfig.buildEs5 === 'prod');
67068
+ setBooleanConfig(validatedConfig, 'minifyCss', null, !validatedConfig.devMode);
67069
+ setBooleanConfig(validatedConfig, 'minifyJs', null, !validatedConfig.devMode);
67070
+ setBooleanConfig(validatedConfig, 'sourceMap', null, typeof validatedConfig.sourceMap === 'undefined' ? false : validatedConfig.sourceMap);
67071
+ setBooleanConfig(validatedConfig, 'watch', 'watch', false);
67072
+ setBooleanConfig(validatedConfig, 'buildDocs', 'docs', !validatedConfig.devMode);
67073
+ setBooleanConfig(validatedConfig, 'buildDist', 'esm', !validatedConfig.devMode || validatedConfig.buildEs5);
67074
+ setBooleanConfig(validatedConfig, 'profile', 'profile', validatedConfig.devMode);
67075
+ setBooleanConfig(validatedConfig, 'writeLog', 'log', false);
67076
+ setBooleanConfig(validatedConfig, 'buildAppCore', null, true);
67077
+ setBooleanConfig(validatedConfig, 'autoprefixCss', null, validatedConfig.buildEs5);
67078
+ setBooleanConfig(validatedConfig, 'validateTypes', null, !validatedConfig._isTesting);
67079
+ setBooleanConfig(validatedConfig, 'allowInlineScripts', null, true);
67080
+ if (!isString$1(validatedConfig.taskQueue)) {
67081
+ validatedConfig.taskQueue = 'async';
66869
67082
  }
66870
67083
  // hash file names
66871
- if (!isBoolean$1(config.hashFileNames)) {
66872
- config.hashFileNames = !config.devMode;
67084
+ if (!isBoolean$1(validatedConfig.hashFileNames)) {
67085
+ validatedConfig.hashFileNames = !validatedConfig.devMode;
66873
67086
  }
66874
- if (!isNumber$1(config.hashedFileNameLength)) {
66875
- config.hashedFileNameLength = DEFAULT_HASHED_FILENAME_LENTH;
67087
+ if (!isNumber$1(validatedConfig.hashedFileNameLength)) {
67088
+ validatedConfig.hashedFileNameLength = DEFAULT_HASHED_FILENAME_LENTH;
66876
67089
  }
66877
- if (config.hashedFileNameLength < MIN_HASHED_FILENAME_LENTH) {
67090
+ if (validatedConfig.hashedFileNameLength < MIN_HASHED_FILENAME_LENTH) {
66878
67091
  const err = buildError(diagnostics);
66879
- err.messageText = `config.hashedFileNameLength must be at least ${MIN_HASHED_FILENAME_LENTH} characters`;
67092
+ err.messageText = `validatedConfig.hashedFileNameLength must be at least ${MIN_HASHED_FILENAME_LENTH} characters`;
66880
67093
  }
66881
- if (config.hashedFileNameLength > MAX_HASHED_FILENAME_LENTH) {
67094
+ if (validatedConfig.hashedFileNameLength > MAX_HASHED_FILENAME_LENTH) {
66882
67095
  const err = buildError(diagnostics);
66883
- err.messageText = `config.hashedFileNameLength cannot be more than ${MAX_HASHED_FILENAME_LENTH} characters`;
67096
+ err.messageText = `validatedConfig.hashedFileNameLength cannot be more than ${MAX_HASHED_FILENAME_LENTH} characters`;
66884
67097
  }
66885
- if (!config.env) {
66886
- config.env = {};
67098
+ if (!validatedConfig.env) {
67099
+ validatedConfig.env = {};
66887
67100
  }
66888
67101
  // get a good namespace
66889
- validateNamespace(config, diagnostics);
67102
+ validateNamespace(validatedConfig, diagnostics);
66890
67103
  // figure out all of the config paths and absolute paths
66891
- validatePaths(config);
67104
+ validatePaths(validatedConfig);
66892
67105
  // outputTargets
66893
- validateOutputTargets(config, diagnostics);
67106
+ validateOutputTargets(validatedConfig, diagnostics);
66894
67107
  // plugins
66895
- validatePlugins(config, diagnostics);
67108
+ validatePlugins(validatedConfig, diagnostics);
66896
67109
  // rollup config
66897
- validateRollupConfig(config);
67110
+ validateRollupConfig(validatedConfig);
66898
67111
  // dev server
66899
- config.devServer = validateDevServer(config, diagnostics);
67112
+ validatedConfig.devServer = validateDevServer(validatedConfig, diagnostics);
66900
67113
  // testing
66901
- validateTesting(config, diagnostics);
67114
+ validateTesting(validatedConfig, diagnostics);
66902
67115
  // hydrate flag
66903
- config.hydratedFlag = validateHydrated(config);
67116
+ validatedConfig.hydratedFlag = validateHydrated(validatedConfig);
66904
67117
  // bundles
66905
- if (Array.isArray(config.bundles)) {
66906
- config.bundles = sortBy(config.bundles, (a) => a.components.length);
67118
+ if (Array.isArray(validatedConfig.bundles)) {
67119
+ validatedConfig.bundles = sortBy(validatedConfig.bundles, (a) => a.components.length);
66907
67120
  }
66908
67121
  else {
66909
- config.bundles = [];
67122
+ validatedConfig.bundles = [];
66910
67123
  }
66911
67124
  // validate how many workers we can use
66912
- validateWorkers(config);
67125
+ validateWorkers(validatedConfig);
66913
67126
  // default devInspector to whatever devMode is
66914
- setBooleanConfig(config, 'devInspector', null, config.devMode);
66915
- if (!config._isTesting) {
66916
- validateDistNamespace(config, diagnostics);
67127
+ setBooleanConfig(validatedConfig, 'devInspector', null, validatedConfig.devMode);
67128
+ if (!validatedConfig._isTesting) {
67129
+ validateDistNamespace(validatedConfig, diagnostics);
66917
67130
  }
66918
- setBooleanConfig(config, 'enableCache', 'cache', true);
66919
- if (!Array.isArray(config.watchIgnoredRegex) && config.watchIgnoredRegex != null) {
66920
- config.watchIgnoredRegex = [config.watchIgnoredRegex];
67131
+ setBooleanConfig(validatedConfig, 'enableCache', 'cache', true);
67132
+ if (!Array.isArray(validatedConfig.watchIgnoredRegex) && validatedConfig.watchIgnoredRegex != null) {
67133
+ validatedConfig.watchIgnoredRegex = [validatedConfig.watchIgnoredRegex];
66921
67134
  }
66922
- config.watchIgnoredRegex = (config.watchIgnoredRegex || []).reduce((arr, reg) => {
67135
+ validatedConfig.watchIgnoredRegex = (validatedConfig.watchIgnoredRegex || []).reduce((arr, reg) => {
66923
67136
  if (reg instanceof RegExp) {
66924
67137
  arr.push(reg);
66925
67138
  }
66926
67139
  return arr;
66927
67140
  }, []);
66928
67141
  return {
66929
- config,
67142
+ config: validatedConfig,
66930
67143
  diagnostics,
66931
67144
  };
66932
67145
  };
@@ -67105,6 +67318,7 @@ const loadConfig = async (init = {}) => {
67105
67318
  extends: null,
67106
67319
  },
67107
67320
  };
67321
+ const unknownConfig = {};
67108
67322
  try {
67109
67323
  const sys = init.sys || createSystem();
67110
67324
  const config = init.config || {};
@@ -67113,22 +67327,22 @@ const loadConfig = async (init = {}) => {
67113
67327
  if (hasError(results.diagnostics)) {
67114
67328
  return results;
67115
67329
  }
67116
- if (loadedConfigFile != null) {
67330
+ if (loadedConfigFile !== null) {
67117
67331
  // merge the user's config object into their loaded config file
67118
67332
  configPath = loadedConfigFile.configPath;
67119
- results.config = { ...loadedConfigFile, ...config };
67120
- results.config.configPath = configPath;
67121
- results.config.rootDir = normalizePath$1(dirname(configPath));
67333
+ unknownConfig.config = { ...loadedConfigFile, ...config };
67334
+ unknownConfig.config.configPath = configPath;
67335
+ unknownConfig.config.rootDir = normalizePath$1(dirname(configPath));
67122
67336
  }
67123
67337
  else {
67124
67338
  // no rindo.config.ts or .js file, which is fine
67125
67339
  // #0CJS ¯\_(ツ)_/¯
67126
- results.config = { ...config };
67127
- results.config.configPath = null;
67128
- results.config.rootDir = normalizePath$1(sys.getCurrentDirectory());
67340
+ unknownConfig.config = { ...config };
67341
+ unknownConfig.config.configPath = null;
67342
+ unknownConfig.config.rootDir = normalizePath$1(sys.getCurrentDirectory());
67129
67343
  }
67130
- results.config.sys = sys;
67131
- const validated = validateConfig(results.config);
67344
+ unknownConfig.config.sys = sys;
67345
+ const validated = validateConfig(unknownConfig.config, init);
67132
67346
  results.diagnostics.push(...validated.diagnostics);
67133
67347
  if (hasError(results.diagnostics)) {
67134
67348
  return results;
@@ -67143,7 +67357,6 @@ const loadConfig = async (init = {}) => {
67143
67357
  else if (typeof results.config.logLevel !== 'string') {
67144
67358
  results.config.logLevel = 'info';
67145
67359
  }
67146
- results.config.logger = init.logger || results.config.logger || createLogger();
67147
67360
  results.config.logger.setLevel(results.config.logLevel);
67148
67361
  if (!hasError(results.diagnostics)) {
67149
67362
  const tsConfigResults = await validateTsConfig(results.config, sys, init);