@rindo/core 2.17.2 → 2.17.4

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/cli/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo CLI (CommonJS) v2.17.2 | MIT Licensed | https://rindojs.web.app
2
+ Rindo CLI (CommonJS) v2.17.4 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  'use strict';
5
5
 
@@ -829,7 +829,7 @@ LOG_LEVELS.includes(maybeLogLevel);
829
829
  const dependencies = [
830
830
  {
831
831
  name: "@rindo/core",
832
- version: "2.17.2",
832
+ version: "2.17.4",
833
833
  main: "compiler/rindo.js",
834
834
  resources: [
835
835
  "package.json",
@@ -937,6 +937,11 @@ const dependencies = [
937
937
  }
938
938
  ];
939
939
 
940
+ /**
941
+ * Attempt to find a Rindo configuration file on the file system
942
+ * @param opts the options needed to find the configuration file
943
+ * @returns the results of attempting to find a configuration file on disk
944
+ */
940
945
  const findConfig = async (opts) => {
941
946
  const sys = opts.sys;
942
947
  const cwd = sys.getCurrentDirectory();
@@ -948,7 +953,7 @@ const findConfig = async (opts) => {
948
953
  let configPath = opts.configPath;
949
954
  if (isString(configPath)) {
950
955
  if (!sys.platformPath.isAbsolute(configPath)) {
951
- // passed in a custom rindo config location
956
+ // passed in a custom rindo config location,
952
957
  // but it's relative, so prefix the cwd
953
958
  configPath = normalizePath(sys.platformPath.join(cwd, configPath));
954
959
  }
@@ -2261,14 +2266,15 @@ const run = async (init) => {
2261
2266
  * @public
2262
2267
  */
2263
2268
  const runTask = async (coreCompiler, config, task, sys) => {
2264
- var _a, _b, _c;
2269
+ var _a, _b, _c, _d, _e;
2265
2270
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2266
2271
  const strictConfig = {
2267
2272
  ...config,
2268
2273
  flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2269
2274
  logger,
2270
2275
  outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2271
- sys: sys !== null && sys !== void 0 ? sys : coreCompiler.createSystem({ logger }),
2276
+ sys: (_d = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _d !== void 0 ? _d : coreCompiler.createSystem({ logger }),
2277
+ testing: (_e = config.testing) !== null && _e !== void 0 ? _e : {},
2272
2278
  };
2273
2279
  switch (task) {
2274
2280
  case 'build':
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo CLI v2.17.2 | MIT Licensed | https://rindojs.web.app
2
+ Rindo CLI v2.17.4 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  /**
5
5
  * This sets the log level hierarchy for our terminal logger, ranging from
@@ -805,7 +805,7 @@ LOG_LEVELS.includes(maybeLogLevel);
805
805
  const dependencies = [
806
806
  {
807
807
  name: "@rindo/core",
808
- version: "2.17.2",
808
+ version: "2.17.4",
809
809
  main: "compiler/rindo.js",
810
810
  resources: [
811
811
  "package.json",
@@ -913,6 +913,11 @@ const dependencies = [
913
913
  }
914
914
  ];
915
915
 
916
+ /**
917
+ * Attempt to find a Rindo configuration file on the file system
918
+ * @param opts the options needed to find the configuration file
919
+ * @returns the results of attempting to find a configuration file on disk
920
+ */
916
921
  const findConfig = async (opts) => {
917
922
  const sys = opts.sys;
918
923
  const cwd = sys.getCurrentDirectory();
@@ -924,7 +929,7 @@ const findConfig = async (opts) => {
924
929
  let configPath = opts.configPath;
925
930
  if (isString(configPath)) {
926
931
  if (!sys.platformPath.isAbsolute(configPath)) {
927
- // passed in a custom rindo config location
932
+ // passed in a custom rindo config location,
928
933
  // but it's relative, so prefix the cwd
929
934
  configPath = normalizePath(sys.platformPath.join(cwd, configPath));
930
935
  }
@@ -2237,14 +2242,15 @@ const run = async (init) => {
2237
2242
  * @public
2238
2243
  */
2239
2244
  const runTask = async (coreCompiler, config, task, sys) => {
2240
- var _a, _b, _c;
2245
+ var _a, _b, _c, _d, _e;
2241
2246
  const logger = (_a = config.logger) !== null && _a !== void 0 ? _a : createLogger();
2242
2247
  const strictConfig = {
2243
2248
  ...config,
2244
2249
  flags: createConfigFlags((_b = config.flags) !== null && _b !== void 0 ? _b : { task }),
2245
2250
  logger,
2246
2251
  outputTargets: (_c = config.outputTargets) !== null && _c !== void 0 ? _c : [],
2247
- sys: sys !== null && sys !== void 0 ? sys : coreCompiler.createSystem({ logger }),
2252
+ sys: (_d = sys !== null && sys !== void 0 ? sys : config.sys) !== null && _d !== void 0 ? _d : coreCompiler.createSystem({ logger }),
2253
+ testing: (_e = config.testing) !== null && _e !== void 0 ? _e : {},
2248
2254
  };
2249
2255
  switch (task) {
2250
2256
  case 'build':
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/cli",
3
- "version": "2.17.2",
3
+ "version": "2.17.4",
4
4
  "description": "Rindo CLI.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/compiler",
3
- "version": "2.17.2",
3
+ "version": "2.17.4",
4
4
  "description": "Rindo Compiler.",
5
5
  "main": "./rindo.js",
6
6
  "types": "./rindo.d.ts",
package/compiler/rindo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Compiler v2.17.2 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Compiler v2.17.4 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -4588,7 +4588,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4588
4588
  };
4589
4589
  };
4590
4590
 
4591
- const buildId = '20230111114107';
4591
+ const buildId = '20230111123214';
4592
4592
  const minfyJsId = 'terser5.6.1_7';
4593
4593
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.4.16_7';
4594
4594
  const parse5Version = '6.0.1';
@@ -4596,8 +4596,8 @@ const rollupVersion = '2.42.3';
4596
4596
  const sizzleVersion = '2.42.3';
4597
4597
  const terserVersion = '5.6.1';
4598
4598
  const typescriptVersion = '4.5.4';
4599
- const vermoji = '⚽️';
4600
- const version$3 = '2.17.2';
4599
+ const vermoji = '🏵';
4600
+ const version$3 = '2.17.4';
4601
4601
  const versions = {
4602
4602
  rindo: version$3,
4603
4603
  parse5: parse5Version,
@@ -12040,6 +12040,20 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
12040
12040
  return cssText;
12041
12041
  };
12042
12042
 
12043
+ /**
12044
+ * Serialize data about a style import to an annotated path, where
12045
+ * the filename has a URL queryparams style string appended to it.
12046
+ * This could look like:
12047
+ *
12048
+ * ```
12049
+ * './some-file.CSS?tag=my-tag&mode=ios&encapsulation=scoped');
12050
+ * ```
12051
+ *
12052
+ * @param data import data to be serialized
12053
+ * @param styleImportData an argument which controls whether the import data
12054
+ * will be added to the path (formatted as queryparams)
12055
+ * @returns a formatted string
12056
+ */
12043
12057
  const serializeImportPath = (data, styleImportData) => {
12044
12058
  let p = data.importeePath;
12045
12059
  if (isString$1(p)) {
@@ -12070,6 +12084,13 @@ const serializeImportPath = (data, styleImportData) => {
12070
12084
  }
12071
12085
  return p;
12072
12086
  };
12087
+ /**
12088
+ * Parse import paths (filepaths possibly annotated w/ component metadata,
12089
+ * formatted as URL queryparams) into a structured format.
12090
+ *
12091
+ * @param importPath an annotated import path to examine
12092
+ * @returns formatted information about the import
12093
+ */
12073
12094
  const parseImportPath = (importPath) => {
12074
12095
  const parsedPath = {
12075
12096
  importPath,
@@ -41889,29 +41910,71 @@ const formatUrl = (config, pluginCtx, code, filePath, ext) => {
41889
41910
  return `const ${varName} = 'data:${mime};base64,${base64}';export default ${varName};`;
41890
41911
  };
41891
41912
 
41913
+ /**
41914
+ * A Rollup plugin which bundles up some transformation of CSS imports as well
41915
+ * as writing some files to disk for the `DIST_COLLECTION` output target.
41916
+ *
41917
+ * @param config a user-supplied configuration
41918
+ * @param compilerCtx the current compiler context
41919
+ * @param buildCtx the current build context
41920
+ * @param bundleOpts bundle options for Rollup
41921
+ * @returns a Rollup plugin which carries out the necessary work
41922
+ */
41892
41923
  const extTransformsPlugin = (config, compilerCtx, buildCtx, bundleOpts) => {
41893
41924
  return {
41894
41925
  name: 'extTransformsPlugin',
41926
+ /**
41927
+ * A custom function targeting the `transform` build hook in Rollup. See here for details:
41928
+ * https://rollupjs.org/guide/en/#transform
41929
+ *
41930
+ * Here we are ignoring the first argument (which contains the module's source code) and
41931
+ * only looking at the `id` argument. We use that `id` to get information about the module
41932
+ * in question from disk ourselves so that we can then do some transformations on it.
41933
+ *
41934
+ * @param _ an unused parameter (normally the code for a given module)
41935
+ * @param id the id of a module
41936
+ * @returns metadata for Rollup or null if no transformation should be done
41937
+ */
41895
41938
  async transform(_, id) {
41939
+ var _a, _b;
41896
41940
  if (/\0/.test(id)) {
41897
41941
  return null;
41898
41942
  }
41943
+ // The `id` here was possibly previously updated using
41944
+ // `serializeImportPath` to annotate the filepath with various metadata
41945
+ // serialized to query-params. If that was done for this particular `id`
41946
+ // then the `data` prop will not be null.
41899
41947
  const { data } = parseImportPath(id);
41900
41948
  if (data != null) {
41901
- let cmp;
41949
+ let cmp = undefined;
41902
41950
  const filePath = normalizeFsPath(id);
41903
41951
  const code = await compilerCtx.fs.readFile(filePath);
41904
41952
  if (typeof code !== 'string') {
41905
41953
  return null;
41906
41954
  }
41907
41955
  const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
41908
- const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow';
41956
+ // We need to check whether the current build is a dev-mode watch build w/ HMR enabled in
41957
+ // order to know how we'll want to set `commentOriginalSelector` (below). If we are doing
41958
+ // a hydrate build we need to set this to `true` because commenting-out selectors is what
41959
+ // gives us support for scoped CSS w/ hydrated components (we don't support shadow DOM and
41960
+ // styling via that route for them). However, we don't want to comment selectors in dev
41961
+ // mode when using HMR in the browser, since there we _do_ support putting stylesheets into
41962
+ // the shadow DOM and commenting out e.g. the `:host` selector in those stylesheets will
41963
+ // break components' CSS when an HMR update is sent to the browser.
41964
+ const isDevWatchHMRBuild = config.flags.watch &&
41965
+ config.flags.dev &&
41966
+ config.flags.serve &&
41967
+ ((_b = (_a = config.devServer) === null || _a === void 0 ? void 0 : _a.reloadStrategy) !== null && _b !== void 0 ? _b : null) === 'hmr';
41968
+ const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow' && !isDevWatchHMRBuild;
41909
41969
  if (data.tag) {
41910
41970
  cmp = buildCtx.components.find((c) => c.tagName === data.tag);
41911
41971
  const moduleFile = cmp && compilerCtx.moduleMap.get(cmp.sourceFilePath);
41912
41972
  if (moduleFile) {
41913
41973
  const collectionDirs = config.outputTargets.filter(isOutputTargetDistCollection);
41914
41974
  const relPath = relative$1(config.srcDir, pluginTransforms.id);
41975
+ // If we found a `moduleFile` in the module map above then we
41976
+ // should write the transformed CSS file (found in the return value
41977
+ // of `runPluginTransformsEsmImports`, above) to disk.
41915
41978
  await Promise.all(collectionDirs.map(async (outputTarget) => {
41916
41979
  const collectionPath = join(outputTarget.collectionDir, relPath);
41917
41980
  await compilerCtx.fs.writeFile(collectionPath, pluginTransforms.code);
@@ -57705,13 +57768,13 @@ const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets)
57705
57768
  }
57706
57769
  const strictCheck = readmeOutputTargets.some((o) => o.strict);
57707
57770
  if (strictCheck) {
57708
- strickCheckDocs(config, docsData);
57771
+ strictCheckDocs(config, docsData);
57709
57772
  }
57710
57773
  await Promise.all(docsData.components.map((cmpData) => {
57711
57774
  return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components);
57712
57775
  }));
57713
57776
  };
57714
- const strickCheckDocs = (config, docsData) => {
57777
+ const strictCheckDocs = (config, docsData) => {
57715
57778
  docsData.components.forEach((component) => {
57716
57779
  component.props.forEach((prop) => {
57717
57780
  if (!prop.docs && prop.deprecation === undefined) {
@@ -63588,6 +63651,7 @@ const validateModule = async (config, compilerCtx, buildCtx) => {
63588
63651
  packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
63589
63652
  }
63590
63653
  };
63654
+ // TODO: Investigate the hierarchy of these output targets
63591
63655
  /**
63592
63656
  * Get the recommended `"module"` path for `package.json` given the output
63593
63657
  * targets that a user has set on their config.
@@ -63600,23 +63664,17 @@ function recommendedModulePath(config) {
63600
63664
  const customElementsBundleOT = config.outputTargets.find(isOutputTargetDistCustomElementsBundle);
63601
63665
  const customElementsOT = config.outputTargets.find(isOutputTargetDistCustomElements);
63602
63666
  const distCollectionOT = config.outputTargets.find(isOutputTargetDistCollection);
63603
- // If we're using `dist-custom-elements` then the preferred "module" field
63604
- // value is `$OUTPUT_DIR/components/index.js`
63605
- //
63606
- // Additionally, the `DIST_CUSTOM_ELEMENTS` output target should override
63607
- // `DIST_CUSTOM_ELEMENTS_BUNDLE` and `DIST_COLLECTION` output targets if
63608
- // they're also set, so we return first with this one.
63667
+ if (distCollectionOT) {
63668
+ return relative$1(config.rootDir, join(distCollectionOT.dir, 'index.js'));
63669
+ }
63609
63670
  if (customElementsOT) {
63610
- const componentsIndexAbs = join(customElementsOT.dir, 'components', 'index.js');
63671
+ const componentsIndexAbs = join(customElementsOT.dir, 'index.js');
63611
63672
  return relative$1(config.rootDir, componentsIndexAbs);
63612
63673
  }
63613
63674
  if (customElementsBundleOT) {
63614
63675
  const customElementsAbs = join(customElementsBundleOT.dir, 'index.js');
63615
63676
  return relative$1(config.rootDir, customElementsAbs);
63616
63677
  }
63617
- if (distCollectionOT) {
63618
- return relative$1(config.rootDir, join(distCollectionOT.dir, 'index.js'));
63619
- }
63620
63678
  // if no output target for which we define a recommended output target is set
63621
63679
  // we return `null`
63622
63680
  return null;
@@ -65204,6 +65262,7 @@ const getConfig = (userConfig) => {
65204
65262
  logger,
65205
65263
  outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
65206
65264
  sys: (_d = userConfig.sys) !== null && _d !== void 0 ? _d : createSystem({ logger }),
65265
+ testing: userConfig !== null && userConfig !== void 0 ? userConfig : {},
65207
65266
  };
65208
65267
  setPlatformPath(config.sys.platformPath);
65209
65268
  if (config.flags.debug || config.flags.verbose) {
@@ -65910,7 +65969,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65910
65969
  const dependencies = [
65911
65970
  {
65912
65971
  name: "@rindo/core",
65913
- version: "2.17.2",
65972
+ version: "2.17.4",
65914
65973
  main: "compiler/rindo.js",
65915
65974
  resources: [
65916
65975
  "package.json",
@@ -66323,7 +66382,7 @@ const validateHydrated = (config) => {
66323
66382
  * Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
66324
66383
  * property is set on them.
66325
66384
  *
66326
- * @param config the user-supplied configuration object
66385
+ * @param config a validated configuration object
66327
66386
  * @param userOutputs an array of output targets
66328
66387
  * @returns an array of validated DIST_COLLECTION output targets
66329
66388
  */
@@ -66632,20 +66691,20 @@ const validateVScodeDocsOutputTarget = (diagnostics, outputTarget) => {
66632
66691
  return outputTarget;
66633
66692
  };
66634
66693
 
66635
- const validateAngular = (userConfig, userOutputs) => {
66694
+ const validateAngular = (config, userOutputs) => {
66636
66695
  const angularOutputTargets = userOutputs.filter(isOutputTargetAngular);
66637
66696
  return angularOutputTargets.map((outputTarget) => {
66638
66697
  let directivesProxyFile = outputTarget.directivesProxyFile;
66639
66698
  if (directivesProxyFile && !isAbsolute$1(directivesProxyFile)) {
66640
- directivesProxyFile = join(userConfig.rootDir, directivesProxyFile);
66699
+ directivesProxyFile = join(config.rootDir, directivesProxyFile);
66641
66700
  }
66642
66701
  let directivesArrayFile = outputTarget.directivesArrayFile;
66643
66702
  if (directivesArrayFile && !isAbsolute$1(directivesArrayFile)) {
66644
- directivesArrayFile = join(userConfig.rootDir, directivesArrayFile);
66703
+ directivesArrayFile = join(config.rootDir, directivesArrayFile);
66645
66704
  }
66646
66705
  let directivesUtilsFile = outputTarget.directivesUtilsFile;
66647
66706
  if (directivesUtilsFile && !isAbsolute$1(directivesUtilsFile)) {
66648
- directivesUtilsFile = join(userConfig.rootDir, directivesUtilsFile);
66707
+ directivesUtilsFile = join(config.rootDir, directivesUtilsFile);
66649
66708
  }
66650
66709
  return {
66651
66710
  type: 'angular',
@@ -67263,7 +67322,7 @@ const validateWorkers = (config) => {
67263
67322
  * @returns an object with config and diagnostics props
67264
67323
  */
67265
67324
  const validateConfig = (userConfig = {}, bootstrapConfig) => {
67266
- var _a, _b, _c;
67325
+ var _a, _b, _c, _d;
67267
67326
  const config = Object.assign({}, userConfig); // not positive it's json safe
67268
67327
  const diagnostics = [];
67269
67328
  const logger = bootstrapConfig.logger || config.logger || createLogger();
@@ -67274,6 +67333,7 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
67274
67333
  logger,
67275
67334
  outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
67276
67335
  sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
67336
+ testing: (_d = config.testing) !== null && _d !== void 0 ? _d : {},
67277
67337
  };
67278
67338
  // default devMode false
67279
67339
  if (validatedConfig.flags.prod) {