@rindo/core 2.17.0 → 2.17.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/config-flags.d.ts +102 -0
- package/cli/index.cjs +598 -219
- package/cli/index.d.ts +2 -1
- package/cli/index.js +598 -219
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +337 -173
- package/compiler/rindo.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +11 -6
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +2 -2
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -2
- package/internal/rindo-public-compiler.d.ts +67 -48
- package/internal/testing/index.js +1 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +5 -3
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +4 -4
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +40 -24
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/jest/jest-runner.d.ts +3 -2
- package/testing/jest/jest-screenshot.d.ts +1 -1
- package/testing/mocks.d.ts +27 -2
- package/testing/package.json +1 -1
- package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
- package/testing/testing-utils.d.ts +74 -2
- package/testing/testing.d.ts +2 -2
package/compiler/rindo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Compiler v2.17.
|
|
2
|
+
Rindo Compiler v2.17.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -727,12 +727,27 @@ const trimFalsy = (data) => {
|
|
|
727
727
|
return arr;
|
|
728
728
|
};
|
|
729
729
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Convert a string from PascalCase to dash-case
|
|
732
|
+
*
|
|
733
|
+
* @param str the string to convert
|
|
734
|
+
* @returns a converted string
|
|
735
|
+
*/
|
|
736
|
+
const toDashCase = (str) => str
|
|
737
|
+
.replace(/([A-Z0-9])/g, (match) => ` ${match[0]}`)
|
|
733
738
|
.trim()
|
|
734
|
-
.
|
|
735
|
-
|
|
739
|
+
.split(' ')
|
|
740
|
+
.join('-')
|
|
741
|
+
.toLowerCase();
|
|
742
|
+
/**
|
|
743
|
+
* Convert a string from dash-case / kebab-case to PascalCase (or CamelCase,
|
|
744
|
+
* or whatever you call it!)
|
|
745
|
+
*
|
|
746
|
+
* @param str a string to convert
|
|
747
|
+
* @returns a converted string
|
|
748
|
+
*/
|
|
749
|
+
const dashToPascalCase$1 = (str) => str
|
|
750
|
+
.toLowerCase()
|
|
736
751
|
.split('-')
|
|
737
752
|
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
738
753
|
.join('');
|
|
@@ -789,8 +804,8 @@ const pluck = (obj, keys) => {
|
|
|
789
804
|
return final;
|
|
790
805
|
}, {});
|
|
791
806
|
};
|
|
792
|
-
const isBoolean$1 = (v) => typeof v === 'boolean';
|
|
793
807
|
const isDefined = (v) => v !== null && v !== undefined;
|
|
808
|
+
const isBoolean$1 = (v) => typeof v === 'boolean';
|
|
794
809
|
const isFunction = (v) => typeof v === 'function';
|
|
795
810
|
const isNumber$1 = (v) => typeof v === 'number';
|
|
796
811
|
const isObject$4 = (val) => val != null && typeof val === 'object' && Array.isArray(val) === false;
|
|
@@ -1631,7 +1646,7 @@ const isDtsFile$1 = (filePath) => {
|
|
|
1631
1646
|
/**
|
|
1632
1647
|
* Generate the preamble to be placed atop the main file of the build
|
|
1633
1648
|
* @param config the Rindo configuration file
|
|
1634
|
-
* @
|
|
1649
|
+
* @returns the generated preamble
|
|
1635
1650
|
*/
|
|
1636
1651
|
const generatePreamble = (config) => {
|
|
1637
1652
|
const { preamble } = config;
|
|
@@ -2026,10 +2041,14 @@ const buildEvents = () => {
|
|
|
2026
2041
|
};
|
|
2027
2042
|
};
|
|
2028
2043
|
|
|
2044
|
+
/**
|
|
2045
|
+
* Creates an instance of a logger
|
|
2046
|
+
* @returns the new logger instance
|
|
2047
|
+
*/
|
|
2029
2048
|
const createLogger = () => {
|
|
2030
2049
|
let useColors = IS_BROWSER_ENV;
|
|
2031
2050
|
let level = 'info';
|
|
2032
|
-
|
|
2051
|
+
return {
|
|
2033
2052
|
enableColors: (uc) => (useColors = uc),
|
|
2034
2053
|
getLevel: () => level,
|
|
2035
2054
|
setLevel: (l) => (level = l),
|
|
@@ -2056,7 +2075,6 @@ const createLogger = () => {
|
|
|
2056
2075
|
diagnostics.forEach((diagnostic) => logDiagnostic(diagnostic, useColors));
|
|
2057
2076
|
},
|
|
2058
2077
|
};
|
|
2059
|
-
return logger;
|
|
2060
2078
|
};
|
|
2061
2079
|
const logDiagnostic = (diagnostic, useColors) => {
|
|
2062
2080
|
let color = BLUE;
|
|
@@ -2346,8 +2364,16 @@ const getPackageDirPath = (p, moduleId) => {
|
|
|
2346
2364
|
return null;
|
|
2347
2365
|
};
|
|
2348
2366
|
|
|
2367
|
+
/**
|
|
2368
|
+
* A fetch wrapper which dispatches to `sys.fetch` if present, and otherwise
|
|
2369
|
+
* uses `global.fetch`.
|
|
2370
|
+
*
|
|
2371
|
+
* @param sys a compiler system object
|
|
2372
|
+
* @param input a `RequestInfo` object
|
|
2373
|
+
* @param init an optional `RequestInit` object
|
|
2374
|
+
* @returns a Promise wrapping a response
|
|
2375
|
+
*/
|
|
2349
2376
|
const httpFetch = (sys, input, init) => {
|
|
2350
|
-
console.trace(input);
|
|
2351
2377
|
if (sys && isFunction(sys.fetch)) {
|
|
2352
2378
|
return sys.fetch(input, init);
|
|
2353
2379
|
}
|
|
@@ -2355,10 +2381,16 @@ const httpFetch = (sys, input, init) => {
|
|
|
2355
2381
|
};
|
|
2356
2382
|
const packageVersions = new Map();
|
|
2357
2383
|
const known404Urls = new Set();
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2384
|
+
/**
|
|
2385
|
+
* Get the URL for a Rindo module given the path to the compiler
|
|
2386
|
+
*
|
|
2387
|
+
* @param compilerExe the path to the compiler executable
|
|
2388
|
+
* @param path the path to the module or file in question
|
|
2389
|
+
* @returns a URL for the file of interest
|
|
2390
|
+
*/
|
|
2391
|
+
const getRindoModuleUrl = (compilerExe, path) => {
|
|
2392
|
+
path = normalizePath$1(path);
|
|
2393
|
+
let parts = path.split('/');
|
|
2362
2394
|
const nmIndex = parts.lastIndexOf('node_modules');
|
|
2363
2395
|
if (nmIndex > -1 && nmIndex < parts.length - 1) {
|
|
2364
2396
|
parts = parts.slice(nmIndex + 1);
|
|
@@ -2368,9 +2400,10 @@ const getRindoModuleUrl = (compilerExe, p) => {
|
|
|
2368
2400
|
else {
|
|
2369
2401
|
parts = parts.slice(1);
|
|
2370
2402
|
}
|
|
2371
|
-
|
|
2403
|
+
path = parts.join('/');
|
|
2372
2404
|
}
|
|
2373
|
-
|
|
2405
|
+
const rindoRootUrl = new URL('../', compilerExe).href;
|
|
2406
|
+
return new URL('./' + path, rindoRootUrl).href;
|
|
2374
2407
|
};
|
|
2375
2408
|
const getCommonDirUrl = (sys, pkgVersions, dirPath, fileName) => getNodeModuleFetchUrl(sys, pkgVersions, dirPath) + '/' + fileName;
|
|
2376
2409
|
const getNodeModuleFetchUrl = (sys, pkgVersions, filePath) => {
|
|
@@ -4542,7 +4575,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
|
|
|
4542
4575
|
};
|
|
4543
4576
|
};
|
|
4544
4577
|
|
|
4545
|
-
const buildId = '
|
|
4578
|
+
const buildId = '20230111074933';
|
|
4546
4579
|
const minfyJsId = 'terser5.6.1_7';
|
|
4547
4580
|
const optimizeCssId = 'autoprefixer10.2.5_postcss8.4.16_7';
|
|
4548
4581
|
const parse5Version = '6.0.1';
|
|
@@ -4550,8 +4583,8 @@ const rollupVersion = '2.42.3';
|
|
|
4550
4583
|
const sizzleVersion = '2.42.3';
|
|
4551
4584
|
const terserVersion = '5.6.1';
|
|
4552
4585
|
const typescriptVersion = '4.5.4';
|
|
4553
|
-
const vermoji = '
|
|
4554
|
-
const version$3 = '2.17.
|
|
4586
|
+
const vermoji = '🍏';
|
|
4587
|
+
const version$3 = '2.17.1';
|
|
4555
4588
|
const versions = {
|
|
4556
4589
|
rindo: version$3,
|
|
4557
4590
|
parse5: parse5Version,
|
|
@@ -5100,6 +5133,17 @@ const createSystem = (c) => {
|
|
|
5100
5133
|
};
|
|
5101
5134
|
|
|
5102
5135
|
let cssProcessor;
|
|
5136
|
+
/**
|
|
5137
|
+
* Autoprefix a CSS string, adding vendor prefixes to make sure that what
|
|
5138
|
+
* is written in the CSS will render correctly in our range of supported browsers.
|
|
5139
|
+
* This function uses PostCSS in compbination with the Autoprefix plugin to
|
|
5140
|
+
* automatically add vendor prefixes based on a list of browsers which we want
|
|
5141
|
+
* to support.
|
|
5142
|
+
*
|
|
5143
|
+
* @param cssText the text to be prefixed
|
|
5144
|
+
* @param opts an optional param with options for Autoprefixer
|
|
5145
|
+
* @returns a Promise wrapping some prefixed CSS as well as diagnostics
|
|
5146
|
+
*/
|
|
5103
5147
|
const autoprefixCss = async (cssText, opts) => {
|
|
5104
5148
|
const output = {
|
|
5105
5149
|
output: cssText,
|
|
@@ -5109,7 +5153,7 @@ const autoprefixCss = async (cssText, opts) => {
|
|
|
5109
5153
|
return output;
|
|
5110
5154
|
}
|
|
5111
5155
|
try {
|
|
5112
|
-
const autoprefixerOpts = opts != null && typeof opts === 'object' ? opts :
|
|
5156
|
+
const autoprefixerOpts = opts != null && typeof opts === 'object' ? opts : DEFAULT_AUTOPREFIX_OPTIONS;
|
|
5113
5157
|
const processor = getProcessor(autoprefixerOpts);
|
|
5114
5158
|
const result = await processor.process(cssText, { map: null });
|
|
5115
5159
|
result.warnings().forEach((warning) => {
|
|
@@ -5165,6 +5209,12 @@ const autoprefixCss = async (cssText, opts) => {
|
|
|
5165
5209
|
}
|
|
5166
5210
|
return output;
|
|
5167
5211
|
};
|
|
5212
|
+
/**
|
|
5213
|
+
* Get the processor for PostCSS and the Autoprefixer plugin
|
|
5214
|
+
*
|
|
5215
|
+
* @param autoprefixerOpts Options for Autoprefixer
|
|
5216
|
+
* @returns postCSS with the Autoprefixer plugin applied
|
|
5217
|
+
*/
|
|
5168
5218
|
const getProcessor = (autoprefixerOpts) => {
|
|
5169
5219
|
const { postcss, autoprefixer } = requireFunc('../sys/node/autoprefixer.js');
|
|
5170
5220
|
if (!cssProcessor) {
|
|
@@ -5172,7 +5222,19 @@ const getProcessor = (autoprefixerOpts) => {
|
|
|
5172
5222
|
}
|
|
5173
5223
|
return cssProcessor;
|
|
5174
5224
|
};
|
|
5175
|
-
|
|
5225
|
+
/**
|
|
5226
|
+
* Default options for the Autoprefixer PostCSS plugin. See the documentation:
|
|
5227
|
+
* https://github.com/postcss/autoprefixer#options for a complete list.
|
|
5228
|
+
*
|
|
5229
|
+
* This default option set will:
|
|
5230
|
+
*
|
|
5231
|
+
* - override the default browser list (`overrideBrowserslist`)
|
|
5232
|
+
* - turn off the visual cascade (`cascade`)
|
|
5233
|
+
* - disable auto-removing outdated prefixes (`remove`)
|
|
5234
|
+
* - set `flexbox` to `"no-2009"`, which limits prefixing for flexbox to the
|
|
5235
|
+
* final and IE 10 versions of the specification
|
|
5236
|
+
*/
|
|
5237
|
+
const DEFAULT_AUTOPREFIX_OPTIONS = {
|
|
5176
5238
|
overrideBrowserslist: ['last 2 versions', 'iOS >= 9', 'Android >= 4.4', 'Explorer >= 11', 'ExplorerMobile >= 11'],
|
|
5177
5239
|
cascade: false,
|
|
5178
5240
|
remove: false,
|
|
@@ -5968,6 +6030,13 @@ const resolveStylesheetUrl = async (nodes, resolveUrl, resolved) => {
|
|
|
5968
6030
|
}
|
|
5969
6031
|
};
|
|
5970
6032
|
|
|
6033
|
+
/**
|
|
6034
|
+
* Optimize a CSS file, optionally running an autoprefixer and a minifier
|
|
6035
|
+
* depending on the options set on the input options argument.
|
|
6036
|
+
*
|
|
6037
|
+
* @param inputOpts input CSS options
|
|
6038
|
+
* @returns a promise wrapping the optimized output
|
|
6039
|
+
*/
|
|
5971
6040
|
const optimizeCss$1 = async (inputOpts) => {
|
|
5972
6041
|
let result = {
|
|
5973
6042
|
output: inputOpts.input,
|
|
@@ -12026,6 +12095,12 @@ const parseImportPath = (importPath) => {
|
|
|
12026
12095
|
return parsedPath;
|
|
12027
12096
|
};
|
|
12028
12097
|
|
|
12098
|
+
/**
|
|
12099
|
+
* Strip out comments from some CSS
|
|
12100
|
+
*
|
|
12101
|
+
* @param input the string we'd like to de-comment
|
|
12102
|
+
* @returns de-commented CSS!
|
|
12103
|
+
*/
|
|
12029
12104
|
const stripCssComments = (input) => {
|
|
12030
12105
|
let isInsideString = null;
|
|
12031
12106
|
let currentCharacter = '';
|
|
@@ -19350,48 +19425,88 @@ const emptyOutputTargets = async (config, compilerCtx, buildCtx) => {
|
|
|
19350
19425
|
timeSpan.finish('cleaning dirs finished');
|
|
19351
19426
|
};
|
|
19352
19427
|
|
|
19428
|
+
/**
|
|
19429
|
+
* Parse CSS imports into an object which contains a manifest of imports and a
|
|
19430
|
+
* stylesheet with all imports resolved and concatenated.
|
|
19431
|
+
*
|
|
19432
|
+
* @param config the current config
|
|
19433
|
+
* @param compilerCtx the compiler context (we need filesystem access)
|
|
19434
|
+
* @param buildCtx the build context, we'll need access to diagnostics
|
|
19435
|
+
* @param srcFilePath the source filepath
|
|
19436
|
+
* @param resolvedFilePath the resolved filepath
|
|
19437
|
+
* @param styleText style text we start with
|
|
19438
|
+
* @param styleDocs optional array of style document objects
|
|
19439
|
+
* @returns an object with concatenated styleText and imports
|
|
19440
|
+
*/
|
|
19353
19441
|
const parseCssImports = async (config, compilerCtx, buildCtx, srcFilePath, resolvedFilePath, styleText, styleDocs) => {
|
|
19354
19442
|
const isCssEntry = resolvedFilePath.toLowerCase().endsWith('.css');
|
|
19355
19443
|
const allCssImports = [];
|
|
19356
|
-
|
|
19444
|
+
// a Set of previously-resolved file paths that we add to as we traverse the
|
|
19445
|
+
// import tree (to avoid a possible circular dependency and infinite loop)
|
|
19446
|
+
const resolvedFilePaths = new Set();
|
|
19447
|
+
const concatStyleText = await resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText);
|
|
19357
19448
|
return {
|
|
19358
19449
|
imports: allCssImports,
|
|
19359
19450
|
styleText: concatStyleText,
|
|
19360
19451
|
};
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
if (
|
|
19376
|
-
|
|
19452
|
+
/**
|
|
19453
|
+
* Resolve and flatten all imports for a given CSS file, recursively crawling
|
|
19454
|
+
* the tree of imports to resolve them all and produce a concatenated
|
|
19455
|
+
* stylesheet. We declare this function here, within `parseCssImports`, in order
|
|
19456
|
+
* to get access to `compilerCtx`, `buildCtx`, and more without having to pass
|
|
19457
|
+
* a whole bunch of arguments.
|
|
19458
|
+
*
|
|
19459
|
+
* @param srcFilePath the source filepath
|
|
19460
|
+
* @param resolvedFilePath the resolved filepath
|
|
19461
|
+
* @param styleText style text we start with*
|
|
19462
|
+
* @returns concatenated styles assembled from the various imported stylesheets
|
|
19463
|
+
*/
|
|
19464
|
+
async function resolveAndFlattenImports(srcFilePath, resolvedFilePath, styleText) {
|
|
19465
|
+
// if we've seen this path before we early return
|
|
19466
|
+
if (resolvedFilePaths.has(resolvedFilePath)) {
|
|
19467
|
+
return styleText;
|
|
19468
|
+
}
|
|
19469
|
+
resolvedFilePaths.add(resolvedFilePath);
|
|
19470
|
+
if (styleDocs != null) {
|
|
19471
|
+
parseStyleDocs(styleDocs, styleText);
|
|
19472
|
+
}
|
|
19473
|
+
const cssImports = await getCssImports(config, compilerCtx, buildCtx, resolvedFilePath, styleText);
|
|
19474
|
+
if (cssImports.length === 0) {
|
|
19475
|
+
return styleText;
|
|
19476
|
+
}
|
|
19477
|
+
// add any newly-found imports to the 'global' list
|
|
19478
|
+
for (const cssImport of cssImports) {
|
|
19479
|
+
if (!allCssImports.includes(cssImport.filePath)) {
|
|
19480
|
+
allCssImports.push(cssImport.filePath);
|
|
19481
|
+
}
|
|
19377
19482
|
}
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
|
|
19483
|
+
// Recur down the tree of CSS imports, resolving all the imports in
|
|
19484
|
+
// the children of the current file (and, by extension, in their children
|
|
19485
|
+
// and so on)
|
|
19486
|
+
await Promise.all(cssImports.map(async (cssImportData) => {
|
|
19487
|
+
cssImportData.styleText = await loadStyleText(compilerCtx, cssImportData);
|
|
19488
|
+
if (typeof cssImportData.styleText === 'string') {
|
|
19489
|
+
cssImportData.styleText = await resolveAndFlattenImports(cssImportData.filePath, cssImportData.filePath, cssImportData.styleText);
|
|
19490
|
+
}
|
|
19491
|
+
else {
|
|
19492
|
+
// we had some error loading the file from disk, so write a diagnostic
|
|
19493
|
+
const err = buildError(buildCtx.diagnostics);
|
|
19494
|
+
err.messageText = `Unable to read css import: ${cssImportData.srcImport}`;
|
|
19495
|
+
err.absFilePath = srcFilePath;
|
|
19496
|
+
}
|
|
19497
|
+
}));
|
|
19498
|
+
// replace import statements with the actual CSS code in children modules
|
|
19499
|
+
return replaceImportDeclarations(styleText, cssImports, isCssEntry);
|
|
19393
19500
|
}
|
|
19394
19501
|
};
|
|
19502
|
+
/**
|
|
19503
|
+
* Load the style text for a CSS file from disk, based on the filepaths set in
|
|
19504
|
+
* our import data.
|
|
19505
|
+
*
|
|
19506
|
+
* @param compilerCtx the compiler context
|
|
19507
|
+
* @param cssImportData the import data for the file we want to read
|
|
19508
|
+
* @returns the contents of the file, if it can be read without error
|
|
19509
|
+
*/
|
|
19395
19510
|
const loadStyleText = async (compilerCtx, cssImportData) => {
|
|
19396
19511
|
let styleText = null;
|
|
19397
19512
|
try {
|
|
@@ -19407,7 +19522,18 @@ const loadStyleText = async (compilerCtx, cssImportData) => {
|
|
|
19407
19522
|
}
|
|
19408
19523
|
return styleText;
|
|
19409
19524
|
};
|
|
19525
|
+
/**
|
|
19526
|
+
* Get a manifest of all the CSS imports in a given CSS file
|
|
19527
|
+
*
|
|
19528
|
+
* @param config the current config
|
|
19529
|
+
* @param compilerCtx the compiler context (we need the filesystem)
|
|
19530
|
+
* @param buildCtx the build context, in case we need to set a diagnostic
|
|
19531
|
+
* @param filePath the filepath we're working with
|
|
19532
|
+
* @param styleText the CSS for which we want to retrieve import data
|
|
19533
|
+
* @returns a Promise wrapping a list of CSS import data objects
|
|
19534
|
+
*/
|
|
19410
19535
|
const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText) => {
|
|
19536
|
+
var _a;
|
|
19411
19537
|
const imports = [];
|
|
19412
19538
|
if (!styleText.includes('@import')) {
|
|
19413
19539
|
// no @import at all, so don't bother
|
|
@@ -19415,13 +19541,14 @@ const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText)
|
|
|
19415
19541
|
}
|
|
19416
19542
|
styleText = stripCssComments(styleText);
|
|
19417
19543
|
const dir = dirname(filePath);
|
|
19418
|
-
const importeeExt = filePath.split('.').pop().toLowerCase();
|
|
19544
|
+
const importeeExt = ((_a = filePath.split('.').pop()) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
19419
19545
|
let r;
|
|
19420
19546
|
const IMPORT_RE = /(@import)\s+(url\()?\s?(.*?)\s?\)?([^;]*);?/gi;
|
|
19421
19547
|
while ((r = IMPORT_RE.exec(styleText))) {
|
|
19422
19548
|
const cssImportData = {
|
|
19423
19549
|
srcImport: r[0],
|
|
19424
19550
|
url: r[4].replace(/[\"\'\)]/g, ''),
|
|
19551
|
+
filePath: '',
|
|
19425
19552
|
};
|
|
19426
19553
|
if (!isLocalCssImport(cssImportData.srcImport)) {
|
|
19427
19554
|
// do nothing for @import url(http://external.css)
|
|
@@ -19448,7 +19575,10 @@ const getCssImports = async (config, compilerCtx, buildCtx, filePath, styleText)
|
|
|
19448
19575
|
cssImportData.altFilePath = normalizePath$1(join(dirPath, fileName));
|
|
19449
19576
|
}
|
|
19450
19577
|
}
|
|
19451
|
-
|
|
19578
|
+
// we set `filePath` to `""` when the object is created above, so if it
|
|
19579
|
+
// hasn't been changed in the intervening conditionals then we didn't resolve
|
|
19580
|
+
// a filepath for it.
|
|
19581
|
+
if (cssImportData.filePath !== '') {
|
|
19452
19582
|
imports.push(cssImportData);
|
|
19453
19583
|
}
|
|
19454
19584
|
}
|
|
@@ -19490,6 +19620,16 @@ const isLocalCssImport = (srcImport) => {
|
|
|
19490
19620
|
}
|
|
19491
19621
|
return true;
|
|
19492
19622
|
};
|
|
19623
|
+
/**
|
|
19624
|
+
* Replace import declarations (like '@import "foobar";') with the actual CSS
|
|
19625
|
+
* written in the imported module, allowing us to produce a single file from a
|
|
19626
|
+
* tree of stylesheets.
|
|
19627
|
+
*
|
|
19628
|
+
* @param styleText the text within which we want to replace @import statements
|
|
19629
|
+
* @param cssImports information about imported modules
|
|
19630
|
+
* @param isCssEntry whether we're dealing with a CSS file
|
|
19631
|
+
* @returns an updated string with the requisite substitutions
|
|
19632
|
+
*/
|
|
19493
19633
|
const replaceImportDeclarations = (styleText, cssImports, isCssEntry) => {
|
|
19494
19634
|
for (const cssImport of cssImports) {
|
|
19495
19635
|
if (isCssEntry) {
|
|
@@ -42299,7 +42439,7 @@ const createCustomResolverSync = (sys, inMemoryFs, exts) => {
|
|
|
42299
42439
|
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d121716ed123957f6a86f8985eb013fcaddab345/types/node/globals.d.ts#L183-L188
|
|
42300
42440
|
* in mind.
|
|
42301
42441
|
* @param err the entity to check the type of
|
|
42302
|
-
* @
|
|
42442
|
+
* @returns true if the provided value is an instance of `ErrnoException`, `false` otherwise
|
|
42303
42443
|
*/
|
|
42304
42444
|
function isErrnoException(err) {
|
|
42305
42445
|
return err instanceof Error && err.hasOwnProperty('code');
|
|
@@ -58336,6 +58476,16 @@ const lazyComponentTransform = (compilerCtx, transformOpts) => {
|
|
|
58336
58476
|
};
|
|
58337
58477
|
};
|
|
58338
58478
|
|
|
58479
|
+
/**
|
|
58480
|
+
* Generate rollup output based on a rollup build and a series of options.
|
|
58481
|
+
*
|
|
58482
|
+
* @param build a rollup build
|
|
58483
|
+
* @param options output options for rollup
|
|
58484
|
+
* @param config a user-supplied configuration object
|
|
58485
|
+
* @param entryModules a list of entry modules, for checking which chunks
|
|
58486
|
+
* contain components
|
|
58487
|
+
* @returns a Promise wrapping either build results or `null`
|
|
58488
|
+
*/
|
|
58339
58489
|
const generateRollupOutput = async (build, options, config, entryModules) => {
|
|
58340
58490
|
if (build == null) {
|
|
58341
58491
|
return null;
|
|
@@ -58343,7 +58493,7 @@ const generateRollupOutput = async (build, options, config, entryModules) => {
|
|
|
58343
58493
|
const { output } = await build.generate(options);
|
|
58344
58494
|
return output.map((chunk) => {
|
|
58345
58495
|
if (chunk.type === 'chunk') {
|
|
58346
|
-
const isCore = Object.keys(chunk.modules).some((m) => m.includes(
|
|
58496
|
+
const isCore = Object.keys(chunk.modules).some((m) => m.includes(RINDO_CORE_ID));
|
|
58347
58497
|
return {
|
|
58348
58498
|
type: 'chunk',
|
|
58349
58499
|
fileName: chunk.fileName,
|
|
@@ -58842,7 +58992,8 @@ const getSystemLoader = async (config, compilerCtx, corePath, includePolyfills)
|
|
|
58842
58992
|
|
|
58843
58993
|
var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
|
|
58844
58994
|
var start = function() {
|
|
58845
|
-
|
|
58995
|
+
// if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
|
|
58996
|
+
var url = new URL('${corePath}', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
|
|
58846
58997
|
System.import(url.href);
|
|
58847
58998
|
};
|
|
58848
58999
|
|
|
@@ -64767,15 +64918,14 @@ const updateCompilerCtxCache = (config, compilerCtx, path, kind) => {
|
|
|
64767
64918
|
};
|
|
64768
64919
|
|
|
64769
64920
|
const getConfig = (userConfig) => {
|
|
64770
|
-
|
|
64771
|
-
|
|
64772
|
-
|
|
64773
|
-
}
|
|
64921
|
+
var _a, _b;
|
|
64922
|
+
const flags = (_a = userConfig.flags) !== null && _a !== void 0 ? _a : {};
|
|
64923
|
+
const logger = (_b = userConfig.logger) !== null && _b !== void 0 ? _b : createLogger();
|
|
64924
|
+
const config = { ...userConfig, flags, logger };
|
|
64774
64925
|
if (!config.sys) {
|
|
64775
64926
|
config.sys = createSystem({ logger: config.logger });
|
|
64776
64927
|
}
|
|
64777
64928
|
setPlatformPath(config.sys.platformPath);
|
|
64778
|
-
config.flags = config.flags || {};
|
|
64779
64929
|
if (config.flags.debug || config.flags.verbose) {
|
|
64780
64930
|
config.logLevel = 'debug';
|
|
64781
64931
|
}
|
|
@@ -64796,14 +64946,15 @@ const patchFs = (userSys) => {
|
|
|
64796
64946
|
|
|
64797
64947
|
/**
|
|
64798
64948
|
* Generate a Rindo compiler instance
|
|
64799
|
-
* @param
|
|
64949
|
+
* @param userConfig a user-provided a Rindo configuration to apply to the compiler instance
|
|
64800
64950
|
* @returns a new instance of a Rindo compiler
|
|
64951
|
+
* @public
|
|
64801
64952
|
*/
|
|
64802
|
-
const createCompiler = async (
|
|
64953
|
+
const createCompiler = async (userConfig) => {
|
|
64803
64954
|
// actual compiler code
|
|
64804
64955
|
// could be in a web worker on the browser
|
|
64805
64956
|
// or the main thread in node
|
|
64806
|
-
config = getConfig(
|
|
64957
|
+
const config = getConfig(userConfig);
|
|
64807
64958
|
const diagnostics = [];
|
|
64808
64959
|
const sys = config.sys;
|
|
64809
64960
|
const compilerCtx = new CompilerContext();
|
|
@@ -65479,7 +65630,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
65479
65630
|
const dependencies = [
|
|
65480
65631
|
{
|
|
65481
65632
|
name: "@rindo/core",
|
|
65482
|
-
version: "2.17.
|
|
65633
|
+
version: "2.17.1",
|
|
65483
65634
|
main: "compiler/rindo.js",
|
|
65484
65635
|
resources: [
|
|
65485
65636
|
"package.json",
|
|
@@ -65651,11 +65802,11 @@ const getUserConfigName = (config, correctConfigName) => {
|
|
|
65651
65802
|
};
|
|
65652
65803
|
|
|
65653
65804
|
const validateDevServer = (config, diagnostics) => {
|
|
65654
|
-
var _a, _b, _c, _d, _e
|
|
65805
|
+
var _a, _b, _c, _d, _e;
|
|
65655
65806
|
if ((config.devServer === null || config.devServer) === false) {
|
|
65656
65807
|
return undefined;
|
|
65657
65808
|
}
|
|
65658
|
-
const flags
|
|
65809
|
+
const { flags } = config;
|
|
65659
65810
|
const devServer = { ...config.devServer };
|
|
65660
65811
|
if (flags.address && isString$1(flags.address)) {
|
|
65661
65812
|
devServer.address = flags.address;
|
|
@@ -65713,14 +65864,14 @@ const validateDevServer = (config, diagnostics) => {
|
|
|
65713
65864
|
if (!isBoolean$1(devServer.websocket)) {
|
|
65714
65865
|
devServer.websocket = true;
|
|
65715
65866
|
}
|
|
65716
|
-
if (
|
|
65867
|
+
if (flags.ssr) {
|
|
65717
65868
|
devServer.ssr = true;
|
|
65718
65869
|
}
|
|
65719
65870
|
else {
|
|
65720
65871
|
devServer.ssr = !!devServer.ssr;
|
|
65721
65872
|
}
|
|
65722
65873
|
if (devServer.ssr) {
|
|
65723
|
-
const wwwOutput = ((
|
|
65874
|
+
const wwwOutput = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).find(isOutputTargetWww);
|
|
65724
65875
|
devServer.prerenderConfig = wwwOutput === null || wwwOutput === void 0 ? void 0 : wwwOutput.prerenderConfig;
|
|
65725
65876
|
}
|
|
65726
65877
|
if (isString$1(config.srcIndexHtml)) {
|
|
@@ -65746,15 +65897,15 @@ const validateDevServer = (config, diagnostics) => {
|
|
|
65746
65897
|
}
|
|
65747
65898
|
let serveDir;
|
|
65748
65899
|
let basePath;
|
|
65749
|
-
const wwwOutputTarget = ((
|
|
65900
|
+
const wwwOutputTarget = ((_b = config.outputTargets) !== null && _b !== void 0 ? _b : []).find(isOutputTargetWww);
|
|
65750
65901
|
if (wwwOutputTarget) {
|
|
65751
|
-
const baseUrl = new URL((
|
|
65902
|
+
const baseUrl = new URL((_c = wwwOutputTarget.baseUrl) !== null && _c !== void 0 ? _c : '', 'http://config-rindojs.web.app');
|
|
65752
65903
|
basePath = baseUrl.pathname;
|
|
65753
|
-
serveDir = (
|
|
65904
|
+
serveDir = (_d = wwwOutputTarget.appDir) !== null && _d !== void 0 ? _d : '';
|
|
65754
65905
|
}
|
|
65755
65906
|
else {
|
|
65756
65907
|
basePath = '';
|
|
65757
|
-
serveDir = (
|
|
65908
|
+
serveDir = (_e = config.rootDir) !== null && _e !== void 0 ? _e : '';
|
|
65758
65909
|
}
|
|
65759
65910
|
if (!isString$1(basePath) || basePath.trim() === '') {
|
|
65760
65911
|
basePath = `/`;
|
|
@@ -65888,11 +66039,19 @@ const validateHydrated = (config) => {
|
|
|
65888
66039
|
return hydratedFlag;
|
|
65889
66040
|
};
|
|
65890
66041
|
|
|
66042
|
+
/**
|
|
66043
|
+
* Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
|
|
66044
|
+
* property is set on them.
|
|
66045
|
+
*
|
|
66046
|
+
* @param config the user-supplied configuration object
|
|
66047
|
+
* @param userOutputs an array of output targets
|
|
66048
|
+
* @returns an array of validated DIST_COLLECTION output targets
|
|
66049
|
+
*/
|
|
65891
66050
|
const validateCollection = (config, userOutputs) => {
|
|
65892
|
-
return userOutputs.filter(isOutputTargetDistCollection).map((
|
|
66051
|
+
return userOutputs.filter(isOutputTargetDistCollection).map((outputTarget) => {
|
|
65893
66052
|
return {
|
|
65894
|
-
...
|
|
65895
|
-
dir: getAbsolutePath(config,
|
|
66053
|
+
...outputTarget,
|
|
66054
|
+
dir: getAbsolutePath(config, outputTarget.dir || 'dist/collection'),
|
|
65896
66055
|
};
|
|
65897
66056
|
});
|
|
65898
66057
|
};
|
|
@@ -66226,7 +66385,7 @@ const validateHydrateScript = (config, userOutputs) => {
|
|
|
66226
66385
|
// we don't already have a hydrate output target
|
|
66227
66386
|
// let's still see if we require one because of other output targets
|
|
66228
66387
|
const hasWwwOutput = userOutputs.filter(isOutputTargetWww).some((o) => isString$1(o.indexHtml));
|
|
66229
|
-
const shouldBuildHydrate =
|
|
66388
|
+
const shouldBuildHydrate = config.flags.prerender || config.flags.ssr;
|
|
66230
66389
|
if (hasWwwOutput && shouldBuildHydrate) {
|
|
66231
66390
|
// we're prerendering a www output target, so we'll need a hydrate app
|
|
66232
66391
|
let hydrateDir;
|
|
@@ -66302,7 +66461,7 @@ const validateStats = (userConfig, userOutputs) => {
|
|
|
66302
66461
|
};
|
|
66303
66462
|
|
|
66304
66463
|
const validatePrerender = (config, diagnostics, outputTarget) => {
|
|
66305
|
-
if (!config.flags
|
|
66464
|
+
if (!config.flags.ssr && !config.flags.prerender && config.flags.task !== 'prerender') {
|
|
66306
66465
|
return;
|
|
66307
66466
|
}
|
|
66308
66467
|
outputTarget.baseUrl = normalizePath$1(outputTarget.baseUrl);
|
|
@@ -66327,8 +66486,6 @@ const validatePrerender = (config, diagnostics, outputTarget) => {
|
|
|
66327
66486
|
}
|
|
66328
66487
|
};
|
|
66329
66488
|
|
|
66330
|
-
const HOST_CONFIG_FILENAME = 'host.config.json';
|
|
66331
|
-
|
|
66332
66489
|
const validateServiceWorker = (config, outputTarget) => {
|
|
66333
66490
|
if (outputTarget.serviceWorker === false) {
|
|
66334
66491
|
return;
|
|
@@ -66381,14 +66538,15 @@ const validateServiceWorker = (config, outputTarget) => {
|
|
|
66381
66538
|
}
|
|
66382
66539
|
};
|
|
66383
66540
|
const addGlobIgnores = (config, globIgnores) => {
|
|
66384
|
-
globIgnores.push(
|
|
66541
|
+
globIgnores.push(`**/host.config.json`, // the filename of the host configuration
|
|
66542
|
+
`**/*.system.entry.js`, `**/*.system.js`, `**/${config.fsNamespace}.js`, `**/${config.fsNamespace}.esm.js`, `**/${config.fsNamespace}.css`);
|
|
66385
66543
|
};
|
|
66386
66544
|
const DEFAULT_GLOB_PATTERNS = ['*.html', '**/*.{js,css,json}'];
|
|
66387
66545
|
const DEFAULT_FILENAME = 'sw.js';
|
|
66388
66546
|
|
|
66389
66547
|
const validateWww = (config, diagnostics, userOutputs) => {
|
|
66390
66548
|
const hasOutputTargets = userOutputs.length > 0;
|
|
66391
|
-
const hasE2eTests = !!
|
|
66549
|
+
const hasE2eTests = !!config.flags.e2e;
|
|
66392
66550
|
const userWwwOutputs = userOutputs.filter(isOutputTargetWww);
|
|
66393
66551
|
if (!hasOutputTargets ||
|
|
66394
66552
|
(hasE2eTests && !userOutputs.some(isOutputTargetWww) && !userOutputs.some(isOutputTargetDist))) {
|
|
@@ -66642,7 +66800,7 @@ const DEFAULT_ROLLUP_CONFIG = {
|
|
|
66642
66800
|
const validateTesting = (config, diagnostics) => {
|
|
66643
66801
|
var _a;
|
|
66644
66802
|
const testing = (config.testing = Object.assign({}, config.testing || {}));
|
|
66645
|
-
if (!config.flags
|
|
66803
|
+
if (!config.flags.e2e && !config.flags.spec) {
|
|
66646
66804
|
return;
|
|
66647
66805
|
}
|
|
66648
66806
|
let configPathDir = config.configPath;
|
|
@@ -66680,7 +66838,7 @@ const validateTesting = (config, diagnostics) => {
|
|
|
66680
66838
|
else {
|
|
66681
66839
|
testing.rootDir = config.rootDir;
|
|
66682
66840
|
}
|
|
66683
|
-
if (
|
|
66841
|
+
if (typeof config.flags.screenshotConnector === 'string') {
|
|
66684
66842
|
testing.screenshotConnector = config.flags.screenshotConnector;
|
|
66685
66843
|
}
|
|
66686
66844
|
if (typeof testing.screenshotConnector === 'string') {
|
|
@@ -66802,13 +66960,11 @@ const validateWorkers = (config) => {
|
|
|
66802
66960
|
if (typeof config.maxConcurrentWorkers !== 'number') {
|
|
66803
66961
|
config.maxConcurrentWorkers = 8;
|
|
66804
66962
|
}
|
|
66805
|
-
if (config.flags) {
|
|
66806
|
-
|
|
66807
|
-
|
|
66808
|
-
|
|
66809
|
-
|
|
66810
|
-
config.maxConcurrentWorkers = 4;
|
|
66811
|
-
}
|
|
66963
|
+
if (typeof config.flags.maxWorkers === 'number') {
|
|
66964
|
+
config.maxConcurrentWorkers = config.flags.maxWorkers;
|
|
66965
|
+
}
|
|
66966
|
+
else if (config.flags.ci) {
|
|
66967
|
+
config.maxConcurrentWorkers = 4;
|
|
66812
66968
|
}
|
|
66813
66969
|
config.maxConcurrentWorkers = Math.max(Math.min(config.maxConcurrentWorkers, 16), 0);
|
|
66814
66970
|
if (config.devServer) {
|
|
@@ -66822,111 +66978,119 @@ const validateWorkers = (config) => {
|
|
|
66822
66978
|
* `UnvalidatedConfig` to a `Config`.
|
|
66823
66979
|
*
|
|
66824
66980
|
* @param userConfig an unvalidated config that we've gotten from a user
|
|
66981
|
+
* @param bootstrapConfig the initial configuration provided by the user (or generated by Rindo) used to bootstrap
|
|
66982
|
+
* configuration loading and validation
|
|
66825
66983
|
* @returns an object with config and diagnostics props
|
|
66826
66984
|
*/
|
|
66827
|
-
const validateConfig = (userConfig = {}) => {
|
|
66985
|
+
const validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
66828
66986
|
const config = Object.assign({}, userConfig || {}); // not positive it's json safe
|
|
66829
66987
|
const diagnostics = [];
|
|
66830
|
-
|
|
66831
|
-
|
|
66988
|
+
const logger = bootstrapConfig.logger || config.logger || createLogger();
|
|
66989
|
+
const validatedConfig = {
|
|
66990
|
+
...config,
|
|
66991
|
+
// flags _should_ be JSON safe
|
|
66992
|
+
flags: JSON.parse(JSON.stringify(config.flags || {})),
|
|
66993
|
+
logger,
|
|
66994
|
+
};
|
|
66832
66995
|
// default devMode false
|
|
66833
|
-
if (
|
|
66834
|
-
|
|
66835
|
-
}
|
|
66836
|
-
else if (
|
|
66837
|
-
|
|
66838
|
-
}
|
|
66839
|
-
else if (!isBoolean$1(
|
|
66840
|
-
|
|
66841
|
-
}
|
|
66842
|
-
|
|
66843
|
-
|
|
66844
|
-
|
|
66845
|
-
|
|
66846
|
-
|
|
66847
|
-
|
|
66848
|
-
|
|
66849
|
-
|
|
66850
|
-
|
|
66851
|
-
|
|
66852
|
-
|
|
66853
|
-
|
|
66854
|
-
|
|
66855
|
-
|
|
66856
|
-
setBooleanConfig(
|
|
66857
|
-
setBooleanConfig(
|
|
66858
|
-
setBooleanConfig(
|
|
66859
|
-
setBooleanConfig(
|
|
66860
|
-
setBooleanConfig(
|
|
66861
|
-
setBooleanConfig(
|
|
66862
|
-
setBooleanConfig(
|
|
66863
|
-
setBooleanConfig(
|
|
66864
|
-
setBooleanConfig(
|
|
66865
|
-
setBooleanConfig(
|
|
66866
|
-
setBooleanConfig(
|
|
66867
|
-
|
|
66868
|
-
|
|
66996
|
+
if (validatedConfig.flags.prod) {
|
|
66997
|
+
validatedConfig.devMode = false;
|
|
66998
|
+
}
|
|
66999
|
+
else if (validatedConfig.flags.dev) {
|
|
67000
|
+
validatedConfig.devMode = true;
|
|
67001
|
+
}
|
|
67002
|
+
else if (!isBoolean$1(validatedConfig.devMode)) {
|
|
67003
|
+
validatedConfig.devMode = DEFAULT_DEV_MODE;
|
|
67004
|
+
}
|
|
67005
|
+
validatedConfig.extras = validatedConfig.extras || {};
|
|
67006
|
+
validatedConfig.extras.appendChildSlotFix = !!validatedConfig.extras.appendChildSlotFix;
|
|
67007
|
+
validatedConfig.extras.cloneNodeFix = !!validatedConfig.extras.cloneNodeFix;
|
|
67008
|
+
validatedConfig.extras.cssVarsShim = !!validatedConfig.extras.cssVarsShim;
|
|
67009
|
+
validatedConfig.extras.dynamicImportShim = !!validatedConfig.extras.dynamicImportShim;
|
|
67010
|
+
validatedConfig.extras.lifecycleDOMEvents = !!validatedConfig.extras.lifecycleDOMEvents;
|
|
67011
|
+
validatedConfig.extras.safari10 = !!validatedConfig.extras.safari10;
|
|
67012
|
+
validatedConfig.extras.scriptDataOpts = !!validatedConfig.extras.scriptDataOpts;
|
|
67013
|
+
validatedConfig.extras.shadowDomShim = !!validatedConfig.extras.shadowDomShim;
|
|
67014
|
+
validatedConfig.extras.slotChildNodesFix = !!validatedConfig.extras.slotChildNodesFix;
|
|
67015
|
+
validatedConfig.extras.initializeNextTick = !!validatedConfig.extras.initializeNextTick;
|
|
67016
|
+
validatedConfig.extras.tagNameTransform = !!validatedConfig.extras.tagNameTransform;
|
|
67017
|
+
validatedConfig.buildEs5 =
|
|
67018
|
+
validatedConfig.buildEs5 === true || (!validatedConfig.devMode && validatedConfig.buildEs5 === 'prod');
|
|
67019
|
+
setBooleanConfig(validatedConfig, 'minifyCss', null, !validatedConfig.devMode);
|
|
67020
|
+
setBooleanConfig(validatedConfig, 'minifyJs', null, !validatedConfig.devMode);
|
|
67021
|
+
setBooleanConfig(validatedConfig, 'sourceMap', null, typeof validatedConfig.sourceMap === 'undefined' ? false : validatedConfig.sourceMap);
|
|
67022
|
+
setBooleanConfig(validatedConfig, 'watch', 'watch', false);
|
|
67023
|
+
setBooleanConfig(validatedConfig, 'buildDocs', 'docs', !validatedConfig.devMode);
|
|
67024
|
+
setBooleanConfig(validatedConfig, 'buildDist', 'esm', !validatedConfig.devMode || validatedConfig.buildEs5);
|
|
67025
|
+
setBooleanConfig(validatedConfig, 'profile', 'profile', validatedConfig.devMode);
|
|
67026
|
+
setBooleanConfig(validatedConfig, 'writeLog', 'log', false);
|
|
67027
|
+
setBooleanConfig(validatedConfig, 'buildAppCore', null, true);
|
|
67028
|
+
setBooleanConfig(validatedConfig, 'autoprefixCss', null, validatedConfig.buildEs5);
|
|
67029
|
+
setBooleanConfig(validatedConfig, 'validateTypes', null, !validatedConfig._isTesting);
|
|
67030
|
+
setBooleanConfig(validatedConfig, 'allowInlineScripts', null, true);
|
|
67031
|
+
if (!isString$1(validatedConfig.taskQueue)) {
|
|
67032
|
+
validatedConfig.taskQueue = 'async';
|
|
66869
67033
|
}
|
|
66870
67034
|
// hash file names
|
|
66871
|
-
if (!isBoolean$1(
|
|
66872
|
-
|
|
67035
|
+
if (!isBoolean$1(validatedConfig.hashFileNames)) {
|
|
67036
|
+
validatedConfig.hashFileNames = !validatedConfig.devMode;
|
|
66873
67037
|
}
|
|
66874
|
-
if (!isNumber$1(
|
|
66875
|
-
|
|
67038
|
+
if (!isNumber$1(validatedConfig.hashedFileNameLength)) {
|
|
67039
|
+
validatedConfig.hashedFileNameLength = DEFAULT_HASHED_FILENAME_LENTH;
|
|
66876
67040
|
}
|
|
66877
|
-
if (
|
|
67041
|
+
if (validatedConfig.hashedFileNameLength < MIN_HASHED_FILENAME_LENTH) {
|
|
66878
67042
|
const err = buildError(diagnostics);
|
|
66879
|
-
err.messageText = `
|
|
67043
|
+
err.messageText = `validatedConfig.hashedFileNameLength must be at least ${MIN_HASHED_FILENAME_LENTH} characters`;
|
|
66880
67044
|
}
|
|
66881
|
-
if (
|
|
67045
|
+
if (validatedConfig.hashedFileNameLength > MAX_HASHED_FILENAME_LENTH) {
|
|
66882
67046
|
const err = buildError(diagnostics);
|
|
66883
|
-
err.messageText = `
|
|
67047
|
+
err.messageText = `validatedConfig.hashedFileNameLength cannot be more than ${MAX_HASHED_FILENAME_LENTH} characters`;
|
|
66884
67048
|
}
|
|
66885
|
-
if (!
|
|
66886
|
-
|
|
67049
|
+
if (!validatedConfig.env) {
|
|
67050
|
+
validatedConfig.env = {};
|
|
66887
67051
|
}
|
|
66888
67052
|
// get a good namespace
|
|
66889
|
-
validateNamespace(
|
|
67053
|
+
validateNamespace(validatedConfig, diagnostics);
|
|
66890
67054
|
// figure out all of the config paths and absolute paths
|
|
66891
|
-
validatePaths(
|
|
67055
|
+
validatePaths(validatedConfig);
|
|
66892
67056
|
// outputTargets
|
|
66893
|
-
validateOutputTargets(
|
|
67057
|
+
validateOutputTargets(validatedConfig, diagnostics);
|
|
66894
67058
|
// plugins
|
|
66895
|
-
validatePlugins(
|
|
67059
|
+
validatePlugins(validatedConfig, diagnostics);
|
|
66896
67060
|
// rollup config
|
|
66897
|
-
validateRollupConfig(
|
|
67061
|
+
validateRollupConfig(validatedConfig);
|
|
66898
67062
|
// dev server
|
|
66899
|
-
|
|
67063
|
+
validatedConfig.devServer = validateDevServer(validatedConfig, diagnostics);
|
|
66900
67064
|
// testing
|
|
66901
|
-
validateTesting(
|
|
67065
|
+
validateTesting(validatedConfig, diagnostics);
|
|
66902
67066
|
// hydrate flag
|
|
66903
|
-
|
|
67067
|
+
validatedConfig.hydratedFlag = validateHydrated(validatedConfig);
|
|
66904
67068
|
// bundles
|
|
66905
|
-
if (Array.isArray(
|
|
66906
|
-
|
|
67069
|
+
if (Array.isArray(validatedConfig.bundles)) {
|
|
67070
|
+
validatedConfig.bundles = sortBy(validatedConfig.bundles, (a) => a.components.length);
|
|
66907
67071
|
}
|
|
66908
67072
|
else {
|
|
66909
|
-
|
|
67073
|
+
validatedConfig.bundles = [];
|
|
66910
67074
|
}
|
|
66911
67075
|
// validate how many workers we can use
|
|
66912
|
-
validateWorkers(
|
|
67076
|
+
validateWorkers(validatedConfig);
|
|
66913
67077
|
// default devInspector to whatever devMode is
|
|
66914
|
-
setBooleanConfig(
|
|
66915
|
-
if (!
|
|
66916
|
-
validateDistNamespace(
|
|
67078
|
+
setBooleanConfig(validatedConfig, 'devInspector', null, validatedConfig.devMode);
|
|
67079
|
+
if (!validatedConfig._isTesting) {
|
|
67080
|
+
validateDistNamespace(validatedConfig, diagnostics);
|
|
66917
67081
|
}
|
|
66918
|
-
setBooleanConfig(
|
|
66919
|
-
if (!Array.isArray(
|
|
66920
|
-
|
|
67082
|
+
setBooleanConfig(validatedConfig, 'enableCache', 'cache', true);
|
|
67083
|
+
if (!Array.isArray(validatedConfig.watchIgnoredRegex) && validatedConfig.watchIgnoredRegex != null) {
|
|
67084
|
+
validatedConfig.watchIgnoredRegex = [validatedConfig.watchIgnoredRegex];
|
|
66921
67085
|
}
|
|
66922
|
-
|
|
67086
|
+
validatedConfig.watchIgnoredRegex = (validatedConfig.watchIgnoredRegex || []).reduce((arr, reg) => {
|
|
66923
67087
|
if (reg instanceof RegExp) {
|
|
66924
67088
|
arr.push(reg);
|
|
66925
67089
|
}
|
|
66926
67090
|
return arr;
|
|
66927
67091
|
}, []);
|
|
66928
67092
|
return {
|
|
66929
|
-
config,
|
|
67093
|
+
config: validatedConfig,
|
|
66930
67094
|
diagnostics,
|
|
66931
67095
|
};
|
|
66932
67096
|
};
|
|
@@ -67105,6 +67269,7 @@ const loadConfig = async (init = {}) => {
|
|
|
67105
67269
|
extends: null,
|
|
67106
67270
|
},
|
|
67107
67271
|
};
|
|
67272
|
+
const unknownConfig = {};
|
|
67108
67273
|
try {
|
|
67109
67274
|
const sys = init.sys || createSystem();
|
|
67110
67275
|
const config = init.config || {};
|
|
@@ -67113,22 +67278,22 @@ const loadConfig = async (init = {}) => {
|
|
|
67113
67278
|
if (hasError(results.diagnostics)) {
|
|
67114
67279
|
return results;
|
|
67115
67280
|
}
|
|
67116
|
-
if (loadedConfigFile
|
|
67281
|
+
if (loadedConfigFile !== null) {
|
|
67117
67282
|
// merge the user's config object into their loaded config file
|
|
67118
67283
|
configPath = loadedConfigFile.configPath;
|
|
67119
|
-
|
|
67120
|
-
|
|
67121
|
-
|
|
67284
|
+
unknownConfig.config = { ...loadedConfigFile, ...config };
|
|
67285
|
+
unknownConfig.config.configPath = configPath;
|
|
67286
|
+
unknownConfig.config.rootDir = normalizePath$1(dirname(configPath));
|
|
67122
67287
|
}
|
|
67123
67288
|
else {
|
|
67124
67289
|
// no rindo.config.ts or .js file, which is fine
|
|
67125
67290
|
// #0CJS ¯\_(ツ)_/¯
|
|
67126
|
-
|
|
67127
|
-
|
|
67128
|
-
|
|
67291
|
+
unknownConfig.config = { ...config };
|
|
67292
|
+
unknownConfig.config.configPath = null;
|
|
67293
|
+
unknownConfig.config.rootDir = normalizePath$1(sys.getCurrentDirectory());
|
|
67129
67294
|
}
|
|
67130
|
-
|
|
67131
|
-
const validated = validateConfig(
|
|
67295
|
+
unknownConfig.config.sys = sys;
|
|
67296
|
+
const validated = validateConfig(unknownConfig.config, init);
|
|
67132
67297
|
results.diagnostics.push(...validated.diagnostics);
|
|
67133
67298
|
if (hasError(results.diagnostics)) {
|
|
67134
67299
|
return results;
|
|
@@ -67143,7 +67308,6 @@ const loadConfig = async (init = {}) => {
|
|
|
67143
67308
|
else if (typeof results.config.logLevel !== 'string') {
|
|
67144
67309
|
results.config.logLevel = 'info';
|
|
67145
67310
|
}
|
|
67146
|
-
results.config.logger = init.logger || results.config.logger || createLogger();
|
|
67147
67311
|
results.config.logger.setLevel(results.config.logLevel);
|
|
67148
67312
|
if (!hasError(results.diagnostics)) {
|
|
67149
67313
|
const tsConfigResults = await validateTsConfig(results.config, sys, init);
|