@rindo/core 2.16.1 → 2.17.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.
package/compiler/rindo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Compiler v2.16.1 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Compiler v2.17.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  (function(exports) {
5
5
  'use strict';
@@ -1697,38 +1697,30 @@ const readPackageJson = async (config, compilerCtx, buildCtx) => {
1697
1697
  }
1698
1698
  }
1699
1699
  };
1700
+ /**
1701
+ * Parse a string read from a `package.json` file
1702
+ * @param pkgJsonStr the string read from a `package.json` file
1703
+ * @param pkgJsonFilePath the path to the already read `package.json` file
1704
+ * @returns the results of parsing the provided contents of the `package.json` file
1705
+ */
1700
1706
  const parsePackageJson = (pkgJsonStr, pkgJsonFilePath) => {
1701
- if (isString$1(pkgJsonFilePath)) {
1702
- return parseJson(pkgJsonStr, pkgJsonFilePath);
1703
- }
1704
- return null;
1705
- };
1706
- const parseJson = (jsonStr, filePath) => {
1707
- const rtn = {
1707
+ const parseResult = {
1708
1708
  diagnostic: null,
1709
1709
  data: null,
1710
- filePath,
1710
+ filePath: pkgJsonFilePath,
1711
1711
  };
1712
- if (isString$1(jsonStr)) {
1713
- try {
1714
- rtn.data = JSON.parse(jsonStr);
1715
- }
1716
- catch (e) {
1717
- rtn.diagnostic = buildError();
1718
- rtn.diagnostic.absFilePath = filePath;
1719
- rtn.diagnostic.header = `Error Parsing JSON`;
1720
- if (e instanceof Error) {
1721
- rtn.diagnostic.messageText = e.message;
1722
- }
1723
- }
1712
+ try {
1713
+ parseResult.data = JSON.parse(pkgJsonStr);
1724
1714
  }
1725
- else {
1726
- rtn.diagnostic = buildError();
1727
- rtn.diagnostic.absFilePath = filePath;
1728
- rtn.diagnostic.header = `Error Parsing JSON`;
1729
- rtn.diagnostic.messageText = `Invalid JSON input to parse`;
1715
+ catch (e) {
1716
+ parseResult.diagnostic = buildError();
1717
+ parseResult.diagnostic.absFilePath = isString$1(pkgJsonFilePath) ? pkgJsonFilePath : undefined;
1718
+ parseResult.diagnostic.header = `Error Parsing JSON`;
1719
+ if (e instanceof Error) {
1720
+ parseResult.diagnostic.messageText = e.message;
1721
+ }
1730
1722
  }
1731
- return rtn;
1723
+ return parseResult;
1732
1724
  };
1733
1725
  const SKIP_DEPS = ['@rindo/core'];
1734
1726
 
@@ -4550,7 +4542,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
4550
4542
  };
4551
4543
  };
4552
4544
 
4553
- const buildId = '20220812073157';
4545
+ const buildId = '20220812090622';
4554
4546
  const minfyJsId = 'terser5.6.1_7';
4555
4547
  const optimizeCssId = 'autoprefixer10.2.5_postcss8.4.16_7';
4556
4548
  const parse5Version = '6.0.1';
@@ -4558,8 +4550,8 @@ const rollupVersion = '2.42.3';
4558
4550
  const sizzleVersion = '2.42.3';
4559
4551
  const terserVersion = '5.6.1';
4560
4552
  const typescriptVersion = '4.5.4';
4561
- const vermoji = '🚐';
4562
- const version$3 = '2.16.1';
4553
+ const vermoji = '🏉';
4554
+ const version$3 = '2.17.0';
4563
4555
  const versions = {
4564
4556
  rindo: version$3,
4565
4557
  parse5: parse5Version,
@@ -11504,6 +11496,16 @@ MagicString$2.prototype.trimStart = function trimStart (charType) {
11504
11496
  return this;
11505
11497
  };
11506
11498
 
11499
+ /**
11500
+ * Parse CSS docstrings that Rindo supports, as documented here:
11501
+ * https://rindojs.web.app/docs/docs-json#css-variables
11502
+ *
11503
+ * Docstrings found in the supplied style text will be added to the
11504
+ * `styleDocs` param
11505
+ *
11506
+ * @param styleDocs the array to hold formatted CSS docstrings
11507
+ * @param styleText the CSS text we're working with
11508
+ */
11507
11509
  function parseStyleDocs(styleDocs, styleText) {
11508
11510
  if (typeof styleText !== 'string') {
11509
11511
  return;
@@ -11520,10 +11522,18 @@ function parseStyleDocs(styleDocs, styleText) {
11520
11522
  styleText = styleText.substring(endIndex + CSS_DOC_END.length);
11521
11523
  }
11522
11524
  }
11525
+ /**
11526
+ * Parse a CSS comment string and insert it into the provided array of
11527
+ * style docstrings.
11528
+ *
11529
+ * @param styleDocs an array which will be modified with the docstring
11530
+ * @param comment the comment string
11531
+ */
11523
11532
  function parseCssComment(styleDocs, comment) {
11524
11533
  /**
11525
11534
  * @prop --max-width: Max width of the alert
11526
11535
  */
11536
+ // (the above is an example of what these comments might look like)
11527
11537
  const lines = comment.split(/\r?\n/).map((line) => {
11528
11538
  line = line.trim();
11529
11539
  while (line.startsWith('*')) {
@@ -11551,11 +11561,19 @@ function parseCssComment(styleDocs, comment) {
11551
11561
  styleDocs.push(cssDoc);
11552
11562
  }
11553
11563
  });
11554
- return styleDocs;
11555
11564
  }
11556
- const CSS_DOC_START = `/**`;
11557
- const CSS_DOC_END = `*/`;
11558
- const CSS_PROP_ANNOTATION = `@prop`;
11565
+ /**
11566
+ * Opening syntax for a CSS docstring
11567
+ */
11568
+ const CSS_DOC_START = '/**';
11569
+ /**
11570
+ * Closing syntax for a CSS docstring
11571
+ */
11572
+ const CSS_DOC_END = '*/';
11573
+ /**
11574
+ * The `@prop` annotation we support within CSS docstrings
11575
+ */
11576
+ const CSS_PROP_ANNOTATION = '@prop';
11559
11577
 
11560
11578
  /**
11561
11579
  * @license
@@ -12044,6 +12062,53 @@ const stripCssComments = (input) => {
12044
12062
  return returnValue;
12045
12063
  };
12046
12064
 
12065
+ /**
12066
+ * A regular expression for matching CSS import statements
12067
+ *
12068
+ * According to https://developer.mozilla.org/en-US/docs/Web/CSS/@import
12069
+ * the formal grammar for CSS import statements is:
12070
+ *
12071
+ * ```
12072
+ * @import [ <url> | <string> ]
12073
+ * [ supports( [ <supports-condition> | <declaration> ] ) ]?
12074
+ * <media-query-list>? ;
12075
+ * ```
12076
+ *
12077
+ * Thus the string literal `"@import"` will be followed by a `<url>` or a
12078
+ * `<string>`, where a `<url>` may be a relative or absolute URL _or_ a `url()`
12079
+ * function.
12080
+ *
12081
+ * Thus the regular expression needs to match:
12082
+ *
12083
+ * - the string `"@import
12084
+ * - any amount of whitespace
12085
+ * - a URL, comprised of:
12086
+ * - an optional `url(` function opener
12087
+ * - a non-greedy match on any characters (to match the argument to the URL
12088
+ * function)
12089
+ * - an optional `)` closing paren on the `url()` function
12090
+ * - trailing characters after the URL, given by anything which doesn't match
12091
+ * the line-terminator `;`
12092
+ * - this can match media queries, support conditions, and so on
12093
+ * - a line-terminating semicolon
12094
+ *
12095
+ * The regex has 4 capture groups:
12096
+ *
12097
+ * 1. `@import`
12098
+ * 2. `url(`
12099
+ * 3. characters after `url(`
12100
+ * 4. all characters other than `;`, greedily matching
12101
+ *
12102
+ * We typically only care about group 4 here.
12103
+ */
12104
+ const CSS_IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
12105
+ /**
12106
+ * Our main entry point to this module. This performs an async transformation
12107
+ * of CSS input to ESM.
12108
+ *
12109
+ * @param input CSS input to be transformed to ESM
12110
+ * @returns a promise wrapping transformed ESM output
12111
+ */
12047
12112
  const transformCssToEsm = async (input) => {
12048
12113
  const results = transformCssToEsmModule(input);
12049
12114
  const optimizeResults = await optimizeCss$1({
@@ -12060,10 +12125,22 @@ const transformCssToEsm = async (input) => {
12060
12125
  results.styleText = optimizeResults.output;
12061
12126
  return generateTransformCssToEsm(input, results);
12062
12127
  };
12128
+ /**
12129
+ * A sync function for transforming input CSS to ESM
12130
+ *
12131
+ * @param input the input CSS we're going to transform
12132
+ * @returns transformed ESM output
12133
+ */
12063
12134
  const transformCssToEsmSync = (input) => {
12064
12135
  const results = transformCssToEsmModule(input);
12065
12136
  return generateTransformCssToEsm(input, results);
12066
12137
  };
12138
+ /**
12139
+ * Performs the actual transformation from CSS to ESM
12140
+ *
12141
+ * @param input input CSS to be transformed
12142
+ * @returns ESM output
12143
+ */
12067
12144
  const transformCssToEsmModule = (input) => {
12068
12145
  const results = {
12069
12146
  styleText: input.input,
@@ -12108,6 +12185,14 @@ const transformCssToEsmModule = (input) => {
12108
12185
  }
12109
12186
  return results;
12110
12187
  };
12188
+ /**
12189
+ * Updated the `output` property on `results` with appropriate import statements for
12190
+ * the CSS import tree and the module type.
12191
+ *
12192
+ * @param input the CSS to ESM transform input
12193
+ * @param results the corresponding output
12194
+ * @returns the modified ESM output
12195
+ */
12111
12196
  const generateTransformCssToEsm = (input, results) => {
12112
12197
  const s = new MagicString$2('');
12113
12198
  if (input.module === 'cjs') {
@@ -12137,6 +12222,15 @@ const generateTransformCssToEsm = (input, results) => {
12137
12222
  results.output = s.toString();
12138
12223
  return results;
12139
12224
  };
12225
+ /**
12226
+ * Get all of the CSS imports in a file
12227
+ *
12228
+ * @param varNames a set into which new names will be added
12229
+ * @param cssText the CSS text in question
12230
+ * @param filePath the file path to the file in question
12231
+ * @param modeName the current mode name
12232
+ * @returns an array of import objects
12233
+ */
12140
12234
  const getCssToEsmImports = (varNames, cssText, filePath, modeName) => {
12141
12235
  const cssImports = [];
12142
12236
  if (!cssText.includes('@import')) {
@@ -12178,10 +12272,22 @@ const getCssToEsmImports = (varNames, cssText, filePath, modeName) => {
12178
12272
  }
12179
12273
  return cssImports;
12180
12274
  };
12181
- const CSS_IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
12275
+ /**
12276
+ * Check if a module URL is a css node module
12277
+ *
12278
+ * @param url to check
12279
+ * @returns whether or not it's a Css node module
12280
+ */
12182
12281
  const isCssNodeModule$1 = (url) => {
12183
12282
  return url.startsWith('~');
12184
12283
  };
12284
+ /**
12285
+ * Check if a given import is a local import or not (i.e. check that it
12286
+ * is not importing from some other domain)
12287
+ *
12288
+ * @param srcImport the import to check
12289
+ * @returns whether it's local or not
12290
+ */
12185
12291
  const isLocalCssImport$1 = (srcImport) => {
12186
12292
  srcImport = srcImport.toLowerCase();
12187
12293
  if (srcImport.includes('url(')) {
@@ -12194,6 +12300,13 @@ const isLocalCssImport$1 = (srcImport) => {
12194
12300
  }
12195
12301
  return true;
12196
12302
  };
12303
+ /**
12304
+ * Given a file path and a mode name, create an appropriate variable name
12305
+ *
12306
+ * @param filePath the path we want to use
12307
+ * @param modeName the name for the current style mode (i.e. `md` or `ios` on Navify)
12308
+ * @returns an appropriate Css var name
12309
+ */
12197
12310
  const createCssVarName = (filePath, modeName) => {
12198
12311
  let varName = path$5.basename(filePath);
12199
12312
  if (modeName && modeName !== DEFAULT_STYLE_MODE && !varName.includes(modeName)) {
@@ -16185,6 +16298,9 @@ class MockElement extends MockNode {
16185
16298
  this.shadowRoot = shadowRoot;
16186
16299
  return shadowRoot;
16187
16300
  }
16301
+ blur() {
16302
+ /**/
16303
+ }
16188
16304
  get shadowRoot() {
16189
16305
  return this.__shadowRoot || null;
16190
16306
  }
@@ -16253,6 +16369,7 @@ class MockElement extends MockNode {
16253
16369
  get firstElementChild() {
16254
16370
  return this.children[0] || null;
16255
16371
  }
16372
+ focus(_options) { }
16256
16373
  getAttribute(attrName) {
16257
16374
  if (attrName === 'style') {
16258
16375
  if (this.__style != null && this.__style.length > 0) {
@@ -17156,7 +17273,28 @@ function createElementNS(ownerDocument, namespaceURI, tagName) {
17156
17273
  return createElement(ownerDocument, tagName);
17157
17274
  }
17158
17275
  else if (namespaceURI === 'http://www.w3.org/2000/svg') {
17159
- return new MockSVGElement(ownerDocument, tagName);
17276
+ switch (tagName.toLowerCase()) {
17277
+ case 'text':
17278
+ case 'tspan':
17279
+ case 'tref':
17280
+ case 'altglyph':
17281
+ case 'textpath':
17282
+ return new MockSVGTextContentElement(ownerDocument, tagName);
17283
+ case 'circle':
17284
+ case 'ellipse':
17285
+ case 'image':
17286
+ case 'line':
17287
+ case 'path':
17288
+ case 'polygon':
17289
+ case 'polyline':
17290
+ case 'rect':
17291
+ case 'use':
17292
+ return new MockSVGGraphicsElement(ownerDocument, tagName);
17293
+ case 'svg':
17294
+ return new MockSVGSVGElement(ownerDocument, tagName);
17295
+ default:
17296
+ return new MockSVGElement(ownerDocument, tagName);
17297
+ }
17160
17298
  }
17161
17299
  else {
17162
17300
  return new MockElement(ownerDocument, tagName);
@@ -17303,6 +17441,98 @@ class MockScriptElement extends MockHTMLElement {
17303
17441
  patchPropAttributes(MockScriptElement.prototype, {
17304
17442
  type: String,
17305
17443
  });
17444
+ class MockDOMMatrix {
17445
+ constructor() {
17446
+ this.a = 1;
17447
+ this.b = 0;
17448
+ this.c = 0;
17449
+ this.d = 1;
17450
+ this.e = 0;
17451
+ this.f = 0;
17452
+ this.m11 = 1;
17453
+ this.m12 = 0;
17454
+ this.m13 = 0;
17455
+ this.m14 = 0;
17456
+ this.m21 = 0;
17457
+ this.m22 = 1;
17458
+ this.m23 = 0;
17459
+ this.m24 = 0;
17460
+ this.m31 = 0;
17461
+ this.m32 = 0;
17462
+ this.m33 = 1;
17463
+ this.m34 = 0;
17464
+ this.m41 = 0;
17465
+ this.m42 = 0;
17466
+ this.m43 = 0;
17467
+ this.m44 = 1;
17468
+ this.is2D = true;
17469
+ this.isIdentity = true;
17470
+ }
17471
+ static fromMatrix() {
17472
+ return new MockDOMMatrix();
17473
+ }
17474
+ inverse() {
17475
+ return new MockDOMMatrix();
17476
+ }
17477
+ flipX() {
17478
+ return new MockDOMMatrix();
17479
+ }
17480
+ flipY() {
17481
+ return new MockDOMMatrix();
17482
+ }
17483
+ multiply() {
17484
+ return new MockDOMMatrix();
17485
+ }
17486
+ rotate() {
17487
+ return new MockDOMMatrix();
17488
+ }
17489
+ rotateAxisAngle() {
17490
+ return new MockDOMMatrix();
17491
+ }
17492
+ rotateFromVector() {
17493
+ return new MockDOMMatrix();
17494
+ }
17495
+ scale() {
17496
+ return new MockDOMMatrix();
17497
+ }
17498
+ scaleNonUniform() {
17499
+ return new MockDOMMatrix();
17500
+ }
17501
+ skewX() {
17502
+ return new MockDOMMatrix();
17503
+ }
17504
+ skewY() {
17505
+ return new MockDOMMatrix();
17506
+ }
17507
+ toJSON() { }
17508
+ toString() { }
17509
+ transformPoint() {
17510
+ return new MockDOMPoint();
17511
+ }
17512
+ translate() {
17513
+ return new MockDOMMatrix();
17514
+ }
17515
+ }
17516
+ class MockDOMPoint {
17517
+ constructor() {
17518
+ this.w = 1;
17519
+ this.x = 0;
17520
+ this.y = 0;
17521
+ this.z = 0;
17522
+ }
17523
+ toJSON() { }
17524
+ matrixTransform() {
17525
+ return new MockDOMMatrix();
17526
+ }
17527
+ }
17528
+ class MockSVGRect {
17529
+ constructor() {
17530
+ this.height = 10;
17531
+ this.width = 10;
17532
+ this.x = 0;
17533
+ this.y = 0;
17534
+ }
17535
+ }
17306
17536
  class MockStyleElement extends MockHTMLElement {
17307
17537
  constructor(ownerDocument) {
17308
17538
  super(ownerDocument, 'style');
@@ -17335,9 +17565,6 @@ class MockSVGElement extends MockElement {
17335
17565
  get viewportElement() {
17336
17566
  return null;
17337
17567
  }
17338
- focus() {
17339
- /**/
17340
- }
17341
17568
  onunload() {
17342
17569
  /**/
17343
17570
  }
@@ -17355,6 +17582,27 @@ class MockSVGElement extends MockElement {
17355
17582
  return 0;
17356
17583
  }
17357
17584
  }
17585
+ class MockSVGGraphicsElement extends MockSVGElement {
17586
+ getBBox(_options) {
17587
+ return new MockSVGRect();
17588
+ }
17589
+ getCTM() {
17590
+ return new MockDOMMatrix();
17591
+ }
17592
+ getScreenCTM() {
17593
+ return new MockDOMMatrix();
17594
+ }
17595
+ }
17596
+ class MockSVGSVGElement extends MockSVGGraphicsElement {
17597
+ createSVGPoint() {
17598
+ return new MockDOMPoint();
17599
+ }
17600
+ }
17601
+ class MockSVGTextContentElement extends MockSVGGraphicsElement {
17602
+ getComputedTextLength() {
17603
+ return 0;
17604
+ }
17605
+ }
17358
17606
  class MockBaseElement extends MockHTMLElement {
17359
17607
  constructor(ownerDocument) {
17360
17608
  super(ownerDocument, 'base');
@@ -41575,6 +41823,7 @@ const createComponentExport = (cmp) => {
41575
41823
  * using the `dist-custom-elements` output target may have a single 'entry point' for each file containing a component.
41576
41824
  * Each of those files will be independently resolved and loaded by this plugin for further processing by Rollup later
41577
41825
  * in the bundling process.
41826
+ *
41578
41827
  * @param entries the Rindo project files to process. It should be noted that the keys in this object may not
41579
41828
  * necessarily be an absolute or relative path to a file, but may be a Rollup Virtual Module (which begin with \0).
41580
41829
  * @returns the rollup plugin that loads and process a Rindo project's entry points
@@ -41743,9 +41992,9 @@ const fetchUrlSync = (url) => {
41743
41992
  return undefined;
41744
41993
  };
41745
41994
 
41746
- const patchTsSystemFileSystem = (config, rindoSys, inMemoryFs, tsSys) => {
41995
+ const patchTsSystemFileSystem = (config, compilerSys, inMemoryFs, tsSys) => {
41747
41996
  const realpath = (path) => {
41748
- const rp = rindoSys.realpathSync(path);
41997
+ const rp = compilerSys.realpathSync(path);
41749
41998
  if (isString$1(rp)) {
41750
41999
  return rp;
41751
42000
  }
@@ -41753,7 +42002,7 @@ const patchTsSystemFileSystem = (config, rindoSys, inMemoryFs, tsSys) => {
41753
42002
  };
41754
42003
  const getAccessibleFileSystemEntries = (path) => {
41755
42004
  try {
41756
- const entries = rindoSys.readDirSync(path || '.').sort();
42005
+ const entries = compilerSys.readDirSync(path || '.').sort();
41757
42006
  const files = [];
41758
42007
  const directories = [];
41759
42008
  for (const absPath of entries) {
@@ -41778,13 +42027,13 @@ const patchTsSystemFileSystem = (config, rindoSys, inMemoryFs, tsSys) => {
41778
42027
  }
41779
42028
  };
41780
42029
  tsSys.createDirectory = (p) => {
41781
- rindoSys.createDirSync(p, { recursive: true });
42030
+ compilerSys.createDirSync(p, { recursive: true });
41782
42031
  };
41783
42032
  tsSys.directoryExists = (p) => {
41784
42033
  const s = inMemoryFs.statSync(p);
41785
42034
  return s.isDirectory;
41786
42035
  };
41787
- tsSys.exit = rindoSys.exit;
42036
+ tsSys.exit = compilerSys.exit;
41788
42037
  tsSys.fileExists = (p) => {
41789
42038
  let filePath = p;
41790
42039
  if (isRemoteUrl(p)) {
@@ -41793,17 +42042,17 @@ const patchTsSystemFileSystem = (config, rindoSys, inMemoryFs, tsSys) => {
41793
42042
  const s = inMemoryFs.statSync(filePath);
41794
42043
  return !!(s && s.isFile);
41795
42044
  };
41796
- tsSys.getCurrentDirectory = rindoSys.getCurrentDirectory;
41797
- tsSys.getExecutingFilePath = rindoSys.getCompilerExecutingPath;
42045
+ tsSys.getCurrentDirectory = compilerSys.getCurrentDirectory;
42046
+ tsSys.getExecutingFilePath = compilerSys.getCompilerExecutingPath;
41798
42047
  tsSys.getDirectories = (p) => {
41799
- const items = rindoSys.readDirSync(p);
42048
+ const items = compilerSys.readDirSync(p);
41800
42049
  return items.filter((itemPath) => {
41801
42050
  const s = inMemoryFs.statSync(itemPath);
41802
42051
  return !!(s && s.exists && s.isDirectory);
41803
42052
  });
41804
42053
  };
41805
42054
  tsSys.readDirectory = (path, extensions, exclude, include, depth) => {
41806
- const cwd = rindoSys.getCurrentDirectory();
42055
+ const cwd = compilerSys.getCurrentDirectory();
41807
42056
  // TODO: Replace `matchFiles` with a function that is publicly exposed
41808
42057
  return t.matchFiles(path, extensions, exclude, include, IS_CASE_SENSITIVE_FILE_NAMES, cwd, depth, getAccessibleFileSystemEntries, realpath);
41809
42058
  };
@@ -41830,9 +42079,9 @@ const patchTsSystemFileSystem = (config, rindoSys, inMemoryFs, tsSys) => {
41830
42079
  tsSys.writeFile = (p, data) => inMemoryFs.writeFile(p, data);
41831
42080
  return tsSys;
41832
42081
  };
41833
- const patchTsSystemWatch = (rindoSys, tsSys) => {
42082
+ const patchTsSystemWatch = (compilerSystem, tsSys) => {
41834
42083
  tsSys.watchDirectory = (p, cb, recursive) => {
41835
- const watcher = rindoSys.watchDirectory(p, (filePath) => {
42084
+ const watcher = compilerSystem.watchDirectory(p, (filePath) => {
41836
42085
  cb(filePath);
41837
42086
  }, recursive);
41838
42087
  return {
@@ -41842,7 +42091,7 @@ const patchTsSystemWatch = (rindoSys, tsSys) => {
41842
42091
  };
41843
42092
  };
41844
42093
  tsSys.watchFile = (p, cb) => {
41845
- const watcher = rindoSys.watchFile(p, (filePath, eventKind) => {
42094
+ const watcher = compilerSystem.watchFile(p, (filePath, eventKind) => {
41846
42095
  if (eventKind === 'fileAdd') {
41847
42096
  cb(filePath, t.FileWatcherEventKind.Created);
41848
42097
  }
@@ -56093,6 +56342,9 @@ const updateRindoCoreImports = (updatedCoreImportPath) => {
56093
56342
  };
56094
56343
  };
56095
56344
  };
56345
+ /**
56346
+ * A set of imports which we don't want to remove from an output file
56347
+ */
56096
56348
  const KEEP_IMPORTS = new Set([
56097
56349
  'h',
56098
56350
  'setMode',
@@ -56112,37 +56364,75 @@ const KEEP_IMPORTS = new Set([
56112
56364
  'setErrorHandler',
56113
56365
  ]);
56114
56366
 
56367
+ /**
56368
+ * Main output target function for `dist-custom-elements`. This function just
56369
+ * does some organizational work to call the other functions in this module,
56370
+ * which do actual work of generating the rollup configuration, creating an
56371
+ * entry chunk, running, the build, etc.
56372
+ *
56373
+ * @param config the user-supplied compiler configuration we're using
56374
+ * @param compilerCtx the current compiler context
56375
+ * @param buildCtx the current build context
56376
+ * @returns an empty Promise which won't resolve until the work is done!
56377
+ */
56115
56378
  const outputCustomElements = async (config, compilerCtx, buildCtx) => {
56379
+ var _a;
56116
56380
  if (!config.buildDist) {
56117
56381
  return;
56118
56382
  }
56119
- const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
56383
+ const outputTargets = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).filter(isOutputTargetDistCustomElements);
56120
56384
  if (outputTargets.length === 0) {
56121
56385
  return;
56122
56386
  }
56123
56387
  const bundlingEventMessage = 'generate custom elements';
56124
56388
  const timespan = buildCtx.createTimeSpan(`${bundlingEventMessage} started`);
56125
- await Promise.all(outputTargets.map((o) => bundleCustomElements$1(config, compilerCtx, buildCtx, o)));
56389
+ await Promise.all(outputTargets.map((target) => bundleCustomElements$1(config, compilerCtx, buildCtx, target)));
56126
56390
  timespan.finish(`${bundlingEventMessage} finished`);
56127
56391
  };
56392
+ /**
56393
+ * Get bundle options for our current build and compiler context which we'll use
56394
+ * to generate a Rollup build and so on.
56395
+ *
56396
+ * @param config user-supplied Rindo configuration
56397
+ * @param buildCtx the current build context
56398
+ * @param compilerCtx the current compiler context
56399
+ * @param outputTarget the outputTarget we're currently dealing with
56400
+ * @returns bundle options suitable for generating a rollup configuration
56401
+ */
56402
+ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
56403
+ id: 'customElements',
56404
+ platform: 'client',
56405
+ conditionals: getCustomElementsBuildConditionals(config, buildCtx.components),
56406
+ customTransformers: getCustomElementCustomTransformer(config, compilerCtx, buildCtx.components, outputTarget),
56407
+ externalRuntime: !!outputTarget.externalRuntime,
56408
+ inlineWorkers: true,
56409
+ inputs: {
56410
+ // Here we prefix our index chunk with '\0' to tell Rollup that we're
56411
+ // going to be using virtual modules with this module. A leading '\0'
56412
+ // prevents other plugins from messing with the module. We generate a
56413
+ // string for the index chunk below in the `loader` property.
56414
+ //
56415
+ // @see {@link https://rollupjs.org/guide/en/#conventions} for more info.
56416
+ index: '\0core',
56417
+ },
56418
+ loader: {
56419
+ '\0core': generateEntryPoint$1(outputTarget),
56420
+ },
56421
+ inlineDynamicImports: outputTarget.inlineDynamicImports,
56422
+ preserveEntrySignatures: 'allow-extension',
56423
+ });
56424
+ /**
56425
+ * Get bundle options for rollup, run the rollup build, optionally minify the
56426
+ * output, and write files to disk.
56427
+ * @param config user-supplied Rindo configuration
56428
+ * @param buildCtx the current build context
56429
+ * @param compilerCtx the current compiler context
56430
+ * @param outputTarget the outputTarget we're currently dealing with
56431
+ * @returns an empty promise
56432
+ */
56128
56433
  const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarget) => {
56129
56434
  try {
56130
- const bundleOpts = {
56131
- id: 'customElements',
56132
- platform: 'client',
56133
- conditionals: getCustomElementsBuildConditionals(config, buildCtx.components),
56134
- customTransformers: getCustomElementCustomTransformer(config, compilerCtx, buildCtx.components, outputTarget),
56135
- externalRuntime: !!outputTarget.externalRuntime,
56136
- inlineWorkers: true,
56137
- inputs: {
56138
- index: '\0core',
56139
- },
56140
- loader: {
56141
- '\0core': generateEntryPoint$1(outputTarget),
56142
- },
56143
- inlineDynamicImports: outputTarget.inlineDynamicImports,
56144
- preserveEntrySignatures: 'allow-extension',
56145
- };
56435
+ const bundleOpts = getBundleOptions(config, buildCtx, compilerCtx, outputTarget);
56146
56436
  addCustomElementInputs(buildCtx, bundleOpts);
56147
56437
  const build = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
56148
56438
  if (build) {
@@ -56155,6 +56445,18 @@ const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarge
56155
56445
  hoistTransitiveImports: false,
56156
56446
  preferConst: true,
56157
56447
  });
56448
+ // the output target should have been validated at this point - as a result, we expect this field
56449
+ // to have been backfilled if it wasn't provided
56450
+ const outputTargetDir = outputTarget.dir;
56451
+ // besides, if it isn't here we do a diagnostic and an early return
56452
+ if (!isString$1(outputTargetDir)) {
56453
+ buildCtx.diagnostics.push({
56454
+ level: 'error',
56455
+ type: 'build',
56456
+ messageText: 'dist-custom-elements output target provided with no output target directory!',
56457
+ });
56458
+ return;
56459
+ }
56158
56460
  const minify = outputTarget.externalRuntime || outputTarget.minify !== true ? false : config.minifyJs;
56159
56461
  const files = rollupOutput.output.map(async (bundle) => {
56160
56462
  if (bundle.type === 'chunk') {
@@ -56169,15 +56471,15 @@ const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarge
56169
56471
  buildCtx.diagnostics.push(...optimizeResults.diagnostics);
56170
56472
  if (!hasError(optimizeResults.diagnostics) && typeof optimizeResults.output === 'string') {
56171
56473
  code = optimizeResults.output;
56172
- sourceMap = optimizeResults.sourceMap;
56173
56474
  }
56174
- if (sourceMap) {
56475
+ if (optimizeResults.sourceMap) {
56476
+ sourceMap = optimizeResults.sourceMap;
56175
56477
  code = code + getSourceMappingUrlForEndOfFile(bundle.fileName);
56176
- await compilerCtx.fs.writeFile(join(outputTarget.dir, bundle.fileName + '.map'), JSON.stringify(sourceMap), {
56478
+ await compilerCtx.fs.writeFile(join(outputTargetDir, bundle.fileName + '.map'), JSON.stringify(sourceMap), {
56177
56479
  outputTargetType: outputTarget.type,
56178
56480
  });
56179
56481
  }
56180
- await compilerCtx.fs.writeFile(join(outputTarget.dir, bundle.fileName), code, {
56482
+ await compilerCtx.fs.writeFile(join(outputTargetDir, bundle.fileName), code, {
56181
56483
  outputTargetType: outputTarget.type,
56182
56484
  });
56183
56485
  }
@@ -56196,6 +56498,8 @@ const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarge
56196
56498
  */
56197
56499
  const addCustomElementInputs = (buildCtx, bundleOpts) => {
56198
56500
  const components = buildCtx.components;
56501
+ // an array to store the imports of these modules that we're going to add to our entry chunk
56502
+ const indexImports = [];
56199
56503
  components.forEach((cmp) => {
56200
56504
  const exp = [];
56201
56505
  const exportName = dashToPascalCase$1(cmp.tagName);
@@ -56204,16 +56508,25 @@ const addCustomElementInputs = (buildCtx, bundleOpts) => {
56204
56508
  const coreKey = `\0${exportName}`;
56205
56509
  if (cmp.isPlain) {
56206
56510
  exp.push(`export { ${importName} as ${exportName} } from '${cmp.sourceFilePath}';`);
56511
+ indexImports.push(`export { {${exportName} } from '${coreKey}';`);
56207
56512
  }
56208
56513
  else {
56209
56514
  // the `importName` may collide with the `exportName`, alias it just in case it does with `importAs`
56210
56515
  exp.push(`import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';`);
56211
56516
  exp.push(`export const ${exportName} = ${importAs};`);
56212
56517
  exp.push(`export const defineCustomElement = cmpDefCustomEle;`);
56518
+ // Here we push an export (with a rename for `defineCustomElement` for
56519
+ // this component onto our array which references the `coreKey` (prefixed
56520
+ // with `\0`). We have to do this so that our import is referencing the
56521
+ // correct virtual module, if we instead referenced, for instance,
56522
+ // `cmp.sourceFilePath`, we would end up with duplicated modules in our
56523
+ // output.
56524
+ indexImports.push(`export { ${exportName}, defineCustomElement as defineCustomElement${exportName} } from '${coreKey}';`);
56213
56525
  }
56214
56526
  bundleOpts.inputs[cmp.tagName] = coreKey;
56215
56527
  bundleOpts.loader[coreKey] = exp.join('\n');
56216
56528
  });
56529
+ bundleOpts.loader['\0core'] += indexImports.join('\n');
56217
56530
  };
56218
56531
  /**
56219
56532
  * Generate the entrypoint (`index.ts` file) contents for the `dist-custom-elements` output target
@@ -56231,6 +56544,7 @@ const generateEntryPoint$1 = (outputTarget) => {
56231
56544
  /**
56232
56545
  * Get the series of custom transformers that will be applied to a Rindo project's source code during the TypeScript
56233
56546
  * transpilation process
56547
+ *
56234
56548
  * @param config the configuration for the Rindo project
56235
56549
  * @param compilerCtx the current compiler context
56236
56550
  * @param components the components that will be compiled as a part of the current build
@@ -60222,29 +60536,38 @@ const relDts$1 = (fromPath, dtsPath) => {
60222
60536
  * @param config the Rindo configuration associated with the project being compiled
60223
60537
  * @param compilerCtx the current compiler context
60224
60538
  * @param buildCtx the context associated with the current build
60225
- * @param distDtsFilePath the path to a type declaration file (.d.ts) that is being generated for the output target.
60226
- * This path is not necessarily the `components.d.ts` file that is found in the root of a project's `src` directory.
60539
+ * @param typesDir the path to the directory where type declarations are saved
60227
60540
  */
60228
- const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, distDtsFilePath) => {
60229
- const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
60230
- await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, distDtsFilePath, outputTarget)));
60541
+ const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, typesDir) => {
60542
+ var _a;
60543
+ const outputTargets = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).filter(isOutputTargetDistCustomElements);
60544
+ await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, typesDir, outputTarget)));
60231
60545
  };
60232
60546
  /**
60233
60547
  * Generates types for a single `dist-custom-elements` output target definition in a Rindo project's configuration
60548
+ *
60234
60549
  * @param config the Rindo configuration associated with the project being compiled
60235
60550
  * @param compilerCtx the current compiler context
60236
60551
  * @param buildCtx the context associated with the current build
60237
- * @param distDtsFilePath the path to a type declaration file (.d.ts) that is being generated for the output target.
60238
- * This path is not necessarily the `components.d.ts` file that is found in the root of a project's `src` directory.
60552
+ * @param typesDir path to the directory where type declarations are saved
60239
60553
  * @param outputTarget the output target for which types are being currently generated
60240
60554
  */
60241
- const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx, distDtsFilePath, outputTarget) => {
60555
+ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx, typesDir, outputTarget) => {
60556
+ // the path where we're going to write the typedef for the whole dist-custom-elements output
60242
60557
  const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
60243
- const componentsDtsRelPath = relDts(outputTarget.dir, distDtsFilePath);
60558
+ // the directory where types for the individual components are written
60559
+ const componentsTypeDirectoryPath = relative$1(outputTarget.dir, join(typesDir, 'components'));
60560
+ const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
60244
60561
  const code = [
60245
60562
  `/* ${config.namespace} custom elements */`,
60246
- ``,
60247
- `import type { Components, JSX } from "${componentsDtsRelPath}";`,
60563
+ ...components.map((component) => {
60564
+ const exportName = dashToPascalCase$1(component.tagName);
60565
+ const importName = component.componentClassName;
60566
+ // typedefs for individual components can be found under paths like
60567
+ // $TYPES_DIR/components/my-component/my-component.d.ts
60568
+ const componentDTSPath = join(componentsTypeDirectoryPath, component.tagName, component.tagName);
60569
+ return `export { ${importName} as ${exportName} } from '${componentDTSPath}';`;
60570
+ }),
60248
60571
  ``,
60249
60572
  `/**`,
60250
60573
  ` * Used to manually set the base path where assets can be found.`,
@@ -60264,10 +60587,8 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60264
60587
  ` rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
60265
60588
  `}`,
60266
60589
  `export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;`,
60267
- ``,
60268
- `export type { Components, JSX };`,
60269
- ``,
60270
60590
  ];
60591
+ const componentsDtsRelPath = relDts(outputTarget.dir, join(typesDir, 'components.d.ts'));
60271
60592
  const usersIndexJsPath = join(config.srcDir, 'index.ts');
60272
60593
  const hasUserIndex = await compilerCtx.fs.access(usersIndexJsPath);
60273
60594
  if (hasUserIndex) {
@@ -60280,7 +60601,6 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
60280
60601
  await compilerCtx.fs.writeFile(customElementsDtsPath, code.join('\n') + `\n`, {
60281
60602
  outputTargetType: outputTarget.type,
60282
60603
  });
60283
- const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
60284
60604
  await Promise.all(components.map(async (cmp) => {
60285
60605
  const dtsCode = generateCustomElementType(componentsDtsRelPath, cmp);
60286
60606
  const fileName = `${cmp.tagName}.d.ts`;
@@ -60354,20 +60674,21 @@ const generateTypesOutput = async (config, compilerCtx, buildCtx, outputTarget)
60354
60674
  const srcDtsFiles = srcDirItems.filter((srcItem) => srcItem.isFile && isDtsFile$1(srcItem.absPath));
60355
60675
  // Copy .d.ts files from src to dist
60356
60676
  // In addition, all references to @rindo/core are replaced
60357
- let distDtsFilePath;
60358
- await Promise.all(srcDtsFiles.map(async (srcDtsFile) => {
60677
+ const copiedDTSFilePaths = await Promise.all(srcDtsFiles.map(async (srcDtsFile) => {
60359
60678
  const relPath = relative$1(config.srcDir, srcDtsFile.absPath);
60360
60679
  const distPath = join(outputTarget.typesDir, relPath);
60361
60680
  const originalDtsContent = await compilerCtx.fs.readFile(srcDtsFile.absPath);
60362
60681
  const distDtsContent = updateRindoTypesImports(outputTarget.typesDir, distPath, originalDtsContent);
60363
60682
  await compilerCtx.fs.writeFile(distPath, distDtsContent);
60364
- distDtsFilePath = distPath;
60683
+ return distPath;
60365
60684
  }));
60685
+ const distDtsFilePath = copiedDTSFilePaths.slice(-1)[0];
60366
60686
  const distPath = outputTarget.typesDir;
60367
60687
  await generateAppTypes(config, compilerCtx, buildCtx, distPath);
60688
+ const { typesDir } = outputTarget;
60368
60689
  if (distDtsFilePath) {
60369
- await generateCustomElementsTypes(config, compilerCtx, buildCtx, distDtsFilePath);
60370
60690
  await generateCustomElementsBundleTypes(config, compilerCtx, buildCtx, distDtsFilePath);
60691
+ await generateCustomElementsTypes(config, compilerCtx, buildCtx, typesDir);
60371
60692
  }
60372
60693
  };
60373
60694
 
@@ -64162,37 +64483,76 @@ const filesChanged = (buildCtx) => {
64162
64483
  // files changed include updated, added and deleted
64163
64484
  return unique([...buildCtx.filesUpdated, ...buildCtx.filesAdded, ...buildCtx.filesDeleted]).sort();
64164
64485
  };
64165
- const scriptsAdded = (buildCtx) => {
64166
- // collect all the scripts that were added
64167
- return buildCtx.filesAdded
64168
- .filter((f) => {
64169
- return SCRIPT_EXT.some((ext) => f.endsWith(ext.toLowerCase()));
64170
- })
64171
- .map((f) => basename(f));
64172
- };
64173
- const scriptsDeleted = (buildCtx) => {
64174
- // collect all the scripts that were deleted
64175
- return buildCtx.filesDeleted
64176
- .filter((f) => {
64177
- return SCRIPT_EXT.some((ext) => f.endsWith(ext.toLowerCase()));
64178
- })
64179
- .map((f) => basename(f));
64180
- };
64181
- const hasScriptChanges = (buildCtx) => {
64182
- return buildCtx.filesChanged.some((f) => {
64183
- const ext = getExt(f);
64184
- return SCRIPT_EXT.includes(ext);
64185
- });
64186
- };
64187
- const hasStyleChanges = (buildCtx) => {
64188
- return buildCtx.filesChanged.some((f) => {
64189
- const ext = getExt(f);
64190
- return STYLE_EXT.includes(ext);
64191
- });
64192
- };
64486
+ /**
64487
+ * Unary helper function mapping string to string and wrapping `basename`,
64488
+ * which normally takes two string arguments. This means it cannot be passed
64489
+ * to `Array.prototype.map`, but this little helper can!
64490
+ *
64491
+ * @param filePath a filepath to check out
64492
+ * @returns the basename for that filepath
64493
+ */
64494
+ const unaryBasename = (filePath) => basename(filePath);
64495
+ /**
64496
+ * Get the file extension for a path
64497
+ *
64498
+ * @param filePath a path
64499
+ * @returns the file extension (well, characters after the last `'.'`)
64500
+ */
64193
64501
  const getExt = (filePath) => filePath.split('.').pop().toLowerCase();
64502
+ /**
64503
+ * Script extensions which we want to be able to recognize
64504
+ */
64194
64505
  const SCRIPT_EXT = ['ts', 'tsx', 'js', 'jsx'];
64506
+ /**
64507
+ * Helper to check if a filepath has a script extension
64508
+ *
64509
+ * @param filePath a file extension
64510
+ * @returns whether the filepath has a script extension or not
64511
+ */
64512
+ const hasScriptExt = (filePath) => SCRIPT_EXT.includes(getExt(filePath));
64195
64513
  const STYLE_EXT = ['css', 'scss', 'sass', 'pcss', 'styl', 'stylus', 'less'];
64514
+ /**
64515
+ * Helper to check if a filepath has a style extension
64516
+ *
64517
+ * @param filePath a file extension to check
64518
+ * @returns whether the filepath has a style extension or not
64519
+ */
64520
+ const hasStyleExt = (filePath) => STYLE_EXT.includes(getExt(filePath));
64521
+ /**
64522
+ * Get all scripts from a build context that were added
64523
+ *
64524
+ * @param buildCtx the build context
64525
+ * @returns an array of filepaths that were added
64526
+ */
64527
+ const scriptsAdded = (buildCtx) => buildCtx.filesAdded.filter(hasScriptExt).map(unaryBasename);
64528
+ /**
64529
+ * Get all scripts from a build context that were deleted
64530
+ *
64531
+ * @param buildCtx the build context
64532
+ * @returns an array of deleted filepaths
64533
+ */
64534
+ const scriptsDeleted = (buildCtx) => buildCtx.filesDeleted.filter(hasScriptExt).map(unaryBasename);
64535
+ /**
64536
+ * Check whether a build has script changes
64537
+ *
64538
+ * @param buildCtx the build context
64539
+ * @returns whether or not there are script changes
64540
+ */
64541
+ const hasScriptChanges = (buildCtx) => buildCtx.filesChanged.some(hasScriptExt);
64542
+ /**
64543
+ * Check whether a build has style changes
64544
+ *
64545
+ * @param buildCtx the build context
64546
+ * @returns whether or not there are style changes
64547
+ */
64548
+ const hasStyleChanges = (buildCtx) => buildCtx.filesChanged.some(hasStyleExt);
64549
+ /**
64550
+ * Check whether a build has html changes
64551
+ *
64552
+ * @param config the current config
64553
+ * @param buildCtx the build context
64554
+ * @returns whether or not HTML files were changed
64555
+ */
64196
64556
  const hasHtmlChanges = (config, buildCtx) => {
64197
64557
  const anyHtmlChanged = buildCtx.filesChanged.some((f) => f.toLowerCase().endsWith('.html'));
64198
64558
  if (anyHtmlChanged) {
@@ -65119,7 +65479,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
65119
65479
  const dependencies = [
65120
65480
  {
65121
65481
  name: "@rindo/core",
65122
- version: "2.16.1",
65482
+ version: "2.17.0",
65123
65483
  main: "compiler/rindo.js",
65124
65484
  resources: [
65125
65485
  "package.json",
@@ -66717,6 +67077,21 @@ const createDefaultTsConfig = (config) => JSON.stringify({
66717
67077
  const hasSrcDirectoryInclude = (includeProp, src) => Array.isArray(includeProp) && includeProp.includes(src);
66718
67078
  const hasRindoConfigInclude = (includeProp) => Array.isArray(includeProp) && includeProp.includes('rindo.config.ts');
66719
67079
 
67080
+ /**
67081
+ * Load and validate a configuration to use throughout the lifetime of any Rindo task (build, test, etc.).
67082
+ *
67083
+ * Users can provide configurations multiple ways simultaneously:
67084
+ * - as an object of the `init` argument to this function
67085
+ * - through a path to a configuration file that exists on disk
67086
+ *
67087
+ * In the case of both being present, the two configurations will be merged. The fields of the former will take precedence
67088
+ * over the fields of the latter.
67089
+ *
67090
+ * @param init the initial configuration provided by the user (or generated by Rindo) used to bootstrap configuration
67091
+ * loading and validation
67092
+ * @returns the results of loading a configuration
67093
+ * @public
67094
+ */
66720
67095
  const loadConfig = async (init = {}) => {
66721
67096
  const results = {
66722
67097
  config: null,
@@ -66788,6 +67163,15 @@ const loadConfig = async (init = {}) => {
66788
67163
  }
66789
67164
  return results;
66790
67165
  };
67166
+ /**
67167
+ * Load a Rindo configuration file from disk
67168
+ * @param sys the underlying System entity to use to interact with the operating system
67169
+ * @param diagnostics a series of diagnostics used to track errors & warnings throughout the loading process. Entries
67170
+ * may be added to this list in the event of an error.
67171
+ * @param configPath the path to the configuration file to load
67172
+ * @returns an unvalidated configuration. In the event of an error, additional diagnostics may be pushed to the
67173
+ * provided `diagnostics` argument and `null` will be returned.
67174
+ */
66791
67175
  const loadConfigFile = async (sys, diagnostics, configPath) => {
66792
67176
  let config = null;
66793
67177
  if (isString$1(configPath)) {
@@ -66807,6 +67191,15 @@ const loadConfigFile = async (sys, diagnostics, configPath) => {
66807
67191
  }
66808
67192
  return config;
66809
67193
  };
67194
+ /**
67195
+ * Load the configuration file, based on the environment that Rindo is being run in
67196
+ * @param sys the underlying System entity to use to interact with the operating system
67197
+ * @param diagnostics a series of diagnostics used to track errors & warnings throughout the loading process. Entries
67198
+ * may be added to this list in the event of an error.
67199
+ * @param configFilePath the path to the configuration file to load
67200
+ * @returns an unvalidated configuration. In the event of an error, additional diagnostics may be pushed to the
67201
+ * provided `diagnostics` argument and `null` will be returned.
67202
+ */
66810
67203
  const evaluateConfigFile = async (sys, diagnostics, configFilePath) => {
66811
67204
  let configFileData = null;
66812
67205
  try {
@@ -66831,6 +67224,16 @@ const evaluateConfigFile = async (sys, diagnostics, configFilePath) => {
66831
67224
  }
66832
67225
  return configFileData;
66833
67226
  };
67227
+ /**
67228
+ * Transpiles the provided TypeScript source text into JavaScript.
67229
+ *
67230
+ * This function is intended to be used on a `rindo.config.ts` file
67231
+ *
67232
+ * @param diagnostics a collection of compiler diagnostics to check as a part of the compilation process
67233
+ * @param sourceText the text to transpile
67234
+ * @param filePath the name of the file to transpile
67235
+ * @returns the transpiled text. If there are any diagnostics in the provided collection, the provided source is returned
67236
+ */
66834
67237
  const transpileTypedConfig = (diagnostics, sourceText, filePath) => {
66835
67238
  // let's transpile an awesome rindo.config.ts file into
66836
67239
  // a boring rindo.config.js file