@stencil/core 2.14.2 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/stencil +14 -15
- package/cli/index.cjs +2 -2
- package/cli/index.js +2 -2
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +134 -31
- 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/hydrate/runner.d.ts +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +18 -14
- 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 +2 -2
- 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 +2 -2
- package/testing/package.json +1 -1
package/bin/stencil
CHANGED
|
@@ -18,16 +18,14 @@ if (isNodeLT(minimumVersion)) {
|
|
|
18
18
|
currentVersion +
|
|
19
19
|
', however Stencil requires v' +
|
|
20
20
|
minimumVersion +
|
|
21
|
-
'.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n'
|
|
21
|
+
'.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n'
|
|
22
22
|
);
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (isNodeLT(futureDeprecationMinVersion)) {
|
|
27
27
|
console.warn(
|
|
28
|
-
'\nIn an upcoming major release of Stencil, Node v' +
|
|
29
|
-
recommendedVersion +
|
|
30
|
-
'.0 or higher will be required.\n'
|
|
28
|
+
'\nIn an upcoming major release of Stencil, Node v' + recommendedVersion + '.0 or higher will be required.\n'
|
|
31
29
|
);
|
|
32
30
|
} else if (isNodeLT(recommendedVersion)) {
|
|
33
31
|
console.warn(
|
|
@@ -35,7 +33,7 @@ if (isNodeLT(futureDeprecationMinVersion)) {
|
|
|
35
33
|
currentVersion +
|
|
36
34
|
", however Stencil's recommendation is v" +
|
|
37
35
|
recommendedVersion +
|
|
38
|
-
'.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n'
|
|
36
|
+
'.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n'
|
|
39
37
|
);
|
|
40
38
|
}
|
|
41
39
|
|
|
@@ -46,13 +44,14 @@ var nodeSys = nodeApi.createNodeSys({ process: process, logger: nodeLogger });
|
|
|
46
44
|
|
|
47
45
|
nodeApi.setupNodeProcess({ process: process, logger: nodeLogger });
|
|
48
46
|
|
|
49
|
-
cli
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
cli
|
|
48
|
+
.run({
|
|
49
|
+
args: process.argv.slice(2),
|
|
50
|
+
logger: nodeLogger,
|
|
51
|
+
sys: nodeSys,
|
|
52
|
+
checkVersion: nodeApi.checkVersion,
|
|
53
|
+
})
|
|
54
|
+
.catch(function (err) {
|
|
55
|
+
console.error('uncaught error', err);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
});
|
package/cli/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil CLI (CommonJS) v2.
|
|
2
|
+
Stencil CLI (CommonJS) v2.15.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -513,7 +513,7 @@ const getNpmConfigEnvArgs = (sys) => {
|
|
|
513
513
|
const dependencies = [
|
|
514
514
|
{
|
|
515
515
|
name: "@stencil/core",
|
|
516
|
-
version: "2.
|
|
516
|
+
version: "2.15.0",
|
|
517
517
|
main: "compiler/stencil.js",
|
|
518
518
|
resources: [
|
|
519
519
|
"package.json",
|
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil CLI v2.
|
|
2
|
+
Stencil CLI v2.15.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
const toLowerCase = (str) => str.toLowerCase();
|
|
5
5
|
const dashToPascalCase = (str) => toLowerCase(str)
|
|
@@ -489,7 +489,7 @@ const getNpmConfigEnvArgs = (sys) => {
|
|
|
489
489
|
const dependencies = [
|
|
490
490
|
{
|
|
491
491
|
name: "@stencil/core",
|
|
492
|
-
version: "2.
|
|
492
|
+
version: "2.15.0",
|
|
493
493
|
main: "compiler/stencil.js",
|
|
494
494
|
resources: [
|
|
495
495
|
"package.json",
|
package/cli/package.json
CHANGED
package/compiler/package.json
CHANGED
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v2.
|
|
2
|
+
Stencil Compiler v2.15.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -1599,6 +1599,12 @@ const createJsVarName = (fileName) => {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
return fileName;
|
|
1601
1601
|
};
|
|
1602
|
+
/**
|
|
1603
|
+
* Determines if a given file path points to a type declaration file (ending in .d.ts) or not. This function is
|
|
1604
|
+
* case-insensitive in its heuristics.
|
|
1605
|
+
* @param filePath the path to check
|
|
1606
|
+
* @returns `true` if the given `filePath` points to a type declaration file, `false` otherwise
|
|
1607
|
+
*/
|
|
1602
1608
|
const isDtsFile$1 = (filePath) => {
|
|
1603
1609
|
const parts = filePath.toLowerCase().split('.');
|
|
1604
1610
|
if (parts.length > 2) {
|
|
@@ -3967,7 +3973,7 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
|
|
|
3967
3973
|
};
|
|
3968
3974
|
};
|
|
3969
3975
|
|
|
3970
|
-
const buildId = '
|
|
3976
|
+
const buildId = '20220328165835';
|
|
3971
3977
|
const minfyJsId = 'terser5.6.1_7';
|
|
3972
3978
|
const optimizeCssId = 'autoprefixer10.2.5_postcss8.2.8_7';
|
|
3973
3979
|
const parse5Version = '6.0.1';
|
|
@@ -3975,8 +3981,8 @@ const rollupVersion = '2.42.3';
|
|
|
3975
3981
|
const sizzleVersion = '2.42.3';
|
|
3976
3982
|
const terserVersion = '5.6.1';
|
|
3977
3983
|
const typescriptVersion = '4.5.4';
|
|
3978
|
-
const vermoji = '
|
|
3979
|
-
const version$3 = '2.
|
|
3984
|
+
const vermoji = '⛷';
|
|
3985
|
+
const version$3 = '2.15.0';
|
|
3980
3986
|
const versions = {
|
|
3981
3987
|
stencil: version$3,
|
|
3982
3988
|
parse5: parse5Version,
|
|
@@ -58837,8 +58843,18 @@ const serializeCollectionDependencies = (compilerCtx) => {
|
|
|
58837
58843
|
return sortBy(collectionDeps, (item) => item.name);
|
|
58838
58844
|
};
|
|
58839
58845
|
|
|
58846
|
+
/**
|
|
58847
|
+
* Update a type declaration file's import declarations using the module `@stencil/core`
|
|
58848
|
+
* @param typesDir the directory where type declaration files are expected to exist
|
|
58849
|
+
* @param dtsFilePath the path of the type declaration file being updated, used to derive the correct import declaration
|
|
58850
|
+
* module
|
|
58851
|
+
* @param dtsContent the content of a type declaration file to update
|
|
58852
|
+
* @returns the updated type declaration file contents
|
|
58853
|
+
*/
|
|
58840
58854
|
const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
|
|
58841
58855
|
const dir = dirname(dtsFilePath);
|
|
58856
|
+
// determine the relative path between the directory of the .d.ts file and the types directory. this value may result
|
|
58857
|
+
// in '.' if they are the same
|
|
58842
58858
|
const relPath = relative$1(dir, typesDir);
|
|
58843
58859
|
let coreDtsPath = join(relPath, CORE_FILENAME);
|
|
58844
58860
|
if (!coreDtsPath.startsWith('.')) {
|
|
@@ -58851,6 +58867,12 @@ const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
|
|
|
58851
58867
|
}
|
|
58852
58868
|
return dtsContent;
|
|
58853
58869
|
};
|
|
58870
|
+
/**
|
|
58871
|
+
* Writes Stencil core typings file to disk for a dist-* output target
|
|
58872
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
58873
|
+
* @param compilerCtx the current compiler context
|
|
58874
|
+
* @returns
|
|
58875
|
+
*/
|
|
58854
58876
|
const copyStencilCoreDts = async (config, compilerCtx) => {
|
|
58855
58877
|
const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes).filter((o) => o.typesDir);
|
|
58856
58878
|
const srcStencilDtsPath = join(config.sys.getCompilerExecutingPath(), '..', '..', 'internal', CORE_DTS);
|
|
@@ -58933,21 +58955,21 @@ const generatePropTypes = (cmpMeta) => {
|
|
|
58933
58955
|
};
|
|
58934
58956
|
|
|
58935
58957
|
/**
|
|
58936
|
-
* Generate a string based on the types that are defined within a component
|
|
58937
|
-
*
|
|
58958
|
+
* Generate a string based on the types that are defined within a component
|
|
58938
58959
|
* @param cmp the metadata for the component that a type definition string is generated for
|
|
58939
|
-
* @param
|
|
58960
|
+
* @param areTypesInternal `true` if types being generated are for a project's internal purposes, `false` otherwise
|
|
58961
|
+
* @returns the generated types string alongside additional metadata
|
|
58940
58962
|
*/
|
|
58941
|
-
const generateComponentTypes = (cmp,
|
|
58963
|
+
const generateComponentTypes = (cmp, areTypesInternal) => {
|
|
58942
58964
|
const tagName = cmp.tagName.toLowerCase();
|
|
58943
58965
|
const tagNameAsPascal = dashToPascalCase$1(tagName);
|
|
58944
58966
|
const htmlElementName = `HTML${tagNameAsPascal}Element`;
|
|
58945
58967
|
const propAttributes = generatePropTypes(cmp);
|
|
58946
58968
|
const methodAttributes = generateMethodTypes(cmp.methods);
|
|
58947
58969
|
const eventAttributes = generateEventTypes(cmp.events);
|
|
58948
|
-
const componentAttributes = attributesToMultiLineString([...propAttributes, ...methodAttributes], false,
|
|
58970
|
+
const componentAttributes = attributesToMultiLineString([...propAttributes, ...methodAttributes], false, areTypesInternal);
|
|
58949
58971
|
const isDep = cmp.isCollectionDependency;
|
|
58950
|
-
const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true,
|
|
58972
|
+
const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal);
|
|
58951
58973
|
const element = [
|
|
58952
58974
|
` interface ${htmlElementName} extends Components.${tagNameAsPascal}, HTMLStencilElement {`,
|
|
58953
58975
|
` }`,
|
|
@@ -58989,13 +59011,12 @@ const attributesToMultiLineString = (attributes, jsxAttributes, internal) => {
|
|
|
58989
59011
|
};
|
|
58990
59012
|
|
|
58991
59013
|
/**
|
|
58992
|
-
* Find all referenced types by a component and add them to the importDataObj
|
|
58993
|
-
* updated importDataObj
|
|
58994
|
-
*
|
|
59014
|
+
* Find all referenced types by a component and add them to the `importDataObj` parameter
|
|
58995
59015
|
* @param importDataObj key/value of type import file, each value is an array of imported types
|
|
58996
|
-
* @param
|
|
59016
|
+
* @param allTypes an output parameter containing a map of seen types and the number of times the type has been seen
|
|
59017
|
+
* @param cmp the metadata associated with the component whose types are being inspected
|
|
58997
59018
|
* @param filePath the path of the component file
|
|
58998
|
-
* @
|
|
59019
|
+
* @returns the updated import data
|
|
58999
59020
|
*/
|
|
59000
59021
|
const updateReferenceTypeImports = (importDataObj, allTypes, cmp, filePath) => {
|
|
59001
59022
|
const updateImportReferences = updateImportReferenceFactory(allTypes, filePath);
|
|
@@ -59052,16 +59073,25 @@ const updateImportReferenceFactory = (allTypes, filePath) => {
|
|
|
59052
59073
|
};
|
|
59053
59074
|
};
|
|
59054
59075
|
|
|
59076
|
+
/**
|
|
59077
|
+
* Generates and writes a `components.d.ts` file to disk. This file may be written to the `src` directory of a project,
|
|
59078
|
+
* or be written to a directory that is meant to be distributed (e.g. the output directory of `dist-custom-elements`).
|
|
59079
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59080
|
+
* @param compilerCtx the current compiler context
|
|
59081
|
+
* @param buildCtx the context associated with the current build
|
|
59082
|
+
* @param destination the relative directory in the filesystem to write the type declaration file to
|
|
59083
|
+
* @returns `true` if the type declaration file written to disk has changed, `false` otherwise
|
|
59084
|
+
*/
|
|
59055
59085
|
const generateAppTypes = async (config, compilerCtx, buildCtx, destination) => {
|
|
59056
59086
|
// only gather components that are still root ts files we've found and have component metadata
|
|
59057
59087
|
// the compilerCtx cache may still have files that may have been deleted/renamed
|
|
59058
59088
|
const timespan = buildCtx.createTimeSpan(`generated app types started`, true);
|
|
59059
|
-
const
|
|
59089
|
+
const areTypesInternal = destination === 'src';
|
|
59060
59090
|
// Generate d.ts files for component types
|
|
59061
|
-
let componentTypesFileContent = generateComponentTypesFile(config, buildCtx,
|
|
59091
|
+
let componentTypesFileContent = generateComponentTypesFile(config, buildCtx, areTypesInternal);
|
|
59062
59092
|
// immediately write the components.d.ts file to disk and put it into fs memory
|
|
59063
59093
|
let componentsDtsFilePath = getComponentsDtsSrcFilePath(config);
|
|
59064
|
-
if (!
|
|
59094
|
+
if (!areTypesInternal) {
|
|
59065
59095
|
componentsDtsFilePath = resolve$1(destination, GENERATED_DTS$1);
|
|
59066
59096
|
componentTypesFileContent = updateStencilTypesImports(destination, componentsDtsFilePath, componentTypesFileContent);
|
|
59067
59097
|
}
|
|
@@ -59077,18 +59107,20 @@ const generateAppTypes = async (config, compilerCtx, buildCtx, destination) => {
|
|
|
59077
59107
|
return hasComponentsDtsChanged;
|
|
59078
59108
|
};
|
|
59079
59109
|
/**
|
|
59080
|
-
*
|
|
59081
|
-
* @param config the project
|
|
59082
|
-
* @param
|
|
59110
|
+
* Generates a `component.d.ts` file's contents, which contains the typings for all components in a Stencil project
|
|
59111
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59112
|
+
* @param buildCtx the context associated with the current build
|
|
59113
|
+
* @param areTypesInternal determines if non-exported type definitions are being generated or not
|
|
59114
|
+
* @returns the contents of the `components.d.ts` file
|
|
59083
59115
|
*/
|
|
59084
|
-
const generateComponentTypesFile = (config, buildCtx,
|
|
59116
|
+
const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
59085
59117
|
let typeImportData = {};
|
|
59086
59118
|
const c = [];
|
|
59087
59119
|
const allTypes = new Map();
|
|
59088
59120
|
const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
|
|
59089
59121
|
const modules = components.map((cmp) => {
|
|
59090
59122
|
typeImportData = updateReferenceTypeImports(typeImportData, allTypes, cmp, cmp.sourceFilePath);
|
|
59091
|
-
return generateComponentTypes(cmp,
|
|
59123
|
+
return generateComponentTypes(cmp, areTypesInternal);
|
|
59092
59124
|
});
|
|
59093
59125
|
c.push(COMPONENTS_DTS_HEADER);
|
|
59094
59126
|
c.push(`import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";`);
|
|
@@ -59219,10 +59251,28 @@ const relDts$1 = (fromPath, dtsPath) => {
|
|
|
59219
59251
|
return normalizePath$1(dtsPath.replace('.d.ts', ''));
|
|
59220
59252
|
};
|
|
59221
59253
|
|
|
59254
|
+
/**
|
|
59255
|
+
* Entrypoint for generating types for one or more `dist-custom-elements` output targets defined in a Stencil project's
|
|
59256
|
+
* configuration
|
|
59257
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59258
|
+
* @param compilerCtx the current compiler context
|
|
59259
|
+
* @param buildCtx the context associated with the current build
|
|
59260
|
+
* @param distDtsFilePath the path to a type declaration file (.d.ts) that is being generated for the output target.
|
|
59261
|
+
* This path is not necessarily the `components.d.ts` file that is found in the root of a project's `src` directory.
|
|
59262
|
+
*/
|
|
59222
59263
|
const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, distDtsFilePath) => {
|
|
59223
59264
|
const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements);
|
|
59224
59265
|
await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, distDtsFilePath, outputTarget)));
|
|
59225
59266
|
};
|
|
59267
|
+
/**
|
|
59268
|
+
* Generates types for a single `dist-custom-elements` output target definition in a Stencil project's configuration
|
|
59269
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59270
|
+
* @param compilerCtx the current compiler context
|
|
59271
|
+
* @param buildCtx the context associated with the current build
|
|
59272
|
+
* @param distDtsFilePath the path to a type declaration file (.d.ts) that is being generated for the output target.
|
|
59273
|
+
* This path is not necessarily the `components.d.ts` file that is found in the root of a project's `src` directory.
|
|
59274
|
+
* @param outputTarget the output target for which types are being currently generated
|
|
59275
|
+
*/
|
|
59226
59276
|
const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx, distDtsFilePath, outputTarget) => {
|
|
59227
59277
|
const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
|
|
59228
59278
|
const componentsDtsRelPath = relDts(outputTarget.dir, distDtsFilePath);
|
|
@@ -59238,7 +59288,7 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
|
|
|
59238
59288
|
` * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to`,
|
|
59239
59289
|
` * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".`,
|
|
59240
59290
|
` * But do note that this configuration depends on how your script is bundled, or lack of`,
|
|
59241
|
-
` *
|
|
59291
|
+
` * bundling, and where your assets can be loaded from. Additionally custom bundling`,
|
|
59242
59292
|
` * will have to ensure the static assets are copied to its build directory.`,
|
|
59243
59293
|
` */`,
|
|
59244
59294
|
`export declare const setAssetPath: (path: string) => void;`,
|
|
@@ -59273,6 +59323,13 @@ const generateCustomElementsTypesOutput = async (config, compilerCtx, buildCtx,
|
|
|
59273
59323
|
await compilerCtx.fs.writeFile(filePath, dtsCode, { outputTargetType: outputTarget.type });
|
|
59274
59324
|
}));
|
|
59275
59325
|
};
|
|
59326
|
+
/**
|
|
59327
|
+
* Generate a type declaration file for a specific Stencil component
|
|
59328
|
+
* @param componentsDtsRelPath the path to a root type declaration file from which commonly used entities can be
|
|
59329
|
+
* referenced from in the newly generated file
|
|
59330
|
+
* @param cmp the component to generate the type declaration file for
|
|
59331
|
+
* @returns the contents of the type declaration file for the provided `cmp`
|
|
59332
|
+
*/
|
|
59276
59333
|
const generateCustomElementType = (componentsDtsRelPath, cmp) => {
|
|
59277
59334
|
const tagNameAsPascal = dashToPascalCase$1(cmp.tagName);
|
|
59278
59335
|
const o = [
|
|
@@ -59291,6 +59348,13 @@ const generateCustomElementType = (componentsDtsRelPath, cmp) => {
|
|
|
59291
59348
|
];
|
|
59292
59349
|
return o.join('\n');
|
|
59293
59350
|
};
|
|
59351
|
+
/**
|
|
59352
|
+
* Determines the relative path between two provided paths. If a type declaration file extension is present on
|
|
59353
|
+
* `dtsPath`, it will be removed from the computed relative path.
|
|
59354
|
+
* @param fromPath the path from which to start at
|
|
59355
|
+
* @param dtsPath the destination path
|
|
59356
|
+
* @returns the relative path from the provided `fromPath` to the `dtsPath`
|
|
59357
|
+
*/
|
|
59294
59358
|
const relDts = (fromPath, dtsPath) => {
|
|
59295
59359
|
dtsPath = relative$1(fromPath, dtsPath);
|
|
59296
59360
|
if (!dtsPath.startsWith('.')) {
|
|
@@ -59299,13 +59363,28 @@ const relDts = (fromPath, dtsPath) => {
|
|
|
59299
59363
|
return normalizePath$1(dtsPath.replace('.d.ts', ''));
|
|
59300
59364
|
};
|
|
59301
59365
|
|
|
59366
|
+
/**
|
|
59367
|
+
* For a single output target, generate types, then copy the Stencil core type declaration file
|
|
59368
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59369
|
+
* @param compilerCtx the current compiler context
|
|
59370
|
+
* @param buildCtx the context associated with the current build
|
|
59371
|
+
* @param outputTarget the output target to generate types for
|
|
59372
|
+
*/
|
|
59302
59373
|
const generateTypes = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
59303
59374
|
if (!buildCtx.hasError) {
|
|
59304
59375
|
await generateTypesOutput(config, compilerCtx, buildCtx, outputTarget);
|
|
59305
59376
|
await copyStencilCoreDts(config, compilerCtx);
|
|
59306
59377
|
}
|
|
59307
59378
|
};
|
|
59379
|
+
/**
|
|
59380
|
+
* Generate type definition files and write them to a dist directory
|
|
59381
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59382
|
+
* @param compilerCtx the current compiler context
|
|
59383
|
+
* @param buildCtx the context associated with the current build
|
|
59384
|
+
* @param outputTarget the output target to generate types for
|
|
59385
|
+
*/
|
|
59308
59386
|
const generateTypesOutput = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
59387
|
+
// get all type declaration files in a project's src/ directory
|
|
59309
59388
|
const srcDirItems = await compilerCtx.fs.readdir(config.srcDir, { recursive: false });
|
|
59310
59389
|
const srcDtsFiles = srcDirItems.filter((srcItem) => srcItem.isFile && isDtsFile$1(srcItem.absPath));
|
|
59311
59390
|
// Copy .d.ts files from src to dist
|
|
@@ -59327,6 +59406,12 @@ const generateTypesOutput = async (config, compilerCtx, buildCtx, outputTarget)
|
|
|
59327
59406
|
}
|
|
59328
59407
|
};
|
|
59329
59408
|
|
|
59409
|
+
/**
|
|
59410
|
+
* Entrypoint for generating types for all output targets
|
|
59411
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
59412
|
+
* @param compilerCtx the current compiler context
|
|
59413
|
+
* @param buildCtx the context associated with the current build
|
|
59414
|
+
*/
|
|
59330
59415
|
const outputTypes = async (config, compilerCtx, buildCtx) => {
|
|
59331
59416
|
const outputTargets = config.outputTargets.filter(isOutputTargetDistTypes);
|
|
59332
59417
|
if (outputTargets.length === 0) {
|
|
@@ -63978,7 +64063,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
63978
64063
|
const dependencies = [
|
|
63979
64064
|
{
|
|
63980
64065
|
name: "@stencil/core",
|
|
63981
|
-
version: "2.
|
|
64066
|
+
version: "2.15.0",
|
|
63982
64067
|
main: "compiler/stencil.js",
|
|
63983
64068
|
resources: [
|
|
63984
64069
|
"package.json",
|
|
@@ -64369,11 +64454,20 @@ const validateCopy = (copy, defaultCopy = []) => {
|
|
|
64369
64454
|
return unique(copy, (task) => `${task.src}:${task.dest}:${task.keepDirStructure}`);
|
|
64370
64455
|
};
|
|
64371
64456
|
|
|
64457
|
+
/**
|
|
64458
|
+
* Validate one or more `dist-custom-elements` output targets. Validation of an output target may involve back-filling
|
|
64459
|
+
* fields that are omitted with sensible defaults and/or creating additional supporting output targets that were not
|
|
64460
|
+
* explicitly defined by the user
|
|
64461
|
+
* @param config the Stencil configuration associated with the project being compiled
|
|
64462
|
+
* @param userOutputs the output target(s) specified by the user
|
|
64463
|
+
* @returns the validated output target(s)
|
|
64464
|
+
*/
|
|
64372
64465
|
const validateCustomElement = (config, userOutputs) => {
|
|
64373
|
-
|
|
64466
|
+
const defaultDir = 'dist';
|
|
64467
|
+
return userOutputs.filter(isOutputTargetDistCustomElements).reduce((outputs, o) => {
|
|
64374
64468
|
const outputTarget = {
|
|
64375
64469
|
...o,
|
|
64376
|
-
dir: getAbsolutePath(config, o.dir || '
|
|
64470
|
+
dir: getAbsolutePath(config, o.dir || join(defaultDir, 'components')),
|
|
64377
64471
|
};
|
|
64378
64472
|
if (!isBoolean$1(outputTarget.empty)) {
|
|
64379
64473
|
outputTarget.empty = true;
|
|
@@ -64381,16 +64475,25 @@ const validateCustomElement = (config, userOutputs) => {
|
|
|
64381
64475
|
if (!isBoolean$1(outputTarget.externalRuntime)) {
|
|
64382
64476
|
outputTarget.externalRuntime = true;
|
|
64383
64477
|
}
|
|
64478
|
+
// unlike other output targets, Stencil does not allow users to define the output location of types at this time
|
|
64479
|
+
if (outputTarget.generateTypeDeclarations) {
|
|
64480
|
+
const typesDirectory = getAbsolutePath(config, join(defaultDir, 'types'));
|
|
64481
|
+
outputs.push({
|
|
64482
|
+
type: DIST_TYPES,
|
|
64483
|
+
dir: outputTarget.dir,
|
|
64484
|
+
typesDir: typesDirectory,
|
|
64485
|
+
});
|
|
64486
|
+
}
|
|
64384
64487
|
outputTarget.copy = validateCopy(outputTarget.copy, []);
|
|
64385
64488
|
if (outputTarget.copy.length > 0) {
|
|
64386
|
-
|
|
64489
|
+
outputs.push({
|
|
64387
64490
|
type: COPY,
|
|
64388
64491
|
dir: config.rootDir,
|
|
64389
64492
|
copy: [...outputTarget.copy],
|
|
64390
64493
|
});
|
|
64391
64494
|
}
|
|
64392
|
-
|
|
64393
|
-
return
|
|
64495
|
+
outputs.push(outputTarget);
|
|
64496
|
+
return outputs;
|
|
64394
64497
|
}, []);
|
|
64395
64498
|
};
|
|
64396
64499
|
|
|
@@ -65175,7 +65278,7 @@ const validateTesting = (config, diagnostics) => {
|
|
|
65175
65278
|
* - this regex case shall match file names such as `my-cmp.spec.ts`, `test.spec.ts`
|
|
65176
65279
|
* - this regex case shall not match file names such as `attest.ts`, `bespec.ts`
|
|
65177
65280
|
*/
|
|
65178
|
-
testing.testRegex = '(/__tests__/.*|(\\.|/)(test|spec|e2e))\\.[jt]sx
|
|
65281
|
+
testing.testRegex = '(/__tests__/.*|(\\.|/)(test|spec|e2e))\\.[jt]sx?$';
|
|
65179
65282
|
}
|
|
65180
65283
|
if (Array.isArray(testing.testMatch)) {
|
|
65181
65284
|
delete testing.testRegex;
|