@stencil/core 2.17.2-0 → 2.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +101 -68
- package/cli/index.d.ts +1 -1
- package/cli/index.js +101 -68
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +363 -63
- package/compiler/stencil.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 +1 -1
- 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/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +12 -2
- package/internal/stencil-public-compiler.d.ts +1 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +16 -1
- package/mock-doc/index.d.ts +5 -0
- package/mock-doc/index.js +16 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +40 -29
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/mocks.d.ts +7 -6
- package/testing/package.json +1 -1
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v2.17.
|
|
2
|
+
Stencil Compiler v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -898,24 +898,37 @@ const buildWarn = (diagnostics) => {
|
|
|
898
898
|
diagnostics.push(diagnostic);
|
|
899
899
|
return diagnostic;
|
|
900
900
|
};
|
|
901
|
-
|
|
901
|
+
/**
|
|
902
|
+
* Create a diagnostic message suited for representing an error in a JSON
|
|
903
|
+
* file. This includes information about the exact lines in the JSON file which
|
|
904
|
+
* caused the error and the path to the file.
|
|
905
|
+
*
|
|
906
|
+
* @param compilerCtx the current compiler context
|
|
907
|
+
* @param diagnostics a list of diagnostics used as a return param
|
|
908
|
+
* @param jsonFilePath the path to the JSON file where the error occurred
|
|
909
|
+
* @param msg the error message
|
|
910
|
+
* @param jsonField the key for the field which caused the error, used for finding
|
|
911
|
+
* the error line in the original JSON file
|
|
912
|
+
* @returns a reference to the newly-created diagnostic
|
|
913
|
+
*/
|
|
914
|
+
const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, jsonField) => {
|
|
902
915
|
const err = buildError(diagnostics);
|
|
903
916
|
err.messageText = msg;
|
|
904
917
|
err.absFilePath = jsonFilePath;
|
|
905
|
-
if (typeof
|
|
918
|
+
if (typeof jsonField === 'string') {
|
|
906
919
|
try {
|
|
907
920
|
const jsonStr = compilerCtx.fs.readFileSync(jsonFilePath);
|
|
908
921
|
const lines = jsonStr.replace(/\r/g, '\n').split('\n');
|
|
909
922
|
for (let i = 0; i < lines.length; i++) {
|
|
910
923
|
const txtLine = lines[i];
|
|
911
|
-
const txtIndex = txtLine.indexOf(
|
|
924
|
+
const txtIndex = txtLine.indexOf(jsonField);
|
|
912
925
|
if (txtIndex > -1) {
|
|
913
926
|
const warnLine = {
|
|
914
927
|
lineIndex: i,
|
|
915
928
|
lineNumber: i + 1,
|
|
916
929
|
text: txtLine,
|
|
917
930
|
errorCharStart: txtIndex,
|
|
918
|
-
errorLength:
|
|
931
|
+
errorLength: jsonField.length,
|
|
919
932
|
};
|
|
920
933
|
err.lineNumber = warnLine.lineNumber;
|
|
921
934
|
err.columnNumber = txtIndex + 1;
|
|
@@ -4052,7 +4065,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
|
|
|
4052
4065
|
};
|
|
4053
4066
|
};
|
|
4054
4067
|
|
|
4055
|
-
const buildId = '
|
|
4068
|
+
const buildId = '20220822163920';
|
|
4056
4069
|
const minfyJsId = 'terser5.6.1_7';
|
|
4057
4070
|
const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.13_7';
|
|
4058
4071
|
const parse5Version = '6.0.1';
|
|
@@ -4060,8 +4073,8 @@ const rollupVersion = '2.42.3';
|
|
|
4060
4073
|
const sizzleVersion = '2.42.3';
|
|
4061
4074
|
const terserVersion = '5.6.1';
|
|
4062
4075
|
const typescriptVersion = '4.5.4';
|
|
4063
|
-
const vermoji = '
|
|
4064
|
-
const version$3 = '2.17.
|
|
4076
|
+
const vermoji = '🐞';
|
|
4077
|
+
const version$3 = '2.17.4';
|
|
4065
4078
|
const versions = {
|
|
4066
4079
|
stencil: version$3,
|
|
4067
4080
|
parse5: parse5Version,
|
|
@@ -11509,6 +11522,20 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
11509
11522
|
return cssText;
|
|
11510
11523
|
};
|
|
11511
11524
|
|
|
11525
|
+
/**
|
|
11526
|
+
* Serialize data about a style import to an annotated path, where
|
|
11527
|
+
* the filename has a URL queryparams style string appended to it.
|
|
11528
|
+
* This could look like:
|
|
11529
|
+
*
|
|
11530
|
+
* ```
|
|
11531
|
+
* './some-file.CSS?tag=my-tag&mode=ios&encapsulation=scoped');
|
|
11532
|
+
* ```
|
|
11533
|
+
*
|
|
11534
|
+
* @param data import data to be serialized
|
|
11535
|
+
* @param styleImportData an argument which controls whether the import data
|
|
11536
|
+
* will be added to the path (formatted as queryparams)
|
|
11537
|
+
* @returns a formatted string
|
|
11538
|
+
*/
|
|
11512
11539
|
const serializeImportPath = (data, styleImportData) => {
|
|
11513
11540
|
let p = data.importeePath;
|
|
11514
11541
|
if (isString$1(p)) {
|
|
@@ -11539,6 +11566,13 @@ const serializeImportPath = (data, styleImportData) => {
|
|
|
11539
11566
|
}
|
|
11540
11567
|
return p;
|
|
11541
11568
|
};
|
|
11569
|
+
/**
|
|
11570
|
+
* Parse import paths (filepaths possibly annotated w/ component metadata,
|
|
11571
|
+
* formatted as URL queryparams) into a structured format.
|
|
11572
|
+
*
|
|
11573
|
+
* @param importPath an annotated import path to examine
|
|
11574
|
+
* @returns formatted information about the import
|
|
11575
|
+
*/
|
|
11542
11576
|
const parseImportPath = (importPath) => {
|
|
11543
11577
|
const parsedPath = {
|
|
11544
11578
|
importPath,
|
|
@@ -16288,6 +16322,9 @@ class MockElement extends MockNode {
|
|
|
16288
16322
|
set title(value) {
|
|
16289
16323
|
this.setAttributeNS(null, 'title', value);
|
|
16290
16324
|
}
|
|
16325
|
+
animate() {
|
|
16326
|
+
/**/
|
|
16327
|
+
}
|
|
16291
16328
|
onanimationstart() {
|
|
16292
16329
|
/**/
|
|
16293
16330
|
}
|
|
@@ -16552,6 +16589,18 @@ class MockElement extends MockNode {
|
|
|
16552
16589
|
onwheel() {
|
|
16553
16590
|
/**/
|
|
16554
16591
|
}
|
|
16592
|
+
requestFullscreen() {
|
|
16593
|
+
/**/
|
|
16594
|
+
}
|
|
16595
|
+
scrollBy() {
|
|
16596
|
+
/**/
|
|
16597
|
+
}
|
|
16598
|
+
scrollTo() {
|
|
16599
|
+
/**/
|
|
16600
|
+
}
|
|
16601
|
+
scrollIntoView() {
|
|
16602
|
+
/**/
|
|
16603
|
+
}
|
|
16555
16604
|
toString(opts) {
|
|
16556
16605
|
return serializeNodeToHtml(this, opts);
|
|
16557
16606
|
}
|
|
@@ -41339,29 +41388,73 @@ const formatUrl = (config, pluginCtx, code, filePath, ext) => {
|
|
|
41339
41388
|
return `const ${varName} = 'data:${mime};base64,${base64}';export default ${varName};`;
|
|
41340
41389
|
};
|
|
41341
41390
|
|
|
41391
|
+
/**
|
|
41392
|
+
* A Rollup plugin which bundles up some transformation of CSS imports as well
|
|
41393
|
+
* as writing some files to disk for the `DIST_COLLECTION` output target.
|
|
41394
|
+
*
|
|
41395
|
+
* @param config a user-supplied configuration
|
|
41396
|
+
* @param compilerCtx the current compiler context
|
|
41397
|
+
* @param buildCtx the current build context
|
|
41398
|
+
* @param bundleOpts bundle options for Rollup
|
|
41399
|
+
* @returns a Rollup plugin which carries out the necessary work
|
|
41400
|
+
*/
|
|
41342
41401
|
const extTransformsPlugin = (config, compilerCtx, buildCtx, bundleOpts) => {
|
|
41343
41402
|
return {
|
|
41344
41403
|
name: 'extTransformsPlugin',
|
|
41404
|
+
/**
|
|
41405
|
+
* A custom function targeting the `transform` build hook in Rollup. See here for details:
|
|
41406
|
+
* https://rollupjs.org/guide/en/#transform
|
|
41407
|
+
*
|
|
41408
|
+
* Here we are ignoring the first argument (which contains the module's source code) and
|
|
41409
|
+
* only looking at the `id` argument. We use that `id` to get information about the module
|
|
41410
|
+
* in question from disk ourselves so that we can then do some transformations on it.
|
|
41411
|
+
*
|
|
41412
|
+
* @param _ an unused parameter (normally the code for a given module)
|
|
41413
|
+
* @param id the id of a module
|
|
41414
|
+
* @returns metadata for Rollup or null if no transformation should be done
|
|
41415
|
+
*/
|
|
41345
41416
|
async transform(_, id) {
|
|
41417
|
+
var _a, _b;
|
|
41346
41418
|
if (/\0/.test(id)) {
|
|
41347
41419
|
return null;
|
|
41348
41420
|
}
|
|
41421
|
+
// The `id` here was possibly previously updated using
|
|
41422
|
+
// `serializeImportPath` to annotate the filepath with various metadata
|
|
41423
|
+
// serialized to query-params. If that was done for this particular `id`
|
|
41424
|
+
// then the `data` prop will not be null.
|
|
41349
41425
|
const { data } = parseImportPath(id);
|
|
41350
41426
|
if (data != null) {
|
|
41351
|
-
let cmp;
|
|
41427
|
+
let cmp = undefined;
|
|
41352
41428
|
const filePath = normalizeFsPath(id);
|
|
41353
41429
|
const code = await compilerCtx.fs.readFile(filePath);
|
|
41354
41430
|
if (typeof code !== 'string') {
|
|
41355
41431
|
return null;
|
|
41356
41432
|
}
|
|
41357
41433
|
const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
|
|
41358
|
-
|
|
41434
|
+
// We need to check whether the current build is a dev-mode watch build w/ HMR enabled in
|
|
41435
|
+
// order to know how we'll want to set `commentOriginalSelector` (below). If we are doing
|
|
41436
|
+
// a hydrate build we need to set this to `true` because commenting-out selectors is what
|
|
41437
|
+
// gives us support for scoped CSS w/ hydrated components (we don't support shadow DOM and
|
|
41438
|
+
// styling via that route for them). However, we don't want to comment selectors in dev
|
|
41439
|
+
// mode when using HMR in the browser, since there we _do_ support putting stylesheets into
|
|
41440
|
+
// the shadow DOM and commenting out e.g. the `:host` selector in those stylesheets will
|
|
41441
|
+
// break components' CSS when an HMR update is sent to the browser.
|
|
41442
|
+
//
|
|
41443
|
+
// See https://github.com/ionic-team/stencil/issues/3461 for details
|
|
41444
|
+
const isDevWatchHMRBuild = config.flags.watch &&
|
|
41445
|
+
config.flags.dev &&
|
|
41446
|
+
config.flags.serve &&
|
|
41447
|
+
((_b = (_a = config.devServer) === null || _a === void 0 ? void 0 : _a.reloadStrategy) !== null && _b !== void 0 ? _b : null) === 'hmr';
|
|
41448
|
+
const commentOriginalSelector = bundleOpts.platform === 'hydrate' && data.encapsulation === 'shadow' && !isDevWatchHMRBuild;
|
|
41359
41449
|
if (data.tag) {
|
|
41360
41450
|
cmp = buildCtx.components.find((c) => c.tagName === data.tag);
|
|
41361
41451
|
const moduleFile = cmp && compilerCtx.moduleMap.get(cmp.sourceFilePath);
|
|
41362
41452
|
if (moduleFile) {
|
|
41363
41453
|
const collectionDirs = config.outputTargets.filter(isOutputTargetDistCollection);
|
|
41364
41454
|
const relPath = relative$1(config.srcDir, pluginTransforms.id);
|
|
41455
|
+
// If we found a `moduleFile` in the module map above then we
|
|
41456
|
+
// should write the transformed CSS file (found in the return value
|
|
41457
|
+
// of `runPluginTransformsEsmImports`, above) to disk.
|
|
41365
41458
|
await Promise.all(collectionDirs.map(async (outputTarget) => {
|
|
41366
41459
|
const collectionPath = join(outputTarget.collectionDir, relPath);
|
|
41367
41460
|
await compilerCtx.fs.writeFile(collectionPath, pluginTransforms.code);
|
|
@@ -54609,6 +54702,23 @@ const isMemberPrivate = (member) => {
|
|
|
54609
54702
|
}
|
|
54610
54703
|
return false;
|
|
54611
54704
|
};
|
|
54705
|
+
/**
|
|
54706
|
+
* Convert a JavaScript value to the TypeScript Intermediate Representation
|
|
54707
|
+
* (IR) for a literal Abstract Syntax Tree (AST) node with that same value. The
|
|
54708
|
+
* value to convert may be a primitive type like `string`, `boolean`, etc or
|
|
54709
|
+
* may be an `Object`, `Array`, etc.
|
|
54710
|
+
*
|
|
54711
|
+
* Note that this function takes a param (`refs`) with a default value,
|
|
54712
|
+
* normally a value should _not_ be passed for this parameter since it is
|
|
54713
|
+
* intended to be used for recursive calls.
|
|
54714
|
+
*
|
|
54715
|
+
* @param val the value to convert
|
|
54716
|
+
* @param refs a set of references, used in recursive calls to avoid
|
|
54717
|
+
* circular references when creating object literal IR instances. **note that
|
|
54718
|
+
* you shouldn't pass this parameter unless you know what you're doing!**
|
|
54719
|
+
* @returns TypeScript IR for a literal corresponding to the JavaScript value
|
|
54720
|
+
* with which the function was called
|
|
54721
|
+
*/
|
|
54612
54722
|
const convertValueToLiteral = (val, refs = null) => {
|
|
54613
54723
|
if (refs == null) {
|
|
54614
54724
|
refs = new WeakSet();
|
|
@@ -54639,12 +54749,39 @@ const convertValueToLiteral = (val, refs = null) => {
|
|
|
54639
54749
|
}
|
|
54640
54750
|
return t.createLiteral(val);
|
|
54641
54751
|
};
|
|
54752
|
+
/**
|
|
54753
|
+
* Convert a JavaScript Array instance to TypeScript's Intermediate
|
|
54754
|
+
* Representation (IR) for an array literal. This is done by recursively using
|
|
54755
|
+
* {@link convertValueToLiteral} to create a new array consisting of the
|
|
54756
|
+
* TypeScript IR of each element in the array to be converted, and then creating
|
|
54757
|
+
* the TypeScript IR for _that_ array.
|
|
54758
|
+
*
|
|
54759
|
+
* @param list the array instance to convert
|
|
54760
|
+
* @param refs a set of references to objects, used when converting objects to
|
|
54761
|
+
* avoid circular references
|
|
54762
|
+
* @returns TypeScript IR for the array we want to convert
|
|
54763
|
+
*/
|
|
54642
54764
|
const arrayToArrayLiteral = (list, refs) => {
|
|
54643
54765
|
const newList = list.map((l) => {
|
|
54644
54766
|
return convertValueToLiteral(l, refs);
|
|
54645
54767
|
});
|
|
54646
54768
|
return t.createArrayLiteral(newList);
|
|
54647
54769
|
};
|
|
54770
|
+
/**
|
|
54771
|
+
* Convert a JavaScript object (i.e. an object existing at runtime) to the
|
|
54772
|
+
* corresponding TypeScript Intermediate Representation (IR)
|
|
54773
|
+
* ({@see ts.ObjectLiteralExpression}) for an object literal. This function
|
|
54774
|
+
* takes an argument holding a `WeakSet` of references to objects which is
|
|
54775
|
+
* used to avoid circular references. Objects that are converted in this
|
|
54776
|
+
* function are added to the set, and if an object is already present then an
|
|
54777
|
+
* `undefined` literal (in TypeScript IR) is returned instead of another
|
|
54778
|
+
* object literal, as continuing to convert a circular reference would, well,
|
|
54779
|
+
* never end!
|
|
54780
|
+
*
|
|
54781
|
+
* @param obj the JavaScript object to convert to TypeScript IR
|
|
54782
|
+
* @param refs a set of references to objects, used to avoid circular references
|
|
54783
|
+
* @returns a TypeScript object literal expression
|
|
54784
|
+
*/
|
|
54648
54785
|
const objectToObjectLiteral = (obj, refs) => {
|
|
54649
54786
|
if (refs.has(obj)) {
|
|
54650
54787
|
return t.createIdentifier('undefined');
|
|
@@ -56012,17 +56149,16 @@ const KEEP_IMPORTS = new Set([
|
|
|
56012
56149
|
* which do actual work of generating the rollup configuration, creating an
|
|
56013
56150
|
* entry chunk, running, the build, etc.
|
|
56014
56151
|
*
|
|
56015
|
-
* @param config the
|
|
56152
|
+
* @param config the validated compiler configuration we're using
|
|
56016
56153
|
* @param compilerCtx the current compiler context
|
|
56017
56154
|
* @param buildCtx the current build context
|
|
56018
56155
|
* @returns an empty Promise which won't resolve until the work is done!
|
|
56019
56156
|
*/
|
|
56020
56157
|
const outputCustomElements = async (config, compilerCtx, buildCtx) => {
|
|
56021
|
-
var _a;
|
|
56022
56158
|
if (!config.buildDist) {
|
|
56023
56159
|
return;
|
|
56024
56160
|
}
|
|
56025
|
-
const outputTargets =
|
|
56161
|
+
const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
|
|
56026
56162
|
if (outputTargets.length === 0) {
|
|
56027
56163
|
return;
|
|
56028
56164
|
}
|
|
@@ -56035,7 +56171,7 @@ const outputCustomElements = async (config, compilerCtx, buildCtx) => {
|
|
|
56035
56171
|
* Get bundle options for our current build and compiler context which we'll use
|
|
56036
56172
|
* to generate a Rollup build and so on.
|
|
56037
56173
|
*
|
|
56038
|
-
* @param config
|
|
56174
|
+
* @param config a validated Stencil configuration object
|
|
56039
56175
|
* @param buildCtx the current build context
|
|
56040
56176
|
* @param compilerCtx the current compiler context
|
|
56041
56177
|
* @param outputTarget the outputTarget we're currently dealing with
|
|
@@ -56066,9 +56202,10 @@ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
|
|
|
56066
56202
|
/**
|
|
56067
56203
|
* Get bundle options for rollup, run the rollup build, optionally minify the
|
|
56068
56204
|
* output, and write files to disk.
|
|
56069
|
-
*
|
|
56070
|
-
* @param
|
|
56205
|
+
*
|
|
56206
|
+
* @param config the validated Stencil configuration we're using
|
|
56071
56207
|
* @param compilerCtx the current compiler context
|
|
56208
|
+
* @param buildCtx the current build context
|
|
56072
56209
|
* @param outputTarget the outputTarget we're currently dealing with
|
|
56073
56210
|
* @returns an empty promise
|
|
56074
56211
|
*/
|
|
@@ -57113,13 +57250,13 @@ const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets)
|
|
|
57113
57250
|
}
|
|
57114
57251
|
const strictCheck = readmeOutputTargets.some((o) => o.strict);
|
|
57115
57252
|
if (strictCheck) {
|
|
57116
|
-
|
|
57253
|
+
strictCheckDocs(config, docsData);
|
|
57117
57254
|
}
|
|
57118
57255
|
await Promise.all(docsData.components.map((cmpData) => {
|
|
57119
57256
|
return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components);
|
|
57120
57257
|
}));
|
|
57121
57258
|
};
|
|
57122
|
-
const
|
|
57259
|
+
const strictCheckDocs = (config, docsData) => {
|
|
57123
57260
|
docsData.components.forEach((component) => {
|
|
57124
57261
|
component.props.forEach((prop) => {
|
|
57125
57262
|
if (!prop.docs && prop.deprecation === undefined) {
|
|
@@ -60192,8 +60329,7 @@ const relDts$1 = (fromPath, dtsPath) => {
|
|
|
60192
60329
|
* @param typesDir the path to the directory where type declarations are saved
|
|
60193
60330
|
*/
|
|
60194
60331
|
const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, typesDir) => {
|
|
60195
|
-
|
|
60196
|
-
const outputTargets = ((_a = config.outputTargets) !== null && _a !== void 0 ? _a : []).filter(isOutputTargetDistCustomElements);
|
|
60332
|
+
const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
|
|
60197
60333
|
await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, typesDir, outputTarget)));
|
|
60198
60334
|
};
|
|
60199
60335
|
/**
|
|
@@ -62128,6 +62264,16 @@ const parseModuleImport = (config, compilerCtx, buildCtx, moduleFile, dirPath, i
|
|
|
62128
62264
|
}
|
|
62129
62265
|
};
|
|
62130
62266
|
|
|
62267
|
+
/**
|
|
62268
|
+
* Update an instance of TypeScript's Intermediate Representation (IR) for a
|
|
62269
|
+
* class declaration ({@link ts.ClassDeclaration}) with a static getter for the
|
|
62270
|
+
* compiler metadata that we produce as part of the compilation process.
|
|
62271
|
+
*
|
|
62272
|
+
* @param cmpNode an instance of the TypeScript IR for a class declaration (i.e.
|
|
62273
|
+
* a stencil component) to be updated
|
|
62274
|
+
* @param cmpMeta the component metadata corresponding to that component
|
|
62275
|
+
* @returns the updated typescript class declaration
|
|
62276
|
+
*/
|
|
62131
62277
|
const addComponentMetaStatic = (cmpNode, cmpMeta) => {
|
|
62132
62278
|
const publicCompilerMeta = getPublicCompilerMeta(cmpMeta);
|
|
62133
62279
|
const cmpMetaStaticProp = createStaticGetter('COMPILER_META', convertValueToLiteral(publicCompilerMeta));
|
|
@@ -62259,6 +62405,14 @@ const parseStaticEvents = (staticMembers) => {
|
|
|
62259
62405
|
});
|
|
62260
62406
|
};
|
|
62261
62407
|
|
|
62408
|
+
/**
|
|
62409
|
+
* Parse a list of {@link ts.ClassElement} objects representing static props
|
|
62410
|
+
* into a list of our own Intermediate Representation (IR) of properties on
|
|
62411
|
+
* components.
|
|
62412
|
+
*
|
|
62413
|
+
* @param staticMembers TypeScript IR for the properties on our component
|
|
62414
|
+
* @returns a manifest of compiler properties in our own Stencil IR
|
|
62415
|
+
*/
|
|
62262
62416
|
const parseStaticProps = (staticMembers) => {
|
|
62263
62417
|
const parsedProps = getStaticValue(staticMembers, 'properties');
|
|
62264
62418
|
if (!parsedProps) {
|
|
@@ -62495,7 +62649,22 @@ const setComponentBuildConditionals = (cmpMeta) => {
|
|
|
62495
62649
|
!cmpMeta.hasMember && !cmpMeta.hasStyle && !cmpMeta.hasLifecycle && !cmpMeta.hasListener && !cmpMeta.hasVdomRender;
|
|
62496
62650
|
};
|
|
62497
62651
|
|
|
62498
|
-
|
|
62652
|
+
/**
|
|
62653
|
+
* Given an instance of TypeScript's Intermediate Representation (IR) for a
|
|
62654
|
+
* class declaration ({@see ts.ClassDeclaration}) which represents a Stencil
|
|
62655
|
+
* component class declaration, parse and format various pieces of data about
|
|
62656
|
+
* static class members which we use in the compilation process
|
|
62657
|
+
*
|
|
62658
|
+
* @param compilerCtx the current compiler context
|
|
62659
|
+
* @param typeChecker a TypeScript type checker instance
|
|
62660
|
+
* @param cmpNode the TypeScript class declaration for the component
|
|
62661
|
+
* @param moduleFile Stencil's IR for a module, used here as an out param
|
|
62662
|
+
* @param transformOpts options which control various aspects of the
|
|
62663
|
+
* transformation
|
|
62664
|
+
* @returns the TypeScript class declaration IR instance with which the
|
|
62665
|
+
* function was called
|
|
62666
|
+
*/
|
|
62667
|
+
const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, transformOpts) => {
|
|
62499
62668
|
if (cmpNode.members == null) {
|
|
62500
62669
|
return cmpNode;
|
|
62501
62670
|
}
|
|
@@ -62612,7 +62781,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
|
|
|
62612
62781
|
// add to module map
|
|
62613
62782
|
moduleFile.cmps.push(cmp);
|
|
62614
62783
|
// add to node map
|
|
62615
|
-
nodeMap.set(cmpNode, cmp);
|
|
62784
|
+
compilerCtx.nodeMap.set(cmpNode, cmp);
|
|
62616
62785
|
return cmpNode;
|
|
62617
62786
|
};
|
|
62618
62787
|
const parseVirtualProps = (docs) => {
|
|
@@ -62680,7 +62849,7 @@ const updateModule = (config, compilerCtx, buildCtx, tsSourceFile, sourceFileTex
|
|
|
62680
62849
|
compilerCtx.changedModules.add(moduleFile.sourceFilePath);
|
|
62681
62850
|
const visitNode = (node) => {
|
|
62682
62851
|
if (t.isClassDeclaration(node)) {
|
|
62683
|
-
parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile
|
|
62852
|
+
parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile);
|
|
62684
62853
|
return;
|
|
62685
62854
|
}
|
|
62686
62855
|
else if (t.isImportDeclaration(node)) {
|
|
@@ -62841,6 +63010,15 @@ const outputServiceWorkers = async (config, buildCtx) => {
|
|
|
62841
63010
|
}
|
|
62842
63011
|
};
|
|
62843
63012
|
|
|
63013
|
+
/**
|
|
63014
|
+
* Validate the package.json file for a project, checking that various fields
|
|
63015
|
+
* are set correctly for the currently-configured output targets.
|
|
63016
|
+
*
|
|
63017
|
+
* @param config the user-supplied Stencil config
|
|
63018
|
+
* @param compilerCtx the compiler context
|
|
63019
|
+
* @param buildCtx the build context
|
|
63020
|
+
* @returns an empty Promise
|
|
63021
|
+
*/
|
|
62844
63022
|
const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
|
|
62845
63023
|
if (config.watch) {
|
|
62846
63024
|
return;
|
|
@@ -62848,26 +63026,41 @@ const validateBuildPackageJson = async (config, compilerCtx, buildCtx) => {
|
|
|
62848
63026
|
if (buildCtx.packageJson == null) {
|
|
62849
63027
|
return;
|
|
62850
63028
|
}
|
|
62851
|
-
const
|
|
63029
|
+
const distCollectionOutputTargets = config.outputTargets.filter(isOutputTargetDistCollection);
|
|
62852
63030
|
const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes);
|
|
62853
63031
|
await Promise.all([
|
|
62854
|
-
...
|
|
62855
|
-
|
|
62856
|
-
|
|
62857
|
-
...typesOutputTargets.map((outputTarget) => {
|
|
62858
|
-
return validateTypes(config, compilerCtx, buildCtx, outputTarget);
|
|
62859
|
-
}),
|
|
63032
|
+
...distCollectionOutputTargets.map((distCollectionOT) => validateDistCollectionPkgJson(config, compilerCtx, buildCtx, distCollectionOT)),
|
|
63033
|
+
...typesOutputTargets.map((typesOT) => validateTypes(config, compilerCtx, buildCtx, typesOT)),
|
|
63034
|
+
validateModule(config, compilerCtx, buildCtx),
|
|
62860
63035
|
]);
|
|
62861
63036
|
};
|
|
62862
|
-
|
|
63037
|
+
/**
|
|
63038
|
+
* Validate package.json contents for the `DIST_COLLECTION` output target,
|
|
63039
|
+
* checking that various fields like `files`, `main`, and so on are set
|
|
63040
|
+
* correctly.
|
|
63041
|
+
*
|
|
63042
|
+
* @param config the stencil config
|
|
63043
|
+
* @param compilerCtx the current compiler context
|
|
63044
|
+
* @param buildCtx the current build context
|
|
63045
|
+
* @param outputTarget a DIST_COLLECTION output target
|
|
63046
|
+
*/
|
|
63047
|
+
const validateDistCollectionPkgJson = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
62863
63048
|
await Promise.all([
|
|
62864
63049
|
validatePackageFiles(config, compilerCtx, buildCtx, outputTarget),
|
|
62865
63050
|
validateMain(config, compilerCtx, buildCtx, outputTarget),
|
|
62866
|
-
validateModule(config, compilerCtx, buildCtx, outputTarget),
|
|
62867
63051
|
validateCollection$1(config, compilerCtx, buildCtx, outputTarget),
|
|
62868
63052
|
validateBrowser(config, compilerCtx, buildCtx),
|
|
62869
63053
|
]);
|
|
62870
63054
|
};
|
|
63055
|
+
/**
|
|
63056
|
+
* Validate that the `files` field in `package.json` contains directories and
|
|
63057
|
+
* files that are necessary for the `DIST_COLLECTION` output target.
|
|
63058
|
+
*
|
|
63059
|
+
* @param config the stencil config
|
|
63060
|
+
* @param compilerCtx the current compiler context
|
|
63061
|
+
* @param buildCtx the current build context
|
|
63062
|
+
* @param outputTarget a DIST_COLLECTION output target
|
|
63063
|
+
*/
|
|
62871
63064
|
const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
62872
63065
|
if (!config.devMode && Array.isArray(buildCtx.packageJson.files)) {
|
|
62873
63066
|
const actualDistDir = normalizePath$1(relative$1(config.rootDir, outputTarget.dir));
|
|
@@ -62891,6 +63084,15 @@ const validatePackageFiles = async (config, compilerCtx, buildCtx, outputTarget)
|
|
|
62891
63084
|
}));
|
|
62892
63085
|
}
|
|
62893
63086
|
};
|
|
63087
|
+
/**
|
|
63088
|
+
* Check that the `main` field is set correctly in `package.json` for the
|
|
63089
|
+
* `DIST_COLLECTION` output target.
|
|
63090
|
+
*
|
|
63091
|
+
* @param config the stencil config
|
|
63092
|
+
* @param compilerCtx the current compiler context
|
|
63093
|
+
* @param buildCtx the current build context
|
|
63094
|
+
* @param outputTarget a DIST_COLLECTION output target
|
|
63095
|
+
*/
|
|
62894
63096
|
const validateMain = (config, compilerCtx, buildCtx, outputTarget) => {
|
|
62895
63097
|
const mainAbs = join(outputTarget.dir, 'index.cjs.js');
|
|
62896
63098
|
const mainRel = relative$1(config.rootDir, mainAbs);
|
|
@@ -62903,26 +63105,71 @@ const validateMain = (config, compilerCtx, buildCtx, outputTarget) => {
|
|
|
62903
63105
|
packageJsonWarn(config, compilerCtx, buildCtx, msg, `"main"`);
|
|
62904
63106
|
}
|
|
62905
63107
|
};
|
|
62906
|
-
|
|
62907
|
-
|
|
63108
|
+
/**
|
|
63109
|
+
* Validate the package.json 'module' field, taking into account output targets
|
|
63110
|
+
* and other configuration details. This will look for a value for the `module`
|
|
63111
|
+
* field. If not present it will set a relevant warning message with an
|
|
63112
|
+
* output-target specific recommended value. If it is present and is not equal
|
|
63113
|
+
* to that recommended value it will set a different warning message.
|
|
63114
|
+
*
|
|
63115
|
+
* @param config the current user-supplied configuration
|
|
63116
|
+
* @param compilerCtx the compiler context
|
|
63117
|
+
* @param buildCtx the build context
|
|
63118
|
+
* @returns an empty Promise
|
|
63119
|
+
*/
|
|
63120
|
+
const validateModule = async (config, compilerCtx, buildCtx) => {
|
|
62908
63121
|
const currentModule = buildCtx.packageJson.module;
|
|
62909
|
-
const
|
|
62910
|
-
const distRel = relative$1(config.rootDir, distAbs);
|
|
62911
|
-
let recommendedRelPath = distRel;
|
|
62912
|
-
if (customElementsOutput) {
|
|
62913
|
-
const customElementsAbs = join(customElementsOutput.dir, 'index.js');
|
|
62914
|
-
recommendedRelPath = relative$1(config.rootDir, customElementsAbs);
|
|
62915
|
-
}
|
|
63122
|
+
const recommendedRelPath = recommendedModulePath(config);
|
|
62916
63123
|
if (!isString$1(currentModule)) {
|
|
62917
|
-
|
|
63124
|
+
let msg = 'package.json "module" property is required when generating a distribution.';
|
|
63125
|
+
if (recommendedRelPath !== null) {
|
|
63126
|
+
msg += ` It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
|
|
63127
|
+
}
|
|
62918
63128
|
packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
|
|
63129
|
+
return;
|
|
62919
63130
|
}
|
|
62920
|
-
|
|
62921
|
-
|
|
62922
|
-
const msg = `package.json "module" property is set to "${currentModule}". It's recommended to set the "module" property to: ${recommendedRelPath}`;
|
|
63131
|
+
if (recommendedRelPath !== null && normalizePath$1(recommendedRelPath) !== normalizePath$1(currentModule)) {
|
|
63132
|
+
const msg = `package.json "module" property is set to "${currentModule}". It's recommended to set the "module" property to: ${normalizePath$1(recommendedRelPath)}`;
|
|
62923
63133
|
packageJsonWarn(config, compilerCtx, buildCtx, msg, `"module"`);
|
|
62924
63134
|
}
|
|
62925
63135
|
};
|
|
63136
|
+
// TODO(STENCIL-516): Investigate the hierarchy of these output targets
|
|
63137
|
+
/**
|
|
63138
|
+
* Get the recommended `"module"` path for `package.json` given the output
|
|
63139
|
+
* targets that a user has set on their config.
|
|
63140
|
+
*
|
|
63141
|
+
* @param config the user-supplied Stencil configuration
|
|
63142
|
+
* @returns a recommended module path or a null value to indicate no default
|
|
63143
|
+
* value is supplied
|
|
63144
|
+
*/
|
|
63145
|
+
function recommendedModulePath(config) {
|
|
63146
|
+
const customElementsBundleOT = config.outputTargets.find(isOutputTargetDistCustomElementsBundle);
|
|
63147
|
+
const customElementsOT = config.outputTargets.find(isOutputTargetDistCustomElements);
|
|
63148
|
+
const distCollectionOT = config.outputTargets.find(isOutputTargetDistCollection);
|
|
63149
|
+
if (distCollectionOT) {
|
|
63150
|
+
return relative$1(config.rootDir, join(distCollectionOT.dir, 'index.js'));
|
|
63151
|
+
}
|
|
63152
|
+
if (customElementsOT) {
|
|
63153
|
+
const componentsIndexAbs = join(customElementsOT.dir, 'index.js');
|
|
63154
|
+
return relative$1(config.rootDir, componentsIndexAbs);
|
|
63155
|
+
}
|
|
63156
|
+
if (customElementsBundleOT) {
|
|
63157
|
+
const customElementsAbs = join(customElementsBundleOT.dir, 'index.js');
|
|
63158
|
+
return relative$1(config.rootDir, customElementsAbs);
|
|
63159
|
+
}
|
|
63160
|
+
// if no output target for which we define a recommended output target is set
|
|
63161
|
+
// we return `null`
|
|
63162
|
+
return null;
|
|
63163
|
+
}
|
|
63164
|
+
/**
|
|
63165
|
+
* Check that the `types` field is set correctly in `package.json` for the
|
|
63166
|
+
* `DIST_COLLECTION` output target.
|
|
63167
|
+
*
|
|
63168
|
+
* @param config the stencil config
|
|
63169
|
+
* @param compilerCtx the current compiler context
|
|
63170
|
+
* @param buildCtx the current build context
|
|
63171
|
+
* @param outputTarget a DIST_COLLECTION output target
|
|
63172
|
+
*/
|
|
62926
63173
|
const validateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
62927
63174
|
const typesAbs = getComponentsDtsTypesFilePath(outputTarget);
|
|
62928
63175
|
const recommendedPath = relative$1(config.rootDir, typesAbs);
|
|
@@ -62946,6 +63193,15 @@ const validateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
|
62946
63193
|
}
|
|
62947
63194
|
}
|
|
62948
63195
|
};
|
|
63196
|
+
/**
|
|
63197
|
+
* Check that the `collection` field is set correctly in `package.json` for the
|
|
63198
|
+
* `DIST_COLLECTION` output target.
|
|
63199
|
+
*
|
|
63200
|
+
* @param config the stencil config
|
|
63201
|
+
* @param compilerCtx the current compiler context
|
|
63202
|
+
* @param buildCtx the current build context
|
|
63203
|
+
* @param outputTarget a DIST_COLLECTION output target
|
|
63204
|
+
*/
|
|
62949
63205
|
const validateCollection$1 = (config, compilerCtx, buildCtx, outputTarget) => {
|
|
62950
63206
|
if (outputTarget.collectionDir) {
|
|
62951
63207
|
const collectionRel = join(relative$1(config.rootDir, outputTarget.collectionDir), COLLECTION_MANIFEST_FILE_NAME);
|
|
@@ -62955,19 +63211,51 @@ const validateCollection$1 = (config, compilerCtx, buildCtx, outputTarget) => {
|
|
|
62955
63211
|
}
|
|
62956
63212
|
}
|
|
62957
63213
|
};
|
|
63214
|
+
/**
|
|
63215
|
+
* Check that the `browser` field is set correctly in `package.json` for the
|
|
63216
|
+
* `DIST_COLLECTION` output target.
|
|
63217
|
+
*
|
|
63218
|
+
* @param config the stencil config
|
|
63219
|
+
* @param compilerCtx the current compiler context
|
|
63220
|
+
* @param buildCtx the current build context
|
|
63221
|
+
*/
|
|
62958
63222
|
const validateBrowser = (config, compilerCtx, buildCtx) => {
|
|
62959
63223
|
if (isString$1(buildCtx.packageJson.browser)) {
|
|
62960
63224
|
const msg = `package.json "browser" property is set to "${buildCtx.packageJson.browser}". However, for maximum compatibility with all bundlers it's recommended to not set the "browser" property and instead ensure both "module" and "main" properties are set.`;
|
|
62961
63225
|
packageJsonWarn(config, compilerCtx, buildCtx, msg, `"browser"`);
|
|
62962
63226
|
}
|
|
62963
63227
|
};
|
|
62964
|
-
|
|
62965
|
-
|
|
63228
|
+
/**
|
|
63229
|
+
* Build a diagnostic for an error resulting from a particular field in a
|
|
63230
|
+
* package.json file
|
|
63231
|
+
*
|
|
63232
|
+
* @param config the stencil config
|
|
63233
|
+
* @param compilerCtx the current compiler context
|
|
63234
|
+
* @param buildCtx the current build context
|
|
63235
|
+
* @param msg an error string
|
|
63236
|
+
* @param jsonField the key for the field which caused the error, used for
|
|
63237
|
+
* finding the error line in the original JSON file
|
|
63238
|
+
* @returns a diagnostic object
|
|
63239
|
+
*/
|
|
63240
|
+
const packageJsonError = (config, compilerCtx, buildCtx, msg, jsonField) => {
|
|
63241
|
+
const err = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
|
|
62966
63242
|
err.header = `Package Json`;
|
|
62967
63243
|
return err;
|
|
62968
63244
|
};
|
|
62969
|
-
|
|
62970
|
-
|
|
63245
|
+
/**
|
|
63246
|
+
* Build a diagnostic for a warning resulting from a particular field in a
|
|
63247
|
+
* package.json file
|
|
63248
|
+
*
|
|
63249
|
+
* @param config the stencil config
|
|
63250
|
+
* @param compilerCtx the current compiler context
|
|
63251
|
+
* @param buildCtx the current build context
|
|
63252
|
+
* @param msg an error string
|
|
63253
|
+
* @param jsonField the key for the field which caused the error, used for
|
|
63254
|
+
* finding the error line in the original JSON file
|
|
63255
|
+
* @returns a diagnostic object
|
|
63256
|
+
*/
|
|
63257
|
+
const packageJsonWarn = (config, compilerCtx, buildCtx, msg, jsonField) => {
|
|
63258
|
+
const warn = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField);
|
|
62971
63259
|
warn.header = `Package Json`;
|
|
62972
63260
|
warn.level = 'warn';
|
|
62973
63261
|
return warn;
|
|
@@ -64448,12 +64736,16 @@ const createConfigFlags = (init = {}) => {
|
|
|
64448
64736
|
};
|
|
64449
64737
|
|
|
64450
64738
|
const getConfig = (userConfig) => {
|
|
64451
|
-
var _a, _b;
|
|
64739
|
+
var _a, _b, _c, _d;
|
|
64452
64740
|
const logger = (_a = userConfig.logger) !== null && _a !== void 0 ? _a : createLogger();
|
|
64453
|
-
const config = {
|
|
64454
|
-
|
|
64455
|
-
|
|
64456
|
-
|
|
64741
|
+
const config = {
|
|
64742
|
+
...userConfig,
|
|
64743
|
+
flags: createConfigFlags((_b = userConfig.flags) !== null && _b !== void 0 ? _b : {}),
|
|
64744
|
+
logger,
|
|
64745
|
+
outputTargets: (_c = userConfig.outputTargets) !== null && _c !== void 0 ? _c : [],
|
|
64746
|
+
sys: (_d = userConfig.sys) !== null && _d !== void 0 ? _d : createSystem({ logger }),
|
|
64747
|
+
testing: userConfig !== null && userConfig !== void 0 ? userConfig : {},
|
|
64748
|
+
};
|
|
64457
64749
|
setPlatformPath(config.sys.platformPath);
|
|
64458
64750
|
if (config.flags.debug || config.flags.verbose) {
|
|
64459
64751
|
config.logLevel = 'debug';
|
|
@@ -65159,7 +65451,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
65159
65451
|
const dependencies = [
|
|
65160
65452
|
{
|
|
65161
65453
|
name: "@stencil/core",
|
|
65162
|
-
version: "2.17.
|
|
65454
|
+
version: "2.17.4",
|
|
65163
65455
|
main: "compiler/stencil.js",
|
|
65164
65456
|
resources: [
|
|
65165
65457
|
"package.json",
|
|
@@ -65572,7 +65864,7 @@ const validateHydrated = (config) => {
|
|
|
65572
65864
|
* Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
|
|
65573
65865
|
* property is set on them.
|
|
65574
65866
|
*
|
|
65575
|
-
* @param config
|
|
65867
|
+
* @param config a validated configuration object
|
|
65576
65868
|
* @param userOutputs an array of output targets
|
|
65577
65869
|
* @returns an array of validated DIST_COLLECTION output targets
|
|
65578
65870
|
*/
|
|
@@ -65881,20 +66173,20 @@ const validateVScodeDocsOutputTarget = (diagnostics, outputTarget) => {
|
|
|
65881
66173
|
return outputTarget;
|
|
65882
66174
|
};
|
|
65883
66175
|
|
|
65884
|
-
const validateAngular = (
|
|
66176
|
+
const validateAngular = (config, userOutputs) => {
|
|
65885
66177
|
const angularOutputTargets = userOutputs.filter(isOutputTargetAngular);
|
|
65886
66178
|
return angularOutputTargets.map((outputTarget) => {
|
|
65887
66179
|
let directivesProxyFile = outputTarget.directivesProxyFile;
|
|
65888
66180
|
if (directivesProxyFile && !isAbsolute$1(directivesProxyFile)) {
|
|
65889
|
-
directivesProxyFile = join(
|
|
66181
|
+
directivesProxyFile = join(config.rootDir, directivesProxyFile);
|
|
65890
66182
|
}
|
|
65891
66183
|
let directivesArrayFile = outputTarget.directivesArrayFile;
|
|
65892
66184
|
if (directivesArrayFile && !isAbsolute$1(directivesArrayFile)) {
|
|
65893
|
-
directivesArrayFile = join(
|
|
66185
|
+
directivesArrayFile = join(config.rootDir, directivesArrayFile);
|
|
65894
66186
|
}
|
|
65895
66187
|
let directivesUtilsFile = outputTarget.directivesUtilsFile;
|
|
65896
66188
|
if (directivesUtilsFile && !isAbsolute$1(directivesUtilsFile)) {
|
|
65897
|
-
directivesUtilsFile = join(
|
|
66189
|
+
directivesUtilsFile = join(config.rootDir, directivesUtilsFile);
|
|
65898
66190
|
}
|
|
65899
66191
|
return {
|
|
65900
66192
|
type: 'angular',
|
|
@@ -66512,7 +66804,8 @@ const validateWorkers = (config) => {
|
|
|
66512
66804
|
* @returns an object with config and diagnostics props
|
|
66513
66805
|
*/
|
|
66514
66806
|
const validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
66515
|
-
|
|
66807
|
+
var _a, _b, _c, _d;
|
|
66808
|
+
const config = Object.assign({}, userConfig); // not positive it's json safe
|
|
66516
66809
|
const diagnostics = [];
|
|
66517
66810
|
const logger = bootstrapConfig.logger || config.logger || createLogger();
|
|
66518
66811
|
const validatedConfig = {
|
|
@@ -66520,6 +66813,9 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
66520
66813
|
// flags _should_ be JSON safe
|
|
66521
66814
|
flags: JSON.parse(JSON.stringify(config.flags || {})),
|
|
66522
66815
|
logger,
|
|
66816
|
+
outputTargets: (_a = config.outputTargets) !== null && _a !== void 0 ? _a : [],
|
|
66817
|
+
sys: (_c = (_b = config.sys) !== null && _b !== void 0 ? _b : bootstrapConfig.sys) !== null && _c !== void 0 ? _c : createSystem({ logger }),
|
|
66818
|
+
testing: (_d = config.testing) !== null && _d !== void 0 ? _d : {},
|
|
66523
66819
|
};
|
|
66524
66820
|
// default devMode false
|
|
66525
66821
|
if (validatedConfig.flags.prod) {
|
|
@@ -66786,6 +67082,7 @@ const hasStencilConfigInclude = (includeProp) => Array.isArray(includeProp) && i
|
|
|
66786
67082
|
* @public
|
|
66787
67083
|
*/
|
|
66788
67084
|
const loadConfig = async (init = {}) => {
|
|
67085
|
+
var _a;
|
|
66789
67086
|
const results = {
|
|
66790
67087
|
config: null,
|
|
66791
67088
|
diagnostics: [],
|
|
@@ -66800,9 +67097,12 @@ const loadConfig = async (init = {}) => {
|
|
|
66800
67097
|
};
|
|
66801
67098
|
const unknownConfig = {};
|
|
66802
67099
|
try {
|
|
66803
|
-
const sys = init.sys || createSystem();
|
|
66804
67100
|
const config = init.config || {};
|
|
66805
67101
|
let configPath = init.configPath || config.configPath;
|
|
67102
|
+
// Pull the {@link CompilerSystem} out of the initialization object, or create one if it does not exist.
|
|
67103
|
+
// This entity is needed to load the project's configuration (and therefore needs to be created before it can be
|
|
67104
|
+
// attached to a configuration entity, validated or otherwise)
|
|
67105
|
+
const sys = (_a = init.sys) !== null && _a !== void 0 ? _a : createSystem();
|
|
66806
67106
|
const loadedConfigFile = await loadConfigFile(sys, results.diagnostics, configPath);
|
|
66807
67107
|
if (hasError(results.diagnostics)) {
|
|
66808
67108
|
return results;
|
|
@@ -67094,7 +67394,7 @@ const convertStaticToMeta = (config, compilerCtx, buildCtx, typeChecker, collect
|
|
|
67094
67394
|
let moduleFile;
|
|
67095
67395
|
const visitNode = (node) => {
|
|
67096
67396
|
if (t.isClassDeclaration(node)) {
|
|
67097
|
-
return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile,
|
|
67397
|
+
return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, transformOpts);
|
|
67098
67398
|
}
|
|
67099
67399
|
else if (t.isImportDeclaration(node)) {
|
|
67100
67400
|
parseModuleImport(config, compilerCtx, buildCtx, moduleFile, dirPath, node, !transformOpts.isolatedModules);
|