@stencil/core 2.15.1 → 2.15.2
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 +83 -13
- package/cli/index.js +83 -13
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +192 -61
- 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 +39 -3
- package/internal/stencil-public-compiler.d.ts +3 -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 +1 -3
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +1 -1
- package/sys/node/index.js +2038 -1330
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +2 -2
- package/testing/package.json +1 -1
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v2.15.
|
|
2
|
+
Stencil Compiler v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -3974,16 +3974,16 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
|
|
|
3974
3974
|
};
|
|
3975
3975
|
};
|
|
3976
3976
|
|
|
3977
|
-
const buildId = '
|
|
3977
|
+
const buildId = '20220509165949';
|
|
3978
3978
|
const minfyJsId = 'terser5.6.1_7';
|
|
3979
|
-
const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.
|
|
3979
|
+
const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.13_7';
|
|
3980
3980
|
const parse5Version = '6.0.1';
|
|
3981
3981
|
const rollupVersion = '2.42.3';
|
|
3982
3982
|
const sizzleVersion = '2.42.3';
|
|
3983
3983
|
const terserVersion = '5.6.1';
|
|
3984
3984
|
const typescriptVersion = '4.5.4';
|
|
3985
|
-
const vermoji = '
|
|
3986
|
-
const version$3 = '2.15.
|
|
3985
|
+
const vermoji = '🎢';
|
|
3986
|
+
const version$3 = '2.15.2';
|
|
3987
3987
|
const versions = {
|
|
3988
3988
|
stencil: version$3,
|
|
3989
3989
|
parse5: parse5Version,
|
|
@@ -58929,6 +58929,68 @@ const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
|
|
|
58929
58929
|
}
|
|
58930
58930
|
return dtsContent;
|
|
58931
58931
|
};
|
|
58932
|
+
/**
|
|
58933
|
+
* Utility for ensuring that naming collisions do not appear in type declaration files for a component's class members
|
|
58934
|
+
* decorated with @Prop, @Event, and @Method
|
|
58935
|
+
* @param typeReferences all type names used by a component class member
|
|
58936
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
58937
|
+
* @param sourceFilePath the path to the source file of a component using the type being inspected
|
|
58938
|
+
* @param initialType the name of the type that may be updated
|
|
58939
|
+
* @returns the updated type name, which may be the same as the initial type name provided as an argument to this
|
|
58940
|
+
* function
|
|
58941
|
+
*/
|
|
58942
|
+
const updateTypeIdentifierNames = (typeReferences, typeImportData, sourceFilePath, initialType) => {
|
|
58943
|
+
let currentTypeName = initialType;
|
|
58944
|
+
// iterate over each of the type references, as there may be >1 reference to inspect
|
|
58945
|
+
for (let typeReference of Object.values(typeReferences)) {
|
|
58946
|
+
const importResolvedFile = getTypeImportPath(typeReference.path, sourceFilePath);
|
|
58947
|
+
if (!typeImportData.hasOwnProperty(importResolvedFile)) {
|
|
58948
|
+
continue;
|
|
58949
|
+
}
|
|
58950
|
+
for (let typesImportDatumElement of typeImportData[importResolvedFile]) {
|
|
58951
|
+
currentTypeName = updateTypeName(currentTypeName, typesImportDatumElement);
|
|
58952
|
+
}
|
|
58953
|
+
}
|
|
58954
|
+
return currentTypeName;
|
|
58955
|
+
};
|
|
58956
|
+
/**
|
|
58957
|
+
* Determine the path of a given type reference, relative to the path of a source file
|
|
58958
|
+
* @param importResolvedFile the path to the file containing the resolve type. may be absolute or relative
|
|
58959
|
+
* @param sourceFilePath the component source file path to resolve against
|
|
58960
|
+
* @returns the path of the type import
|
|
58961
|
+
*/
|
|
58962
|
+
const getTypeImportPath = (importResolvedFile, sourceFilePath) => {
|
|
58963
|
+
const isPathRelative = importResolvedFile && importResolvedFile.startsWith('.');
|
|
58964
|
+
if (isPathRelative) {
|
|
58965
|
+
importResolvedFile = resolve$1(dirname(sourceFilePath), importResolvedFile);
|
|
58966
|
+
}
|
|
58967
|
+
return importResolvedFile;
|
|
58968
|
+
};
|
|
58969
|
+
/**
|
|
58970
|
+
* Determine whether the string representation of a type should be replaced with an alias
|
|
58971
|
+
* @param currentTypeName the current string representation of a type
|
|
58972
|
+
* @param typeAlias a type member and a potential different name associated with the type member
|
|
58973
|
+
* @returns the updated string representation of a type. If the type is not updated, the original type name is returned
|
|
58974
|
+
*/
|
|
58975
|
+
const updateTypeName = (currentTypeName, typeAlias) => {
|
|
58976
|
+
if (!typeAlias.importName) {
|
|
58977
|
+
return currentTypeName;
|
|
58978
|
+
}
|
|
58979
|
+
// TODO(STENCIL-419): Update this functionality to no longer use a regex
|
|
58980
|
+
// negative lookahead specifying that quotes that designate a string in JavaScript cannot follow some expression
|
|
58981
|
+
const endingStrChar = '(?!("|\'|`))';
|
|
58982
|
+
/**
|
|
58983
|
+
* A regular expression that looks at type names along a [word boundary](https://www.regular-expressions.info/wordboundaries.html).
|
|
58984
|
+
* This is used as the best approximation for replacing type collisions, as this stage of compilation has only
|
|
58985
|
+
* 'flattened' type information in the form of a String.
|
|
58986
|
+
*
|
|
58987
|
+
* This regex should be expected to capture types that are found in generics, unions, intersections, etc., but not
|
|
58988
|
+
* those in string literals. We do not check for a starting quote (" | ' | `) here as some browsers do not support
|
|
58989
|
+
* negative lookbehind. This works "well enough" until STENCIL-419 is completed.
|
|
58990
|
+
*/
|
|
58991
|
+
const typeNameRegex = new RegExp(`${typeAlias.localName}\\b${endingStrChar}`, 'g');
|
|
58992
|
+
return currentTypeName.replace(typeNameRegex, typeAlias.importName);
|
|
58993
|
+
};
|
|
58932
58994
|
/**
|
|
58933
58995
|
* Writes Stencil core typings file to disk for a dist-* output target
|
|
58934
58996
|
* @param config the Stencil configuration associated with the project being compiled
|
|
@@ -58970,14 +59032,13 @@ const sortImportNames = (a, b) => {
|
|
|
58970
59032
|
/**
|
|
58971
59033
|
* Generates the individual event types for all @Event() decorated events in a component
|
|
58972
59034
|
* @param cmpMeta component runtime metadata for a single component
|
|
59035
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
58973
59036
|
* @returns the generated type metadata
|
|
58974
59037
|
*/
|
|
58975
|
-
const generateEventTypes = (cmpMeta) => {
|
|
59038
|
+
const generateEventTypes = (cmpMeta, typeImportData) => {
|
|
58976
59039
|
return cmpMeta.events.map((cmpEvent) => {
|
|
58977
59040
|
const name = `on${toTitleCase(cmpEvent.name)}`;
|
|
58978
|
-
const type = cmpEvent.
|
|
58979
|
-
? `(event: CustomEvent<${cmpEvent.complexType.original}>) => void`
|
|
58980
|
-
: `CustomEvent`;
|
|
59041
|
+
const type = getEventType$1(cmpEvent, typeImportData, cmpMeta.sourceFilePath);
|
|
58981
59042
|
return {
|
|
58982
59043
|
name,
|
|
58983
59044
|
type,
|
|
@@ -58988,33 +59049,59 @@ const generateEventTypes = (cmpMeta) => {
|
|
|
58988
59049
|
};
|
|
58989
59050
|
});
|
|
58990
59051
|
};
|
|
59052
|
+
/**
|
|
59053
|
+
* Determine the correct type name for all type(s) used by a class member annotated with `@Event()`
|
|
59054
|
+
* @param cmpEvent the compiler metadata for a single `@Event()`
|
|
59055
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
59056
|
+
* @param componentSourcePath the path to the component on disk
|
|
59057
|
+
* @returns the type associated with a `@Event()`
|
|
59058
|
+
*/
|
|
59059
|
+
const getEventType$1 = (cmpEvent, typeImportData, componentSourcePath) => {
|
|
59060
|
+
if (!cmpEvent.complexType.original) {
|
|
59061
|
+
return 'CustomEvent';
|
|
59062
|
+
}
|
|
59063
|
+
const updatedTypeName = updateTypeIdentifierNames(cmpEvent.complexType.references, typeImportData, componentSourcePath, cmpEvent.complexType.original);
|
|
59064
|
+
return `(event: CustomEvent<${updatedTypeName}>) => void`;
|
|
59065
|
+
};
|
|
58991
59066
|
|
|
58992
59067
|
/**
|
|
58993
59068
|
* Generates the individual event types for all @Method() decorated events in a component
|
|
58994
59069
|
* @param cmpMeta component runtime metadata for a single component
|
|
59070
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
58995
59071
|
* @returns the generated type metadata
|
|
58996
59072
|
*/
|
|
58997
|
-
const generateMethodTypes = (cmpMeta) => {
|
|
59073
|
+
const generateMethodTypes = (cmpMeta, typeImportData) => {
|
|
58998
59074
|
return cmpMeta.methods.map((cmpMethod) => ({
|
|
58999
59075
|
name: cmpMethod.name,
|
|
59000
|
-
type: cmpMethod.
|
|
59076
|
+
type: getType$1(cmpMethod, typeImportData, cmpMeta.sourceFilePath),
|
|
59001
59077
|
optional: false,
|
|
59002
59078
|
required: false,
|
|
59003
59079
|
internal: cmpMethod.internal,
|
|
59004
59080
|
jsdoc: getTextDocs(cmpMethod.docs),
|
|
59005
59081
|
}));
|
|
59006
59082
|
};
|
|
59083
|
+
/**
|
|
59084
|
+
* Determine the correct type name for all type(s) used by a class member annotated with `@Method()`
|
|
59085
|
+
* @param cmpMethod the compiler metadata for a single `@Method()`
|
|
59086
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
59087
|
+
* @param componentSourcePath the path to the component on disk
|
|
59088
|
+
* @returns the type associated with a `@Method()`
|
|
59089
|
+
*/
|
|
59090
|
+
function getType$1(cmpMethod, typeImportData, componentSourcePath) {
|
|
59091
|
+
return updateTypeIdentifierNames(cmpMethod.complexType.references, typeImportData, componentSourcePath, cmpMethod.complexType.signature);
|
|
59092
|
+
}
|
|
59007
59093
|
|
|
59008
59094
|
/**
|
|
59009
59095
|
* Generates the individual event types for all @Prop() decorated events in a component
|
|
59010
59096
|
* @param cmpMeta component runtime metadata for a single component
|
|
59097
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
59011
59098
|
* @returns the generated type metadata
|
|
59012
59099
|
*/
|
|
59013
|
-
const generatePropTypes = (cmpMeta) => {
|
|
59100
|
+
const generatePropTypes = (cmpMeta, typeImportData) => {
|
|
59014
59101
|
return [
|
|
59015
59102
|
...cmpMeta.properties.map((cmpProp) => ({
|
|
59016
59103
|
name: cmpProp.name,
|
|
59017
|
-
type: cmpProp.
|
|
59104
|
+
type: getType(cmpProp, typeImportData, cmpMeta.sourceFilePath),
|
|
59018
59105
|
optional: cmpProp.optional,
|
|
59019
59106
|
required: cmpProp.required,
|
|
59020
59107
|
internal: cmpProp.internal,
|
|
@@ -59030,20 +59117,31 @@ const generatePropTypes = (cmpMeta) => {
|
|
|
59030
59117
|
})),
|
|
59031
59118
|
];
|
|
59032
59119
|
};
|
|
59120
|
+
/**
|
|
59121
|
+
* Determine the correct type name for all type(s) used by a class member annotated with `@Prop()`
|
|
59122
|
+
* @param cmpProp the compiler metadata for a single `@Prop()`
|
|
59123
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
59124
|
+
* @param componentSourcePath the path to the component on disk
|
|
59125
|
+
* @returns the type associated with a `@Prop()`
|
|
59126
|
+
*/
|
|
59127
|
+
function getType(cmpProp, typeImportData, componentSourcePath) {
|
|
59128
|
+
return updateTypeIdentifierNames(cmpProp.complexType.references, typeImportData, componentSourcePath, cmpProp.complexType.original);
|
|
59129
|
+
}
|
|
59033
59130
|
|
|
59034
59131
|
/**
|
|
59035
59132
|
* Generate a string based on the types that are defined within a component
|
|
59036
59133
|
* @param cmp the metadata for the component that a type definition string is generated for
|
|
59134
|
+
* @param typeImportData locally/imported/globally used type names, which may be used to prevent naming collisions
|
|
59037
59135
|
* @param areTypesInternal `true` if types being generated are for a project's internal purposes, `false` otherwise
|
|
59038
59136
|
* @returns the generated types string alongside additional metadata
|
|
59039
59137
|
*/
|
|
59040
|
-
const generateComponentTypes = (cmp, areTypesInternal) => {
|
|
59138
|
+
const generateComponentTypes = (cmp, typeImportData, areTypesInternal) => {
|
|
59041
59139
|
const tagName = cmp.tagName.toLowerCase();
|
|
59042
59140
|
const tagNameAsPascal = dashToPascalCase$1(tagName);
|
|
59043
59141
|
const htmlElementName = `HTML${tagNameAsPascal}Element`;
|
|
59044
|
-
const propAttributes = generatePropTypes(cmp);
|
|
59045
|
-
const methodAttributes = generateMethodTypes(cmp);
|
|
59046
|
-
const eventAttributes = generateEventTypes(cmp);
|
|
59142
|
+
const propAttributes = generatePropTypes(cmp, typeImportData);
|
|
59143
|
+
const methodAttributes = generateMethodTypes(cmp, typeImportData);
|
|
59144
|
+
const eventAttributes = generateEventTypes(cmp, typeImportData);
|
|
59047
59145
|
const componentAttributes = attributesToMultiLineString([...propAttributes, ...methodAttributes], false, areTypesInternal);
|
|
59048
59146
|
const isDep = cmp.isCollectionDependency;
|
|
59049
59147
|
const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal);
|
|
@@ -59089,64 +59187,76 @@ const attributesToMultiLineString = (attributes, jsxAttributes, internal) => {
|
|
|
59089
59187
|
|
|
59090
59188
|
/**
|
|
59091
59189
|
* Find all referenced types by a component and add them to the `importDataObj` parameter
|
|
59092
|
-
* @param importDataObj
|
|
59093
|
-
* @param
|
|
59190
|
+
* @param importDataObj an output parameter that contains the imported types seen thus far by the compiler
|
|
59191
|
+
* @param typeCounts a map of seen types and the number of times the type has been seen
|
|
59094
59192
|
* @param cmp the metadata associated with the component whose types are being inspected
|
|
59095
59193
|
* @param filePath the path of the component file
|
|
59096
59194
|
* @returns the updated import data
|
|
59097
59195
|
*/
|
|
59098
|
-
const updateReferenceTypeImports = (importDataObj,
|
|
59099
|
-
const updateImportReferences = updateImportReferenceFactory(
|
|
59196
|
+
const updateReferenceTypeImports = (importDataObj, typeCounts, cmp, filePath) => {
|
|
59197
|
+
const updateImportReferences = updateImportReferenceFactory(typeCounts, filePath);
|
|
59100
59198
|
return [...cmp.properties, ...cmp.events, ...cmp.methods]
|
|
59101
59199
|
.filter((cmpProp) => cmpProp.complexType && cmpProp.complexType.references)
|
|
59102
|
-
.reduce((
|
|
59103
|
-
return updateImportReferences(
|
|
59200
|
+
.reduce((typesImportData, cmpProp) => {
|
|
59201
|
+
return updateImportReferences(typesImportData, cmpProp.complexType.references);
|
|
59104
59202
|
}, importDataObj);
|
|
59105
59203
|
};
|
|
59106
|
-
|
|
59204
|
+
/**
|
|
59205
|
+
* Factory function to create an `ImportReferenceUpdater` instance
|
|
59206
|
+
* @param typeCounts a key-value store of seen type names and the number of times the type name has been seen
|
|
59207
|
+
* @param filePath the path of the file containing the component whose imports are being inspected
|
|
59208
|
+
* @returns an `ImportReferenceUpdater` instance for updating import references in the provided `filePath`
|
|
59209
|
+
*/
|
|
59210
|
+
const updateImportReferenceFactory = (typeCounts, filePath) => {
|
|
59211
|
+
/**
|
|
59212
|
+
* Determines the number of times that a type identifier (name) has been used. If an identifier has been used before,
|
|
59213
|
+
* append the number of times the identifier has been seen to its name to avoid future naming collisions
|
|
59214
|
+
* @param name the identifier name to check for previous usages
|
|
59215
|
+
* @returns the identifier name, potentially with an integer appended to its name if it has been seen before.
|
|
59216
|
+
*/
|
|
59107
59217
|
function getIncrementTypeName(name) {
|
|
59108
|
-
const counter =
|
|
59218
|
+
const counter = typeCounts.get(name);
|
|
59109
59219
|
if (counter === undefined) {
|
|
59110
|
-
|
|
59220
|
+
typeCounts.set(name, 1);
|
|
59111
59221
|
return name;
|
|
59112
59222
|
}
|
|
59113
|
-
|
|
59223
|
+
typeCounts.set(name, counter + 1);
|
|
59114
59224
|
return `${name}${counter}`;
|
|
59115
59225
|
}
|
|
59116
|
-
return (
|
|
59226
|
+
return (existingTypeImportData, typeReferences) => {
|
|
59117
59227
|
Object.keys(typeReferences)
|
|
59118
59228
|
.map((typeName) => {
|
|
59119
59229
|
return [typeName, typeReferences[typeName]];
|
|
59120
59230
|
})
|
|
59121
|
-
.forEach(([typeName,
|
|
59122
|
-
let
|
|
59231
|
+
.forEach(([typeName, typeReference]) => {
|
|
59232
|
+
let importResolvedFile;
|
|
59123
59233
|
// If global then there is no import statement needed
|
|
59124
|
-
if (
|
|
59234
|
+
if (typeReference.location === 'global') {
|
|
59125
59235
|
return;
|
|
59126
59236
|
// If local then import location is the current file
|
|
59127
59237
|
}
|
|
59128
|
-
else if (
|
|
59129
|
-
|
|
59238
|
+
else if (typeReference.location === 'local') {
|
|
59239
|
+
importResolvedFile = filePath;
|
|
59130
59240
|
}
|
|
59131
|
-
else if (
|
|
59132
|
-
|
|
59241
|
+
else if (typeReference.location === 'import') {
|
|
59242
|
+
importResolvedFile = typeReference.path;
|
|
59133
59243
|
}
|
|
59134
59244
|
// If this is a relative path make it absolute
|
|
59135
|
-
if (
|
|
59136
|
-
|
|
59245
|
+
if (importResolvedFile.startsWith('.')) {
|
|
59246
|
+
importResolvedFile = resolve$1(dirname(filePath), importResolvedFile);
|
|
59137
59247
|
}
|
|
59138
|
-
|
|
59248
|
+
existingTypeImportData[importResolvedFile] = existingTypeImportData[importResolvedFile] || [];
|
|
59139
59249
|
// If this file already has a reference to this type move on
|
|
59140
|
-
if (
|
|
59250
|
+
if (existingTypeImportData[importResolvedFile].find((df) => df.localName === typeName)) {
|
|
59141
59251
|
return;
|
|
59142
59252
|
}
|
|
59143
59253
|
const newTypeName = getIncrementTypeName(typeName);
|
|
59144
|
-
|
|
59254
|
+
existingTypeImportData[importResolvedFile].push({
|
|
59145
59255
|
localName: typeName,
|
|
59146
59256
|
importName: newTypeName,
|
|
59147
59257
|
});
|
|
59148
59258
|
});
|
|
59149
|
-
return
|
|
59259
|
+
return existingTypeImportData;
|
|
59150
59260
|
};
|
|
59151
59261
|
};
|
|
59152
59262
|
|
|
@@ -59196,11 +59306,18 @@ const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
59196
59306
|
const allTypes = new Map();
|
|
59197
59307
|
const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
|
|
59198
59308
|
const modules = components.map((cmp) => {
|
|
59309
|
+
/**
|
|
59310
|
+
* Generate a key-value store that uses the path to the file where an import is defined as the key, and an object
|
|
59311
|
+
* containing the import's original name and any 'new' name we give it to avoid collisions. We're generating this
|
|
59312
|
+
* data structure for each Stencil component in series, therefore the memory footprint of this entity will likely
|
|
59313
|
+
* grow as more components (with additional types) are processed.
|
|
59314
|
+
*/
|
|
59199
59315
|
typeImportData = updateReferenceTypeImports(typeImportData, allTypes, cmp, cmp.sourceFilePath);
|
|
59200
|
-
return generateComponentTypes(cmp, areTypesInternal);
|
|
59316
|
+
return generateComponentTypes(cmp, typeImportData, areTypesInternal);
|
|
59201
59317
|
});
|
|
59202
59318
|
c.push(COMPONENTS_DTS_HEADER);
|
|
59203
59319
|
c.push(`import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";`);
|
|
59320
|
+
// write the import statements for our type declaration file
|
|
59204
59321
|
c.push(...Object.keys(typeImportData).map((filePath) => {
|
|
59205
59322
|
const typeData = typeImportData[filePath];
|
|
59206
59323
|
let importFilePath;
|
|
@@ -64140,7 +64257,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
64140
64257
|
const dependencies = [
|
|
64141
64258
|
{
|
|
64142
64259
|
name: "@stencil/core",
|
|
64143
|
-
version: "2.15.
|
|
64260
|
+
version: "2.15.2",
|
|
64144
64261
|
main: "compiler/stencil.js",
|
|
64145
64262
|
resources: [
|
|
64146
64263
|
"package.json",
|
|
@@ -64597,9 +64714,19 @@ const validateCustomOutput = (config, diagnostics, userOutputs) => {
|
|
|
64597
64714
|
});
|
|
64598
64715
|
};
|
|
64599
64716
|
|
|
64717
|
+
/**
|
|
64718
|
+
* Validate that the "dist" output targets are valid and ready to go.
|
|
64719
|
+
*
|
|
64720
|
+
* This function will also add in additional output targets to its output, based on the input supplied.
|
|
64721
|
+
*
|
|
64722
|
+
* @param config the compiler config, what else?
|
|
64723
|
+
* @param userOutputs a user-supplied list of output targets.
|
|
64724
|
+
* @returns a list of OutputTargets which have been validated for us.
|
|
64725
|
+
*/
|
|
64600
64726
|
const validateDist = (config, userOutputs) => {
|
|
64601
64727
|
const distOutputTargets = userOutputs.filter(isOutputTargetDist);
|
|
64602
64728
|
return distOutputTargets.reduce((outputs, o) => {
|
|
64729
|
+
var _a;
|
|
64603
64730
|
const distOutputTarget = validateOutputTargetDist(config, o);
|
|
64604
64731
|
outputs.push(distOutputTarget);
|
|
64605
64732
|
const namespace = config.fsNamespace || 'app';
|
|
@@ -64619,7 +64746,7 @@ const validateDist = (config, userOutputs) => {
|
|
|
64619
64746
|
type: COPY,
|
|
64620
64747
|
dir: lazyDir,
|
|
64621
64748
|
copyAssets: 'dist',
|
|
64622
|
-
copy:
|
|
64749
|
+
copy: ((_a = distOutputTarget.copy) !== null && _a !== void 0 ? _a : []).concat(),
|
|
64623
64750
|
});
|
|
64624
64751
|
outputs.push({
|
|
64625
64752
|
type: DIST_GLOBAL_STYLES,
|
|
@@ -64629,7 +64756,6 @@ const validateDist = (config, userOutputs) => {
|
|
|
64629
64756
|
type: DIST_TYPES,
|
|
64630
64757
|
dir: distOutputTarget.dir,
|
|
64631
64758
|
typesDir: distOutputTarget.typesDir,
|
|
64632
|
-
empty: distOutputTarget.empty,
|
|
64633
64759
|
});
|
|
64634
64760
|
if (config.buildDist) {
|
|
64635
64761
|
if (distOutputTarget.collectionDir) {
|
|
@@ -64674,39 +64800,44 @@ const validateDist = (config, userOutputs) => {
|
|
|
64674
64800
|
return outputs;
|
|
64675
64801
|
}, []);
|
|
64676
64802
|
};
|
|
64803
|
+
/**
|
|
64804
|
+
* Validate that an OutputTargetDist object has what it needs to do it's job.
|
|
64805
|
+
* To enforce this, we have this function return
|
|
64806
|
+
* `Required<d.OutputTargetDist>`, giving us a compile-time check that all
|
|
64807
|
+
* properties are defined (with either user-supplied or default values).
|
|
64808
|
+
*
|
|
64809
|
+
* @param config the current config
|
|
64810
|
+
* @param o the OutputTargetDist object we want to validate
|
|
64811
|
+
* @returns `Required<d.OutputTargetDist>`, i.e. `d.OutputTargetDist` with all
|
|
64812
|
+
* optional properties rendered un-optional.
|
|
64813
|
+
*/
|
|
64677
64814
|
const validateOutputTargetDist = (config, o) => {
|
|
64815
|
+
var _a;
|
|
64816
|
+
// we need to create an object with a bunch of default values here so that
|
|
64817
|
+
// the typescript compiler can infer their types correctly
|
|
64678
64818
|
const outputTarget = {
|
|
64679
64819
|
...o,
|
|
64680
64820
|
dir: getAbsolutePath(config, o.dir || DEFAULT_DIR),
|
|
64821
|
+
buildDir: isString$1(o.buildDir) ? o.buildDir : DEFAULT_BUILD_DIR,
|
|
64822
|
+
collectionDir: o.collectionDir !== undefined ? o.collectionDir : DEFAULT_COLLECTION_DIR,
|
|
64823
|
+
typesDir: o.typesDir || DEFAULT_TYPES_DIR,
|
|
64824
|
+
esmLoaderPath: o.esmLoaderPath || DEFAULT_ESM_LOADER_DIR,
|
|
64825
|
+
copy: validateCopy((_a = o.copy) !== null && _a !== void 0 ? _a : [], []),
|
|
64826
|
+
polyfills: isBoolean$1(o.polyfills) ? o.polyfills : undefined,
|
|
64827
|
+
empty: isBoolean$1(o.empty) ? o.empty : true,
|
|
64681
64828
|
};
|
|
64682
|
-
if (!isString$1(outputTarget.buildDir)) {
|
|
64683
|
-
outputTarget.buildDir = DEFAULT_BUILD_DIR;
|
|
64684
|
-
}
|
|
64685
64829
|
if (!isAbsolute$1(outputTarget.buildDir)) {
|
|
64686
64830
|
outputTarget.buildDir = join(outputTarget.dir, outputTarget.buildDir);
|
|
64687
64831
|
}
|
|
64688
|
-
if (outputTarget.collectionDir === undefined) {
|
|
64689
|
-
outputTarget.collectionDir = DEFAULT_COLLECTION_DIR;
|
|
64690
|
-
}
|
|
64691
64832
|
if (outputTarget.collectionDir && !isAbsolute$1(outputTarget.collectionDir)) {
|
|
64692
64833
|
outputTarget.collectionDir = join(outputTarget.dir, outputTarget.collectionDir);
|
|
64693
64834
|
}
|
|
64694
|
-
if (!outputTarget.esmLoaderPath) {
|
|
64695
|
-
outputTarget.esmLoaderPath = DEFAULT_ESM_LOADER_DIR;
|
|
64696
|
-
}
|
|
64697
64835
|
if (!isAbsolute$1(outputTarget.esmLoaderPath)) {
|
|
64698
64836
|
outputTarget.esmLoaderPath = resolve$1(outputTarget.dir, outputTarget.esmLoaderPath);
|
|
64699
64837
|
}
|
|
64700
|
-
if (!outputTarget.typesDir) {
|
|
64701
|
-
outputTarget.typesDir = DEFAULT_TYPES_DIR;
|
|
64702
|
-
}
|
|
64703
64838
|
if (!isAbsolute$1(outputTarget.typesDir)) {
|
|
64704
64839
|
outputTarget.typesDir = join(outputTarget.dir, outputTarget.typesDir);
|
|
64705
64840
|
}
|
|
64706
|
-
if (!isBoolean$1(outputTarget.empty)) {
|
|
64707
|
-
outputTarget.empty = true;
|
|
64708
|
-
}
|
|
64709
|
-
outputTarget.copy = validateCopy(outputTarget.copy, []);
|
|
64710
64841
|
return outputTarget;
|
|
64711
64842
|
};
|
|
64712
64843
|
const DEFAULT_DIR = 'dist';
|