@rindo/core 2.17.2-0 → 2.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compiler/rindo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Compiler v2.17.2-0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Compiler v2.17.3 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -898,24 +898,37 @@ const buildWarn = (diagnostics) => {
898
898
  diagnostics.push(diagnostic);
899
899
  return diagnostic;
900
900
  };
901
- const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, pkgKey) => {
901
+ /**
902
+ * Create a diagnostic message suited for representing an error in a JSON
903
+ * file. This includes information about the exact lines in the JSON file which
904
+ * caused the error and the path to the file.
905
+ *
906
+ * @param compilerCtx the current compiler context
907
+ * @param diagnostics a list of diagnostics used as a return param
908
+ * @param jsonFilePath the path to the JSON file where the error occurred
909
+ * @param msg the error message
910
+ * @param jsonField the key for the field which caused the error, used for finding
911
+ * the error line in the original JSON file
912
+ * @returns a reference to the newly-created diagnostic
913
+ */
914
+ const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, jsonField) => {
902
915
  const err = buildError(diagnostics);
903
916
  err.messageText = msg;
904
917
  err.absFilePath = jsonFilePath;
905
- if (typeof pkgKey === 'string') {
918
+ if (typeof jsonField === 'string') {
906
919
  try {
907
920
  const jsonStr = compilerCtx.fs.readFileSync(jsonFilePath);
908
921
  const lines = jsonStr.replace(/\r/g, '\n').split('\n');
909
922
  for (let i = 0; i < lines.length; i++) {
910
923
  const txtLine = lines[i];
911
- const txtIndex = txtLine.indexOf(pkgKey);
924
+ const txtIndex = txtLine.indexOf(jsonField);
912
925
  if (txtIndex > -1) {
913
926
  const warnLine = {
914
927
  lineIndex: i,
915
928
  lineNumber: i + 1,
916
929
  text: txtLine,
917
930
  errorCharStart: txtIndex,
918
- errorLength: pkgKey.length,
931
+ errorLength: jsonField.length,
919
932
  };
920
933
  err.lineNumber = warnLine.lineNumber;
921
934
  err.columnNumber = txtIndex + 1;
@@ -4575,7 +4588,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4575
4588
  };
4576
4589
  };
4577
4590
 
4578
- const buildId = '20230111105534';
4591
+ const buildId = '20230111115413';
4579
4592
  const minfyJsId = 'terser5.6.1_7';
4580
4593
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.4.16_7';
4581
4594
  const parse5Version = '6.0.1';
@@ -4583,8 +4596,8 @@ const rollupVersion = '2.42.3';
4583
4596
  const sizzleVersion = '2.42.3';
4584
4597
  const terserVersion = '5.6.1';
4585
4598
  const typescriptVersion = '4.5.4';
4586
- const vermoji = '📬';
4587
- const version$3 = '2.17.2-0';
4599
+ const vermoji = '🌱';
4600
+ const version$3 = '2.17.3';
4588
4601
  const versions = {
4589
4602
  rindo: version$3,
4590
4603
  parse5: parse5Version,
@@ -16810,6 +16823,9 @@ class MockElement extends MockNode {
16810
16823
  set title(value) {
16811
16824
  this.setAttributeNS(null, 'title', value);
16812
16825
  }
16826
+ animate() {
16827
+ /**/
16828
+ }
16813
16829
  onanimationstart() {
16814
16830
  /**/
16815
16831
  }
@@ -17074,6 +17090,18 @@ class MockElement extends MockNode {
17074
17090
  onwheel() {
17075
17091
  /**/
17076
17092
  }
17093
+ requestFullscreen() {
17094
+ /**/
17095
+ }
17096
+ scrollBy() {
17097
+ /**/
17098
+ }
17099
+ scrollTo() {
17100
+ /**/
17101
+ }
17102
+ scrollIntoView() {
17103
+ /**/
17104
+ }
17077
17105
  toString(opts) {
17078
17106
  return serializeNodeToHtml(this, opts);
17079
17107
  }
@@ -55129,6 +55157,23 @@ const isMemberPrivate = (member) => {
55129
55157
  }
55130
55158
  return false;
55131
55159
  };
55160
+ /**
55161
+ * Convert a JavaScript value to the TypeScript Intermediate Representation
55162
+ * (IR) for a literal Abstract Syntax Tree (AST) node with that same value. The
55163
+ * value to convert may be a primitive type like `string`, `boolean`, etc or
55164
+ * may be an `Object`, `Array`, etc.
55165
+ *
55166
+ * Note that this function takes a param (`refs`) with a default value,
55167
+ * normally a value should _not_ be passed for this parameter since it is
55168
+ * intended to be used for recursive calls.
55169
+ *
55170
+ * @param val the value to convert
55171
+ * @param refs a set of references, used in recursive calls to avoid
55172
+ * circular references when creating object literal IR instances. **note that
55173
+ * you shouldn't pass this parameter unless you know what you're doing!**
55174
+ * @returns TypeScript IR for a literal corresponding to the JavaScript value
55175
+ * with which the function was called
55176
+ */
55132
55177
  const convertValueToLiteral = (val, refs = null) => {
55133
55178
  if (refs == null) {
55134
55179
  refs = new WeakSet();
@@ -55159,12 +55204,39 @@ const convertValueToLiteral = (val, refs = null) => {
55159
55204
  }
55160
55205
  return t.createLiteral(val);
55161
55206
  };
55207
+ /**
55208
+ * Convert a JavaScript Array instance to TypeScript's Intermediate
55209
+ * Representation (IR) for an array literal. This is done by recursively using
55210
+ * {@link convertValueToLiteral} to create a new array consisting of the
55211
+ * TypeScript IR of each element in the array to be converted, and then creating
55212
+ * the TypeScript IR for _that_ array.
55213
+ *
55214
+ * @param list the array instance to convert
55215
+ * @param refs a set of references to objects, used when converting objects to
55216
+ * avoid circular references
55217
+ * @returns TypeScript IR for the array we want to convert
55218
+ */
55162
55219
  const arrayToArrayLiteral = (list, refs) => {
55163
55220
  const newList = list.map((l) => {
55164
55221
  return convertValueToLiteral(l, refs);
55165
55222
  });
55166
55223
  return t.createArrayLiteral(newList);
55167
55224
  };
55225
+ /**
55226
+ * Convert a JavaScript object (i.e. an object existing at runtime) to the
55227
+ * corresponding TypeScript Intermediate Representation (IR)
55228
+ * ({@see ts.ObjectLiteralExpression}) for an object literal. This function
55229
+ * takes an argument holding a `WeakSet` of references to objects which is
55230
+ * used to avoid circular references. Objects that are converted in this
55231
+ * function are added to the set, and if an object is already present then an
55232
+ * `undefined` literal (in TypeScript IR) is returned instead of another
55233
+ * object literal, as continuing to convert a circular reference would, well,
55234
+ * never end!
55235
+ *
55236
+ * @param obj the JavaScript object to convert to TypeScript IR
55237
+ * @param refs a set of references to objects, used to avoid circular references
55238
+ * @returns a TypeScript object literal expression
55239
+ */
55168
55240
  const objectToObjectLiteral = (obj, refs) => {
55169
55241
  if (refs.has(obj)) {
55170
55242
  return t.createIdentifier('undefined');
@@ -56532,17 +56604,16 @@ const KEEP_IMPORTS = new Set([
56532
56604
  * which do actual work of generating the rollup configuration, creating an
56533
56605
  * entry chunk, running, the build, etc.
56534
56606
  *
56535
- * @param config the user-supplied compiler configuration we're using
56607
+ * @param config the validated compiler configuration we're using
56536
56608
  * @param compilerCtx the current compiler context
56537
56609
  * @param buildCtx the current build context
56538
56610
  * @returns an empty Promise which won't resolve until the work is done!
56539
56611
  */
56540
56612
  const outputCustomElements = async (config, compilerCtx, buildCtx) => {
56541
- var _a;
56542
56613
  if (!config.buildDist) {
56543
56614
  return;
56544
56615
  }
56545
- const outputTargets = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).filter(isOutputTargetDistCustomElements);
56616
+ const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
56546
56617
  if (outputTargets.length === 0) {
56547
56618
  return;
56548
56619
  }
@@ -56555,7 +56626,7 @@ const outputCustomElements = async (config, compilerCtx, buildCtx) => {
56555
56626
  * Get bundle options for our current build and compiler context which we'll use
56556
56627
  * to generate a Rollup build and so on.
56557
56628
  *
56558
- * @param config user-supplied Rindo configuration
56629
+ * @param config a validated Rindo configuration object
56559
56630
  * @param buildCtx the current build context
56560
56631
  * @param compilerCtx the current compiler context
56561
56632
  * @param outputTarget the outputTarget we're currently dealing with
@@ -56586,9 +56657,10 @@ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
56586
56657
  /**
56587
56658
  * Get bundle options for rollup, run the rollup build, optionally minify the
56588
56659
  * output, and write files to disk.
56589
- * @param config user-supplied Rindo configuration
56590
- * @param buildCtx the current build context
56660
+ *
56661
+ * @param config the validated Rindo configuration we're using
56591
56662
  * @param compilerCtx the current compiler context
56663
+ * @param buildCtx the current build context
56592
56664
  * @param outputTarget the outputTarget we're currently dealing with
56593
56665
  * @returns an empty promise
56594
56666
  */
@@ -60712,8 +60784,7 @@ const relDts$1 = (fromPath, dtsPath) => {
60712
60784
  * @param typesDir the path to the directory where type declarations are saved
60713
60785
  */
60714
60786
  const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, typesDir) => {
60715
- var _a;
60716
- const outputTargets = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).filter(isOutputTargetDistCustomElements);
60787
+ const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
60717
60788
  await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, typesDir, outputTarget)));
60718
60789
  };
60719
60790
  /**
@@ -62648,6 +62719,16 @@ const parseModuleImport = (config, compilerCtx, buildCtx, moduleFile, dirPath, i
62648
62719
  }
62649
62720
  };
62650
62721
 
62722
+ /**
62723
+ * Update an instance of TypeScript's Intermediate Representation (IR) for a
62724
+ * class declaration ({@link ts.ClassDeclaration}) with a static getter for the
62725
+ * compiler metadata that we produce as part of the compilation process.
62726
+ *
62727
+ * @param cmpNode an instance of the TypeScript IR for a class declaration (i.e.
62728
+ * a rindo component) to be updated
62729
+ * @param cmpMeta the component metadata corresponding to that component
62730
+ * @returns the updated typescript class declaration
62731
+ */
62651
62732
  const addComponentMetaStatic = (cmpNode, cmpMeta) => {
62652
62733
  const publicCompilerMeta = getPublicCompilerMeta(cmpMeta);
62653
62734
  const cmpMetaStaticProp = createStaticGetter('COMPILER_META', convertValueToLiteral(publicCompilerMeta));
@@ -62779,6 +62860,14 @@ const parseStaticEvents = (staticMembers) => {
62779
62860
  });
62780
62861
  };
62781
62862
 
62863
+ /**
62864
+ * Parse a list of {@link ts.ClassElement} objects representing static props
62865
+ * into a list of our own Intermediate Representation (IR) of properties on
62866
+ * components.
62867
+ *
62868
+ * @param staticMembers TypeScript IR for the properties on our component
62869
+ * @returns a manifest of compiler properties in our own Rindo IR
62870
+ */
62782
62871
  const parseStaticProps = (staticMembers) => {
62783
62872
  const parsedProps = getStaticValue(staticMembers, 'properties');
62784
62873
  if (!parsedProps) {
@@ -63015,7 +63104,22 @@ const setComponentBuildConditionals = (cmpMeta) => {
63015
63104
  !cmpMeta.hasMember && !cmpMeta.hasStyle && !cmpMeta.hasLifecycle && !cmpMeta.hasListener && !cmpMeta.hasVdomRender;
63016
63105
  };
63017
63106
 
63018
- const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, nodeMap, transformOpts) => {
63107
+ /**
63108
+ * Given an instance of TypeScript's Intermediate Representation (IR) for a
63109
+ * class declaration ({@see ts.ClassDeclaration}) which represents a Rindo
63110
+ * component class declaration, parse and format various pieces of data about
63111
+ * static class members which we use in the compilation process
63112
+ *
63113
+ * @param compilerCtx the current compiler context
63114
+ * @param typeChecker a TypeScript type checker instance
63115
+ * @param cmpNode the TypeScript class declaration for the component
63116
+ * @param moduleFile Rindo's IR for a module, used here as an out param
63117
+ * @param transformOpts options which control various aspects of the
63118
+ * transformation
63119
+ * @returns the TypeScript class declaration IR instance with which the
63120
+ * function was called
63121
+ */
63122
+ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, transformOpts) => {
63019
63123
  if (cmpNode.members == null) {
63020
63124
  return cmpNode;
63021
63125
  }
@@ -63132,7 +63236,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
63132
63236
  // add to module map
63133
63237
  moduleFile.cmps.push(cmp);
63134
63238
  // add to node map
63135
- nodeMap.set(cmpNode, cmp);
63239
+ compilerCtx.nodeMap.set(cmpNode, cmp);
63136
63240
  return cmpNode;
63137
63241
  };
63138
63242
  const parseVirtualProps = (docs) => {
@@ -63200,7 +63304,7 @@ const updateModule = (config, compilerCtx, buildCtx, tsSourceFile, sourceFileTex
63200
63304
  compilerCtx.changedModules.add(moduleFile.sourceFilePath);
63201
63305
  const visitNode = (node) => {
63202
63306
  if (t.isClassDeclaration(node)) {
63203
- parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, compilerCtx.nodeMap);
63307
+ parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile);
63204
63308
  return;
63205
63309
  }
63206
63310
  else if (t.isImportDeclaration(node)) {
@@ -63361,6 +63465,15 @@ const outputServiceWorkers = async (config, buildCtx) => {
63361
63465
  }
63362
63466
  };
63363
63467
 
63468
+ /**
63469
+ * Validate the package.json file for a project, checking that various fields
63470
+ * are set correctly for the currently-configured output targets.
63471
+ *
63472
+ * @param config the user-supplied Rindo config
63473
+ * @param compilerCtx the compiler context
63474
+ * @param buildCtx the build context
63475
+ * @returns an empty Promise
63476
+ */
63364
63477
  const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
63365
63478
  if (config.watch) {
63366
63479
  return;
@@ -63368,26 +63481,41 @@ const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
63368
63481
  if (buildCtx.packageJson == null) {
63369
63482
  return;
63370
63483
  }
63371
- const outputTargets = config.outputTargets.filter(isOutputTargetDistCollection);
63484
+ const distCollectionOutputTargets = config.outputTargets.filter(isOutputTargetDistCollection);
63372
63485
  const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes);
63373
63486
  await Promise.all([
63374
- ...outputTargets.map((outputsTarget) => {
63375
- return validatePackageJsonOutput(config, compilerCtx, buildCtx, outputsTarget);
63376
- }),
63377
- ...typesOutputTargets.map((outputTarget) => {
63378
- return validateTypes(config, compilerCtx, buildCtx, outputTarget);
63379
- }),
63487
+ ...distCollectionOutputTargets.map((distCollectionOT) => validateDistCollectionPkgJson(config, compilerCtx, buildCtx, distCollectionOT)),
63488
+ ...typesOutputTargets.map((typesOT) => validateTypes(config, compilerCtx, buildCtx, typesOT)),
63489
+ validateModule(config, compilerCtx, buildCtx),
63380
63490
  ]);
63381
63491
  };
63382
- const validatePackageJsonOutput = async (config, compilerCtx, buildCtx, outputTarget) => {
63492
+ /**
63493
+ * Validate package.json contents for the `DIST_COLLECTION` output target,
63494
+ * checking that various fields like `files`, `main`, and so on are set
63495
+ * correctly.
63496
+ *
63497
+ * @param config the rindo config
63498
+ * @param compilerCtx the current compiler context
63499
+ * @param buildCtx the current build context
63500
+ * @param outputTarget a DIST_COLLECTION output target
63501
+ */
63502
+ const validateDistCollectionPkgJson = async (config, compilerCtx, buildCtx, outputTarget) => {
63383
63503
  await Promise.all([
63384
63504
  validatePackageFiles(config, compilerCtx, buildCtx, outputTarget),
63385
63505
  validateMain(config, compilerCtx, buildCtx, outputTarget),
63386
- validateModule(config, compilerCtx, buildCtx, outputTarget),
63387
63506
  validateCollection$1(config, compilerCtx, buildCtx, outputTarget),
63388
63507
  validateBrowser(config, compilerCtx, buildCtx),
63389
63508
  ]);
63390
63509
  };
63510
+ /**
63511
+ * Validate that the `files` field in `package.json` contains directories and
63512
+ * files that are necessary for the `DIST_COLLECTION` output target.
63513
+ *
63514
+ * @param config the rindo config
63515
+ * @param compilerCtx the current compiler context
63516
+ * @param buildCtx the current build context
63517
+ * @param outputTarget a DIST_COLLECTION output target
63518
+ */
63391
63519
  const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget) => {
63392
63520
  if (!config.devMode && Array.isArray(buildCtx.packageJson.files)) {
63393
63521
  const actualDistDir = normalizePath$1(relative$1(config.rootDir, outputTarget.dir));
@@ -63411,6 +63539,15 @@ const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget)
63411
63539
  }));
63412
63540
  }
63413
63541
  };
63542
+ /**
63543
+ * Check that the `main` field is set correctly in `package.json` for the
63544
+ * `DIST_COLLECTION` output target.
63545
+ *
63546
+ * @param config the rindo config
63547
+ * @param compilerCtx the current compiler context
63548
+ * @param buildCtx the current build context
63549
+ * @param outputTarget a DIST_COLLECTION output target
63550
+ */
63414
63551
  const validateMain = (config, compilerCtx, buildCtx, outputTarget) => {
63415
63552
  const mainAbs = join(outputTarget.dir, 'index.cjs.js');
63416
63553
  const mainRel = relative$1(config.rootDir, mainAbs);
@@ -63423,26 +63560,71 @@ const validateMain = (config, compilerCtx, buildCtx, outputTarget) => {
63423
63560
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"main"`);
63424
63561
  }
63425
63562
  };
63426
- const validateModule = (config, compilerCtx, buildCtx, outputTarget) => {
63427
- const customElementsOutput = config.outputTargets.find(isOutputTargetDistCustomElementsBundle);
63563
+ /**
63564
+ * Validate the package.json 'module' field, taking into account output targets
63565
+ * and other configuration details. This will look for a value for the `module`
63566
+ * field. If not present it will set a relevant warning message with an
63567
+ * output-target specific recommended value. If it is present and is not equal
63568
+ * to that recommended value it will set a different warning message.
63569
+ *
63570
+ * @param config the current user-supplied configuration
63571
+ * @param compilerCtx the compiler context
63572
+ * @param buildCtx the build context
63573
+ * @returns an empty Promise
63574
+ */
63575
+ const validateModule = async (config, compilerCtx, buildCtx) => {
63428
63576
  const currentModule = buildCtx.packageJson.module;
63429
- const distAbs = join(outputTarget.dir, 'index.js');
63430
- const distRel = relative$1(config.rootDir, distAbs);
63431
- let recommendedRelPath = distRel;
63432
- if (customElementsOutput) {
63433
- const customElementsAbs = join(customElementsOutput.dir, 'index.js');
63434
- recommendedRelPath = relative$1(config.rootDir, customElementsAbs);
63435
- }
63577
+ const recommendedRelPath = recommendedModulePath(config);
63436
63578
  if (!isString$1(currentModule)) {
63437
- const msg = `package.json "module" property is required when generating a distribution. It's recommended to set the "module" property to: ${recommendedRelPath}`;
63579
+ let msg = 'package.json "module" property is required when generating a distribution.';
63580
+ if (recommendedRelPath !== null) {
63581
+ msg += ` It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
63582
+ }
63438
63583
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
63584
+ return;
63439
63585
  }
63440
- else if (normalizePath$1(currentModule) !== normalizePath$1(recommendedRelPath) &&
63441
- normalizePath$1(currentModule) !== normalizePath$1(distRel)) {
63442
- const msg = `package.json "module" property is set to "${currentModule}". It's recommended to set the "module" property to: ${recommendedRelPath}`;
63586
+ if (recommendedRelPath !== null && normalizePath$1(recommendedRelPath) !== normalizePath$1(currentModule)) {
63587
+ const msg = `package.json "module" property is set to "${currentModule}". It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
63443
63588
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
63444
63589
  }
63445
63590
  };
63591
+ // TODO: Investigate the hierarchy of these output targets
63592
+ /**
63593
+ * Get the recommended `"module"` path for `package.json` given the output
63594
+ * targets that a user has set on their config.
63595
+ *
63596
+ * @param config the user-supplied Rindo configuration
63597
+ * @returns a recommended module path or a null value to indicate no default
63598
+ * value is supplied
63599
+ */
63600
+ function recommendedModulePath(config) {
63601
+ const customElementsBundleOT = config.outputTargets.find(isOutputTargetDistCustomElementsBundle);
63602
+ const customElementsOT = config.outputTargets.find(isOutputTargetDistCustomElements);
63603
+ const distCollectionOT = config.outputTargets.find(isOutputTargetDistCollection);
63604
+ if (distCollectionOT) {
63605
+ return relative$1(config.rootDir, join(distCollectionOT.dir, 'index.js'));
63606
+ }
63607
+ if (customElementsOT) {
63608
+ const componentsIndexAbs = join(customElementsOT.dir, 'index.js');
63609
+ return relative$1(config.rootDir, componentsIndexAbs);
63610
+ }
63611
+ if (customElementsBundleOT) {
63612
+ const customElementsAbs = join(customElementsBundleOT.dir, 'index.js');
63613
+ return relative$1(config.rootDir, customElementsAbs);
63614
+ }
63615
+ // if no output target for which we define a recommended output target is set
63616
+ // we return `null`
63617
+ return null;
63618
+ }
63619
+ /**
63620
+ * Check that the `types` field is set correctly in `package.json` for the
63621
+ * `DIST_COLLECTION` output target.
63622
+ *
63623
+ * @param config the rindo config
63624
+ * @param compilerCtx the current compiler context
63625
+ * @param buildCtx the current build context
63626
+ * @param outputTarget a DIST_COLLECTION output target
63627
+ */
63446
63628
  const validateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
63447
63629
  const typesAbs = getComponentsDtsTypesFilePath(outputTarget);
63448
63630
  const recommendedPath = relative$1(config.rootDir, typesAbs);
@@ -63466,6 +63648,15 @@ const validateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
63466
63648
  }
63467
63649
  }
63468
63650
  };
63651
+ /**
63652
+ * Check that the `collection` field is set correctly in `package.json` for the
63653
+ * `DIST_COLLECTION` output target.
63654
+ *
63655
+ * @param config the rindo config
63656
+ * @param compilerCtx the current compiler context
63657
+ * @param buildCtx the current build context
63658
+ * @param outputTarget a DIST_COLLECTION output target
63659
+ */
63469
63660
  const validateCollection$1 = (config, compilerCtx, buildCtx, outputTarget) => {
63470
63661
  if (outputTarget.collectionDir) {
63471
63662
  const collectionRel = join(relative$1(config.rootDir, outputTarget.collectionDir), COLLECTION_MANIFEST_FILE_NAME);
@@ -63475,19 +63666,51 @@ const validateCollection$1 = (config, compilerCtx, buildCtx, outputTarget) => {
63475
63666
  }
63476
63667
  }
63477
63668
  };
63669
+ /**
63670
+ * Check that the `browser` field is set correctly in `package.json` for the
63671
+ * `DIST_COLLECTION` output target.
63672
+ *
63673
+ * @param config the rindo config
63674
+ * @param compilerCtx the current compiler context
63675
+ * @param buildCtx the current build context
63676
+ */
63478
63677
  const validateBrowser = (config, compilerCtx, buildCtx) => {
63479
63678
  if (isString$1(buildCtx.packageJson.browser)) {
63480
63679
  const msg = `package.json "browser" property is set to "${buildCtx.packageJson.browser}". However, for maximum compatibility with all bundlers it's recommended to not set the "browser" property and instead ensure both "module" and "main" properties are set.`;
63481
63680
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"browser"`);
63482
63681
  }
63483
63682
  };
63484
- const packageJsonError = (config, compilerCtx, buildCtx, msg, warnKey) => {
63485
- const err = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, warnKey);
63683
+ /**
63684
+ * Build a diagnostic for an error resulting from a particular field in a
63685
+ * package.json file
63686
+ *
63687
+ * @param config the rindo config
63688
+ * @param compilerCtx the current compiler context
63689
+ * @param buildCtx the current build context
63690
+ * @param msg an error string
63691
+ * @param jsonField the key for the field which caused the error, used for
63692
+ * finding the error line in the original JSON file
63693
+ * @returns a diagnostic object
63694
+ */
63695
+ const packageJsonError = (config, compilerCtx, buildCtx, msg, jsonField) => {
63696
+ const err = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
63486
63697
  err.header = `Package Json`;
63487
63698
  return err;
63488
63699
  };
63489
- const packageJsonWarn = (config, compilerCtx, buildCtx, msg, warnKey) => {
63490
- const warn = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, warnKey);
63700
+ /**
63701
+ * Build a diagnostic for a warning resulting from a particular field in a
63702
+ * package.json file
63703
+ *
63704
+ * @param config the rindo config
63705
+ * @param compilerCtx the current compiler context
63706
+ * @param buildCtx the current build context
63707
+ * @param msg an error string
63708
+ * @param jsonField the key for the field which caused the error, used for
63709
+ * finding the error line in the original JSON file
63710
+ * @returns a diagnostic object
63711
+ */
63712
+ const packageJsonWarn = (config, compilerCtx, buildCtx, msg, jsonField) => {
63713
+ const warn = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
63491
63714
  warn.header = `Package Json`;
63492
63715
  warn.level = 'warn';
63493
63716
  return warn;
@@ -64968,12 +65191,15 @@ const createConfigFlags = (init = {}) => {
64968
65191
  };
64969
65192
 
64970
65193
  const getConfig = (userConfig) => {
64971
- var _a, _b;
65194
+ var _a, _b, _c, _d;
64972
65195
  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 };
64974
- if (!config.sys) {
64975
- config.sys = createSystem({ logger: config.logger });
64976
- }
65196
+ const config = {
65197
+ ...userConfig,
65198
+ flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}),
65199
+ logger,
65200
+ outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
65201
+ sys: (_d = userConfig.sys) !== null && _d !== void 0 ? _d : createSystem({ logger }),
65202
+ };
64977
65203
  setPlatformPath(config.sys.platformPath);
64978
65204
  if (config.flags.debug || config.flags.verbose) {
64979
65205
  config.logLevel = 'debug';
@@ -65679,7 +65905,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65679
65905
  const dependencies = [
65680
65906
  {
65681
65907
  name: "@rindo/core",
65682
- version: "2.17.2-0",
65908
+ version: "2.17.3",
65683
65909
  main: "compiler/rindo.js",
65684
65910
  resources: [
65685
65911
  "package.json",
@@ -67032,7 +67258,8 @@ const validateWorkers = (config) => {
67032
67258
  * @returns an object with config and diagnostics props
67033
67259
  */
67034
67260
  const validateConfig = (userConfig = {}, bootstrapConfig) => {
67035
- const config = Object.assign({}, userConfig || {}); // not positive it's json safe
67261
+ var _a, _b, _c;
67262
+ const config = Object.assign({}, userConfig); // not positive it's json safe
67036
67263
  const diagnostics = [];
67037
67264
  const logger = bootstrapConfig.logger || config.logger || createLogger();
67038
67265
  const validatedConfig = {
@@ -67040,6 +67267,8 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
67040
67267
  // flags _should_ be JSON safe
67041
67268
  flags: JSON.parse(JSON.stringify(config.flags || {})),
67042
67269
  logger,
67270
+ outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
67271
+ sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
67043
67272
  };
67044
67273
  // default devMode false
67045
67274
  if (validatedConfig.flags.prod) {
@@ -67306,6 +67535,7 @@ const hasRindoConfigInclude = (includeProp) => Array.isArray(includeProp) && inc
67306
67535
  * @public
67307
67536
  */
67308
67537
  const loadConfig = async (init = {}) => {
67538
+ var _a;
67309
67539
  const results = {
67310
67540
  config: null,
67311
67541
  diagnostics: [],
@@ -67320,9 +67550,12 @@ const loadConfig = async (init = {}) => {
67320
67550
  };
67321
67551
  const unknownConfig = {};
67322
67552
  try {
67323
- const sys = init.sys || createSystem();
67324
67553
  const config = init.config || {};
67325
67554
  let configPath = init.configPath || config.configPath;
67555
+ // Pull the {@link CompilerSystem} out of the initialization object, or create one if it does not exist.
67556
+ // This entity is needed to load the project's configuration (and therefore needs to be created before it can be
67557
+ // attached to a configuration entity, validated or otherwise)
67558
+ const sys = (_a = init.sys) !== null && _a !== void 0 ? _a : createSystem();
67326
67559
  const loadedConfigFile = await loadConfigFile(sys, results.diagnostics, configPath);
67327
67560
  if (hasError(results.diagnostics)) {
67328
67561
  return results;
@@ -67615,7 +67848,7 @@ const convertStaticToMeta = (config, compilerCtx, buildCtx, typeChecker, collect
67615
67848
  let moduleFile;
67616
67849
  const visitNode = (node) => {
67617
67850
  if (t.isClassDeclaration(node)) {
67618
- return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, compilerCtx.nodeMap, transformOpts);
67851
+ return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, transformOpts);
67619
67852
  }
67620
67853
  else if (t.isImportDeclaration(node)) {
67621
67854
  parseModuleImport(config, compilerCtx, buildCtx, moduleFile, dirPath, node, !transformOpts.isolatedModules);