@rindo/core 3.0.0-rc.1 → 3.0.1

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) v3.0.0-rc.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo CLI (CommonJS) v3.0.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  'use strict';
5
5
 
@@ -987,7 +987,7 @@ const dereferenceAlias = (maybeAlias) => {
987
987
  const dependencies = [
988
988
  {
989
989
  name: "@rindo/core",
990
- version: "3.0.0-rc.1",
990
+ version: "3.0.1",
991
991
  main: "compiler/rindo.js",
992
992
  resources: [
993
993
  "package.json",
package/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo CLI v3.0.0-rc.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo CLI v3.0.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  /**
5
5
  * Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
@@ -963,7 +963,7 @@ const dereferenceAlias = (maybeAlias) => {
963
963
  const dependencies = [
964
964
  {
965
965
  name: "@rindo/core",
966
- version: "3.0.0-rc.1",
966
+ version: "3.0.1",
967
967
  main: "compiler/rindo.js",
968
968
  resources: [
969
969
  "package.json",
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/cli",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.1",
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": "3.0.0-rc.1",
3
+ "version": "3.0.1",
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 v3.0.0-rc.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Compiler v3.0.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -265,10 +265,28 @@ const dashToPascalCase$1 = (str) => str
265
265
  .split('-')
266
266
  .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
267
267
  .join('');
268
+ /**
269
+ * Capitalize the first letter of a string
270
+ *
271
+ * @param str the string to capitalize
272
+ * @returns a capitalized string
273
+ */
268
274
  const toTitleCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
275
+ /**
276
+ * This is just a no-op, don't expect it to do anything.
277
+ */
269
278
  const noop$1 = () => {
270
279
  /* noop*/
271
280
  };
281
+ /**
282
+ * Sort an array without mutating it in-place (as `Array.prototype.sort`
283
+ * unfortunately does)
284
+ *
285
+ * @param array the array you'd like to sort
286
+ * @param prop a function for deriving sortable values (strings or numbers)
287
+ * from array members
288
+ * @returns a new array of all items `x` in `array` ordered by `prop(x)`
289
+ */
272
290
  const sortBy = (array, prop) => {
273
291
  return array.slice().sort((a, b) => {
274
292
  const nameA = prop(a);
@@ -280,6 +298,14 @@ const sortBy = (array, prop) => {
280
298
  return 0;
281
299
  });
282
300
  };
301
+ /**
302
+ * A polyfill of sorts for `Array.prototype.flat` which will return the result
303
+ * of calling that method if present and, if not, return an equivalent based on
304
+ * `Array.prototype.reduce`.
305
+ *
306
+ * @param array the array to flatten (one level)
307
+ * @returns a flattened array
308
+ */
283
309
  const flatOne = (array) => {
284
310
  if (array.flat) {
285
311
  return array.flat(1);
@@ -289,6 +315,17 @@ const flatOne = (array) => {
289
315
  return result;
290
316
  }, []);
291
317
  };
318
+ /**
319
+ * Deduplicate an array, retaining items at the earliest position in which
320
+ * they appear.
321
+ *
322
+ * So `unique([1,3,2,1,1,4])` would be `[1,3,2,4]`.
323
+ *
324
+ * @param array the array to deduplicate
325
+ * @param predicate an optional function used to generate the key used to
326
+ * determine uniqueness
327
+ * @returns a new, deduplicated array
328
+ */
292
329
  const unique = (array, predicate = (i) => i) => {
293
330
  const set = new Set();
294
331
  return array.filter((item) => {
@@ -303,6 +340,14 @@ const unique = (array, predicate = (i) => i) => {
303
340
  return true;
304
341
  });
305
342
  };
343
+ /**
344
+ * A utility for building an object from an iterable very similar to
345
+ * `Object.fromEntries`
346
+ *
347
+ * @param entries an iterable object holding entries (key-value tuples) to
348
+ * plop into a new object
349
+ * @returns an object containing those entries
350
+ */
306
351
  const fromEntries = (entries) => {
307
352
  const object = {};
308
353
  for (const [key, value] of entries) {
@@ -310,6 +355,15 @@ const fromEntries = (entries) => {
310
355
  }
311
356
  return object;
312
357
  };
358
+ /**
359
+ * Based on a given object, create a new object which has only the specified
360
+ * key-value pairs included in it.
361
+ *
362
+ * @param obj the object from which to take values
363
+ * @param keys a set of keys to take
364
+ * @returns an object mapping `key` to `obj[key]` if `obj[key]` is truthy for
365
+ * every `key` in `keys`
366
+ */
313
367
  const pluck = (obj, keys) => {
314
368
  return keys.reduce((final, key) => {
315
369
  if (obj[key]) {
@@ -2101,7 +2155,7 @@ const process$3 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), p
2101
2155
  'default': process_1
2102
2156
  });
2103
2157
 
2104
- const buildId = '20230405141100';
2158
+ const buildId = '20230406093613';
2105
2159
  const minfyJsId = 'terser5.16.1_7';
2106
2160
  const optimizeCssId = 'autoprefixer10.4.13_postcss8.4.21_7';
2107
2161
  const parse5Version = '7.1.2';
@@ -2109,8 +2163,8 @@ const rollupVersion = '2.42.3';
2109
2163
  const sizzleVersion = '2.42.3';
2110
2164
  const terserVersion = '5.16.1';
2111
2165
  const typescriptVersion = '4.9.4';
2112
- const vermoji = '🐏';
2113
- const version$3 = '3.0.0-rc.1';
2166
+ const vermoji = '🐸';
2167
+ const version$3 = '3.0.1';
2114
2168
  const versions = {
2115
2169
  rindo: version$3,
2116
2170
  parse5: parse5Version,
@@ -13438,9 +13492,28 @@ function isValidConfigOutputTarget(targetType) {
13438
13492
  }
13439
13493
  const GENERATED_DTS = 'components.d.ts';
13440
13494
 
13495
+ /**
13496
+ * Derive a {@link ts.CompilerOptions} object from the options currently set
13497
+ * on the user-supplied configuration object.
13498
+ *
13499
+ * Some of these options (like the `module` setting) are hardcoded here, but
13500
+ * the following are derived from the configuration object:
13501
+ *
13502
+ * - if one of the output targets requires type declaration output (i.e. the
13503
+ * {@link d.OutputTargetDistCustomElements.generateTypeDeclarations} option
13504
+ * is set to `true`) then we'll set `declaration: true`
13505
+ * - the `outDir` is set to the configured cache directory
13506
+ * - the `sourceMap` and `inlineSources` options are set based on the user's
13507
+ * {@link d.Config.sourceMap} configuration
13508
+ *
13509
+ * @param config the current user-supplied configuration
13510
+ * @returns an object containing TypeScript compiler options
13511
+ */
13441
13512
  const getTsOptionsToExtend = (config) => {
13442
13513
  const tsOptions = {
13443
13514
  experimentalDecorators: true,
13515
+ // if the `DIST_TYPES` output target is present then we'd like to emit
13516
+ // declaration files
13444
13517
  declaration: config.outputTargets.some(isOutputTargetDistTypes),
13445
13518
  module: t.ModuleKind.ESNext,
13446
13519
  moduleResolution: t.ModuleResolutionKind.NodeJs,
@@ -58105,6 +58178,7 @@ const generateHydrateFactory = async (config, compilerCtx, buildCtx) => {
58105
58178
  intro: HYDRATE_FACTORY_INTRO,
58106
58179
  outro: HYDRATE_FACTORY_OUTRO,
58107
58180
  preferConst: false,
58181
+ inlineDynamicImports: true,
58108
58182
  });
58109
58183
  if (!buildCtx.hasError && rollupOutput != null && Array.isArray(rollupOutput.output)) {
58110
58184
  return rollupOutput.output[0].code;
@@ -58250,6 +58324,14 @@ function getUserConfigBundles(config, buildCtx, cmps) {
58250
58324
 
58251
58325
  /**
58252
58326
  * Generate a list of all component tags that will be used by the output
58327
+ *
58328
+ * If the user has set the {@link d.Config.excludeUnusedDependencies} option
58329
+ * to `false` then this simply returns all components.
58330
+ *
58331
+ * Else, this takes {@link d.ComponentCompilerMeta} objects which are being
58332
+ * used in the current output and then ensures that all used components as well
58333
+ * as their dependencies are present.
58334
+ *
58253
58335
  * @param config the Rindo configuration used for the build
58254
58336
  * @param defaultBundles metadata of the assumed components being used/bundled
58255
58337
  * @param allCmps all known components
@@ -58282,25 +58364,32 @@ function computeUsedComponents(config, defaultBundles, allCmps) {
58282
58364
  }
58283
58365
  /**
58284
58366
  * Generate the bundles that will be used during the bundling process
58367
+ *
58368
+ * This gathers information about all of the components used in the build,
58369
+ * including the bundles which will be included by default, and then returns a
58370
+ * deduplicated list of all the bundles which need to be present.
58371
+ *
58285
58372
  * @param config the Rindo configuration used for the build
58286
58373
  * @param buildCtx the current build context
58287
58374
  * @returns the bundles to be used during the bundling process
58288
58375
  */
58289
58376
  function generateComponentBundles(config, buildCtx) {
58290
- const cmps = sortBy(buildCtx.components, (cmp) => cmp.dependents.length);
58291
- const defaultBundles = getDefaultBundles(config, buildCtx, cmps);
58292
- const usedComponents = computeUsedComponents(config, defaultBundles, cmps);
58377
+ const components = sortBy(buildCtx.components, (cmp) => cmp.dependents.length);
58378
+ const defaultBundles = getDefaultBundles(config, buildCtx, components);
58379
+ // this is most likely all the components
58380
+ const usedComponents = computeUsedComponents(config, defaultBundles, components);
58293
58381
  if (config.devMode) {
58294
- return cmps
58382
+ // return only components used in the build
58383
+ return components
58295
58384
  .filter((c) => usedComponents.has(c.tagName))
58296
58385
  .map((cmp) => [cmp]);
58297
58386
  }
58298
- // Visit components that are already in one of the default bundlers
58387
+ // Visit components that are already in one of the default bundles
58299
58388
  const alreadyBundled = new Set();
58300
58389
  defaultBundles.forEach((entry) => {
58301
58390
  entry.forEach((cmp) => alreadyBundled.add(cmp));
58302
58391
  });
58303
- const bundlers = cmps
58392
+ const bundlers = components
58304
58393
  .filter((cmp) => usedComponents.has(cmp.tagName) && !alreadyBundled.has(cmp))
58305
58394
  .map((c) => [c]);
58306
58395
  return [...defaultBundles, ...optimizeBundlers(bundlers, 0.6)].filter((b) => b.length > 0);
@@ -59100,7 +59189,13 @@ const getLazyCustomTransformer = (config, compilerCtx) => {
59100
59189
  ];
59101
59190
  };
59102
59191
  /**
59103
- * Generate entry modules to be used by the build process by determining how modules and components are connected
59192
+ * Generate entry modules to be used by the build process by determining how
59193
+ * modules and components are connected
59194
+ *
59195
+ * **Note**: this function mutates the {@link d.BuildCtx} object that is
59196
+ * passed in to it, assigning the generated entry modules to the `entryModules`
59197
+ * property
59198
+ *
59104
59199
  * @param config the Rindo configuration file that was provided as a part of the build step
59105
59200
  * @param buildCtx the current build context
59106
59201
  */
@@ -70008,7 +70103,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
70008
70103
  const dependencies = [
70009
70104
  {
70010
70105
  name: "@rindo/core",
70011
- version: "3.0.0-rc.1",
70106
+ version: "3.0.1",
70012
70107
  main: "compiler/rindo.js",
70013
70108
  resources: [
70014
70109
  "package.json",