@stencil/core 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +72 -55
- package/cli/index.js +72 -55
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +109 -32
- package/compiler/stencil.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +3 -3
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- 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 +2 -2
- 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/polyfills/css-shim.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1 -1
- package/internal/package.json +1 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +13 -3
- package/mock-doc/index.d.ts +4 -0
- package/mock-doc/index.js +13 -3
- package/mock-doc/package.json +1 -1
- package/package.json +4 -2
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +11 -11
- package/sys/node/node-fetch.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +8 -8
- 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.1 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -872,7 +872,7 @@ const normalizeDiagnostic = (compilerCtx, diagnostic) => {
|
|
|
872
872
|
diagnostic.messageText = diagnostic.messageText.message;
|
|
873
873
|
}
|
|
874
874
|
else if (typeof diagnostic.messageText === 'string' && diagnostic.messageText.indexOf('Error: ') === 0) {
|
|
875
|
-
diagnostic.messageText = diagnostic.messageText.
|
|
875
|
+
diagnostic.messageText = diagnostic.messageText.slice(7);
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
if (diagnostic.messageText) {
|
|
@@ -1161,7 +1161,7 @@ const loadRollupDiagnostics = (config, compilerCtx, buildCtx, rollupError) => {
|
|
|
1161
1161
|
};
|
|
1162
1162
|
diagnostic.lineNumber = errorLine.lineNumber;
|
|
1163
1163
|
diagnostic.columnNumber = errorLine.errorCharStart;
|
|
1164
|
-
const highlightLine = errorLine.text.
|
|
1164
|
+
const highlightLine = errorLine.text.slice(loc.column);
|
|
1165
1165
|
for (let i = 0; i < highlightLine.length; i++) {
|
|
1166
1166
|
if (charBreak.has(highlightLine.charAt(i))) {
|
|
1167
1167
|
break;
|
|
@@ -1588,7 +1588,7 @@ const createJsVarName = (fileName) => {
|
|
|
1588
1588
|
fileName = fileName.replace(/[|;$%@"<>()+,.{}_\!\/\\]/g, '-');
|
|
1589
1589
|
fileName = dashToPascalCase$1(fileName);
|
|
1590
1590
|
if (fileName.length > 1) {
|
|
1591
|
-
fileName = fileName[0].toLowerCase() + fileName.
|
|
1591
|
+
fileName = fileName[0].toLowerCase() + fileName.slice(1);
|
|
1592
1592
|
}
|
|
1593
1593
|
else {
|
|
1594
1594
|
fileName = fileName.toLowerCase();
|
|
@@ -1711,15 +1711,16 @@ const SKIP_DEPS = ['@stencil/core'];
|
|
|
1711
1711
|
* @returns an error message if the tag has an invalid name, undefined if the tag name passes all checks
|
|
1712
1712
|
*/
|
|
1713
1713
|
const validateComponentTag = (tag) => {
|
|
1714
|
+
// we want to check this first since we call some String.prototype methods below
|
|
1715
|
+
if (typeof tag !== 'string') {
|
|
1716
|
+
return `Tag "${tag}" must be a string type`;
|
|
1717
|
+
}
|
|
1714
1718
|
if (tag !== tag.trim()) {
|
|
1715
1719
|
return `Tag can not contain white spaces`;
|
|
1716
1720
|
}
|
|
1717
1721
|
if (tag !== tag.toLowerCase()) {
|
|
1718
1722
|
return `Tag can not contain upper case characters`;
|
|
1719
1723
|
}
|
|
1720
|
-
if (typeof tag !== 'string') {
|
|
1721
|
-
return `Tag "${tag}" must be a string type`;
|
|
1722
|
-
}
|
|
1723
1724
|
if (tag.length === 0) {
|
|
1724
1725
|
return `Received empty tag value`;
|
|
1725
1726
|
}
|
|
@@ -3973,7 +3974,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
|
|
|
3973
3974
|
};
|
|
3974
3975
|
};
|
|
3975
3976
|
|
|
3976
|
-
const buildId = '
|
|
3977
|
+
const buildId = '20220418164701';
|
|
3977
3978
|
const minfyJsId = 'terser5.6.1_7';
|
|
3978
3979
|
const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.8_7';
|
|
3979
3980
|
const parse5Version = '6.0.1';
|
|
@@ -3981,8 +3982,8 @@ const rollupVersion = '2.42.3';
|
|
|
3981
3982
|
const sizzleVersion = '2.42.3';
|
|
3982
3983
|
const terserVersion = '5.6.1';
|
|
3983
3984
|
const typescriptVersion = '4.5.4';
|
|
3984
|
-
const vermoji = '
|
|
3985
|
-
const version$3 = '2.15.
|
|
3985
|
+
const vermoji = '🐼';
|
|
3986
|
+
const version$3 = '2.15.1';
|
|
3986
3987
|
const versions = {
|
|
3987
3988
|
stencil: version$3,
|
|
3988
3989
|
parse5: parse5Version,
|
|
@@ -4442,7 +4443,7 @@ const createSystem = (c) => {
|
|
|
4442
4443
|
const hashArray = Array.from(new Uint8Array(arrayBuffer)); // convert buffer to byte array
|
|
4443
4444
|
let hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
|
|
4444
4445
|
if (typeof hashLength === 'number') {
|
|
4445
|
-
hashHex = hashHex.
|
|
4446
|
+
hashHex = hashHex.slice(0, hashLength);
|
|
4446
4447
|
}
|
|
4447
4448
|
return hashHex;
|
|
4448
4449
|
};
|
|
@@ -5067,13 +5068,13 @@ const getCssSelectors = (sel) => {
|
|
|
5067
5068
|
if (items[i].length === 0)
|
|
5068
5069
|
continue;
|
|
5069
5070
|
if (items[i].charAt(0) === '.') {
|
|
5070
|
-
SELECTORS.classNames.push(items[i].
|
|
5071
|
+
SELECTORS.classNames.push(items[i].slice(1));
|
|
5071
5072
|
}
|
|
5072
5073
|
else if (items[i].charAt(0) === '#') {
|
|
5073
|
-
SELECTORS.ids.push(items[i].
|
|
5074
|
+
SELECTORS.ids.push(items[i].slice(1));
|
|
5074
5075
|
}
|
|
5075
5076
|
else if (items[i].charAt(0) === '[') {
|
|
5076
|
-
items[i] = items[i].
|
|
5077
|
+
items[i] = items[i].slice(1).split('=')[0].split(']')[0].trim();
|
|
5077
5078
|
SELECTORS.attrs.push(items[i].toLowerCase());
|
|
5078
5079
|
}
|
|
5079
5080
|
else if (/[a-z]/g.test(items[i].charAt(0))) {
|
|
@@ -8662,7 +8663,7 @@ const loadMinifyJsDiagnostics = (sourceText, diagnostics, error) => {
|
|
|
8662
8663
|
};
|
|
8663
8664
|
d.lineNumber = errorLine.lineNumber;
|
|
8664
8665
|
d.columnNumber = errorLine.errorCharStart;
|
|
8665
|
-
const highlightLine = errorLine.text.
|
|
8666
|
+
const highlightLine = errorLine.text.slice(d.columnNumber);
|
|
8666
8667
|
for (let i = 0; i < highlightLine.length; i++) {
|
|
8667
8668
|
if (MINIFY_CHAR_BREAK.has(highlightLine.charAt(i))) {
|
|
8668
8669
|
break;
|
|
@@ -9516,7 +9517,7 @@ const standardNormalizeHref = (prerenderConfig, diagnostics, url) => {
|
|
|
9516
9517
|
// url should NOT have a trailing slash
|
|
9517
9518
|
if (href.endsWith('/') && url.pathname !== '/') {
|
|
9518
9519
|
// this has a trailing slash and it's not the root path
|
|
9519
|
-
href = href.
|
|
9520
|
+
href = href.slice(0, -1);
|
|
9520
9521
|
}
|
|
9521
9522
|
}
|
|
9522
9523
|
return href;
|
|
@@ -14367,7 +14368,7 @@ function toDataAttribute(str) {
|
|
|
14367
14368
|
.toLowerCase());
|
|
14368
14369
|
}
|
|
14369
14370
|
function dashToPascalCase(str) {
|
|
14370
|
-
str = String(str).
|
|
14371
|
+
str = String(str).slice(5);
|
|
14371
14372
|
return str
|
|
14372
14373
|
.split('-')
|
|
14373
14374
|
.map((segment, index) => {
|
|
@@ -14571,7 +14572,7 @@ function cssCaseToJsCase(str) {
|
|
|
14571
14572
|
.split('-')
|
|
14572
14573
|
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
14573
14574
|
.join('');
|
|
14574
|
-
str = str.
|
|
14575
|
+
str = str.slice(0, 1).toLowerCase() + str.slice(1);
|
|
14575
14576
|
}
|
|
14576
14577
|
return str;
|
|
14577
14578
|
}
|
|
@@ -16924,6 +16925,17 @@ MockElement.prototype.cloneNode = function (deep) {
|
|
|
16924
16925
|
return cloned;
|
|
16925
16926
|
};
|
|
16926
16927
|
|
|
16928
|
+
let sharedDocument;
|
|
16929
|
+
function parseHtmlToDocument(html, ownerDocument = null) {
|
|
16930
|
+
if (ownerDocument == null) {
|
|
16931
|
+
if (sharedDocument == null) {
|
|
16932
|
+
sharedDocument = new MockDocument();
|
|
16933
|
+
}
|
|
16934
|
+
ownerDocument = sharedDocument;
|
|
16935
|
+
}
|
|
16936
|
+
return parseDocumentUtil(ownerDocument, html);
|
|
16937
|
+
}
|
|
16938
|
+
|
|
16927
16939
|
class MockHeaders {
|
|
16928
16940
|
constructor(init) {
|
|
16929
16941
|
this._values = [];
|
|
@@ -17131,6 +17143,15 @@ class MockResponse {
|
|
|
17131
17143
|
}
|
|
17132
17144
|
}
|
|
17133
17145
|
|
|
17146
|
+
class MockDOMParser {
|
|
17147
|
+
parseFromString(htmlToParse, mimeType) {
|
|
17148
|
+
if (mimeType !== 'text/html') {
|
|
17149
|
+
console.error('XML parsing not implemented yet, continuing as html');
|
|
17150
|
+
}
|
|
17151
|
+
return parseHtmlToDocument(htmlToParse);
|
|
17152
|
+
}
|
|
17153
|
+
}
|
|
17154
|
+
|
|
17134
17155
|
function addGlobalsToWindowPrototype(mockWinPrototype) {
|
|
17135
17156
|
GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
|
|
17136
17157
|
Object.defineProperty(mockWinPrototype, cstrName, {
|
|
@@ -17153,6 +17174,7 @@ const GLOBAL_CONSTRUCTORS = [
|
|
|
17153
17174
|
['MouseEvent', MockMouseEvent],
|
|
17154
17175
|
['Request', MockRequest],
|
|
17155
17176
|
['Response', MockResponse],
|
|
17177
|
+
['DOMParser', MockDOMParser],
|
|
17156
17178
|
['HTMLAnchorElement', MockAnchorElement],
|
|
17157
17179
|
['HTMLBaseElement', MockBaseElement],
|
|
17158
17180
|
['HTMLButtonElement', MockButtonElement],
|
|
@@ -54300,31 +54322,55 @@ const getTextOfPropertyName = (propName) => {
|
|
|
54300
54322
|
}
|
|
54301
54323
|
return undefined;
|
|
54302
54324
|
};
|
|
54325
|
+
/**
|
|
54326
|
+
* Generate a series of type references for a given AST node
|
|
54327
|
+
* @param baseNode the AST node to pull type references from
|
|
54328
|
+
* @param sourceFile the source file in which the provided `baseNode` exists
|
|
54329
|
+
* @returns the generated series of type references
|
|
54330
|
+
*/
|
|
54303
54331
|
const getAttributeTypeInfo = (baseNode, sourceFile) => {
|
|
54304
54332
|
const allReferences = {};
|
|
54305
|
-
getAllTypeReferences(baseNode).forEach((
|
|
54306
|
-
allReferences[
|
|
54333
|
+
getAllTypeReferences(baseNode).forEach((typeName) => {
|
|
54334
|
+
allReferences[typeName] = getTypeReferenceLocation(typeName, sourceFile);
|
|
54307
54335
|
});
|
|
54308
54336
|
return allReferences;
|
|
54309
54337
|
};
|
|
54338
|
+
/**
|
|
54339
|
+
* Get the text-based name from a TypeScript `EntityName`, which is an identifier of some form
|
|
54340
|
+
* @param entity a TypeScript `EntityName` to retrieve the name of an entity from
|
|
54341
|
+
* @returns the entity's name
|
|
54342
|
+
*/
|
|
54310
54343
|
const getEntityName = (entity) => {
|
|
54311
54344
|
if (t.isIdentifier(entity)) {
|
|
54312
54345
|
return entity.escapedText.toString();
|
|
54313
54346
|
}
|
|
54314
54347
|
else {
|
|
54348
|
+
// We have qualified name - e.g. const x: Foo.Bar.Baz;
|
|
54349
|
+
// Recurse until we find the 'base' of the qualified name
|
|
54315
54350
|
return getEntityName(entity.left);
|
|
54316
54351
|
}
|
|
54317
54352
|
};
|
|
54353
|
+
/**
|
|
54354
|
+
* Recursively walks the provided AST to collect all TypeScript type references that are found
|
|
54355
|
+
* @param node the node to walk to retrieve type information
|
|
54356
|
+
* @returns the collected type references
|
|
54357
|
+
*/
|
|
54318
54358
|
const getAllTypeReferences = (node) => {
|
|
54319
54359
|
const referencedTypes = [];
|
|
54320
54360
|
const visit = (node) => {
|
|
54361
|
+
/**
|
|
54362
|
+
* A type reference node will refer to some type T.
|
|
54363
|
+
* e.g: In `const foo: Bar = {...}` the reference node will contain semantic information about `Bar`.
|
|
54364
|
+
* In TypeScript, types that are also keywords (e.g. `number` in `const foo: number`) are not `TypeReferenceNode`s.
|
|
54365
|
+
*/
|
|
54321
54366
|
if (t.isTypeReferenceNode(node)) {
|
|
54322
54367
|
referencedTypes.push(getEntityName(node.typeName));
|
|
54323
54368
|
if (node.typeArguments) {
|
|
54369
|
+
// a type may contain types itself (e.g. generics - Foo<Bar>)
|
|
54324
54370
|
node.typeArguments
|
|
54325
|
-
.filter((
|
|
54326
|
-
.forEach((
|
|
54327
|
-
const typeName =
|
|
54371
|
+
.filter((typeArg) => t.isTypeReferenceNode(typeArg))
|
|
54372
|
+
.forEach((typeRef) => {
|
|
54373
|
+
const typeName = typeRef.typeName;
|
|
54328
54374
|
if (typeName && typeName.escapedText) {
|
|
54329
54375
|
referencedTypes.push(typeName.escapedText.toString());
|
|
54330
54376
|
}
|
|
@@ -54345,6 +54391,22 @@ const validateReferences = (diagnostics, references, node) => {
|
|
|
54345
54391
|
}
|
|
54346
54392
|
});
|
|
54347
54393
|
};
|
|
54394
|
+
/**
|
|
54395
|
+
* Determine where a TypeScript type reference originates from. This is accomplished by interrogating the AST node in
|
|
54396
|
+
* which the type's name appears
|
|
54397
|
+
*
|
|
54398
|
+
* A type may originate:
|
|
54399
|
+
* - from the same file where it is used (a type is declared in some file, `foo.ts`, and later used in the same file)
|
|
54400
|
+
* - from another file (I.E. it is imported and should have an import statement somewhere in the file)
|
|
54401
|
+
* - from a global context
|
|
54402
|
+
* - etc.
|
|
54403
|
+
*
|
|
54404
|
+
* The type may be declared using the `type` or `interface` keywords.
|
|
54405
|
+
*
|
|
54406
|
+
* @param typeName the name of the type to find the origination of
|
|
54407
|
+
* @param tsNode the TypeScript AST node being searched for the provided `typeName`
|
|
54408
|
+
* @returns the context stating where the type originates from
|
|
54409
|
+
*/
|
|
54348
54410
|
const getTypeReferenceLocation = (typeName, tsNode) => {
|
|
54349
54411
|
const sourceFileObj = tsNode.getSourceFile();
|
|
54350
54412
|
// Loop through all top level imports to find any reference to the type for 'import' reference location
|
|
@@ -58871,7 +58933,7 @@ const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
|
|
|
58871
58933
|
* Writes Stencil core typings file to disk for a dist-* output target
|
|
58872
58934
|
* @param config the Stencil configuration associated with the project being compiled
|
|
58873
58935
|
* @param compilerCtx the current compiler context
|
|
58874
|
-
* @returns
|
|
58936
|
+
* @returns the results of writing one or more type declaration files to disk
|
|
58875
58937
|
*/
|
|
58876
58938
|
const copyStencilCoreDts = async (config, compilerCtx) => {
|
|
58877
58939
|
const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes).filter((o) => o.typesDir);
|
|
@@ -58905,8 +58967,13 @@ const sortImportNames = (a, b) => {
|
|
|
58905
58967
|
return 0;
|
|
58906
58968
|
};
|
|
58907
58969
|
|
|
58908
|
-
|
|
58909
|
-
|
|
58970
|
+
/**
|
|
58971
|
+
* Generates the individual event types for all @Event() decorated events in a component
|
|
58972
|
+
* @param cmpMeta component runtime metadata for a single component
|
|
58973
|
+
* @returns the generated type metadata
|
|
58974
|
+
*/
|
|
58975
|
+
const generateEventTypes = (cmpMeta) => {
|
|
58976
|
+
return cmpMeta.events.map((cmpEvent) => {
|
|
58910
58977
|
const name = `on${toTitleCase(cmpEvent.name)}`;
|
|
58911
58978
|
const type = cmpEvent.complexType.original
|
|
58912
58979
|
? `(event: CustomEvent<${cmpEvent.complexType.original}>) => void`
|
|
@@ -58922,8 +58989,13 @@ const generateEventTypes = (cmpEvents) => {
|
|
|
58922
58989
|
});
|
|
58923
58990
|
};
|
|
58924
58991
|
|
|
58925
|
-
|
|
58926
|
-
|
|
58992
|
+
/**
|
|
58993
|
+
* Generates the individual event types for all @Method() decorated events in a component
|
|
58994
|
+
* @param cmpMeta component runtime metadata for a single component
|
|
58995
|
+
* @returns the generated type metadata
|
|
58996
|
+
*/
|
|
58997
|
+
const generateMethodTypes = (cmpMeta) => {
|
|
58998
|
+
return cmpMeta.methods.map((cmpMethod) => ({
|
|
58927
58999
|
name: cmpMethod.name,
|
|
58928
59000
|
type: cmpMethod.complexType.signature,
|
|
58929
59001
|
optional: false,
|
|
@@ -58933,6 +59005,11 @@ const generateMethodTypes = (cmpMethods) => {
|
|
|
58933
59005
|
}));
|
|
58934
59006
|
};
|
|
58935
59007
|
|
|
59008
|
+
/**
|
|
59009
|
+
* Generates the individual event types for all @Prop() decorated events in a component
|
|
59010
|
+
* @param cmpMeta component runtime metadata for a single component
|
|
59011
|
+
* @returns the generated type metadata
|
|
59012
|
+
*/
|
|
58936
59013
|
const generatePropTypes = (cmpMeta) => {
|
|
58937
59014
|
return [
|
|
58938
59015
|
...cmpMeta.properties.map((cmpProp) => ({
|
|
@@ -58965,8 +59042,8 @@ const generateComponentTypes = (cmp, areTypesInternal) => {
|
|
|
58965
59042
|
const tagNameAsPascal = dashToPascalCase$1(tagName);
|
|
58966
59043
|
const htmlElementName = `HTML${tagNameAsPascal}Element`;
|
|
58967
59044
|
const propAttributes = generatePropTypes(cmp);
|
|
58968
|
-
const methodAttributes = generateMethodTypes(cmp
|
|
58969
|
-
const eventAttributes = generateEventTypes(cmp
|
|
59045
|
+
const methodAttributes = generateMethodTypes(cmp);
|
|
59046
|
+
const eventAttributes = generateEventTypes(cmp);
|
|
58970
59047
|
const componentAttributes = attributesToMultiLineString([...propAttributes, ...methodAttributes], false, areTypesInternal);
|
|
58971
59048
|
const isDep = cmp.isCollectionDependency;
|
|
58972
59049
|
const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal);
|
|
@@ -62066,7 +62143,7 @@ const validateManifestJsonIcon = async (compilerCtx, buildCtx, manifestFilePath,
|
|
|
62066
62143
|
return;
|
|
62067
62144
|
}
|
|
62068
62145
|
if (iconSrc.startsWith('/')) {
|
|
62069
|
-
iconSrc = iconSrc.
|
|
62146
|
+
iconSrc = iconSrc.slice(1);
|
|
62070
62147
|
}
|
|
62071
62148
|
const manifestDir = dirname(manifestFilePath);
|
|
62072
62149
|
const iconPath = join(manifestDir, iconSrc);
|
|
@@ -64063,7 +64140,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
64063
64140
|
const dependencies = [
|
|
64064
64141
|
{
|
|
64065
64142
|
name: "@stencil/core",
|
|
64066
|
-
version: "2.15.
|
|
64143
|
+
version: "2.15.1",
|
|
64067
64144
|
main: "compiler/stencil.js",
|
|
64068
64145
|
resources: [
|
|
64069
64146
|
"package.json",
|