@rindo/core 2.22.3 → 3.0.0-alpha.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/rindo +3 -3
- package/cli/index.cjs +3 -5
- package/cli/index.d.ts +3 -3
- package/cli/index.js +3 -5
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +190 -308
- package/compiler/rindo.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +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/rindo-public-compiler.d.ts +32 -43
- package/internal/rindo-public-runtime.d.ts +12 -12
- 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 +4 -4
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +12 -15
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +4 -4
- package/testing/package.json +1 -1
- package/testing/puppeteer/puppeteer-declarations.d.ts +1 -27
package/compiler/rindo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Compiler
|
|
2
|
+
Rindo Compiler v3.0.0-alpha.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -34,7 +34,7 @@ if (!process.platform) {
|
|
|
34
34
|
process.platform = 'rindo';
|
|
35
35
|
}
|
|
36
36
|
if (!process.version) {
|
|
37
|
-
process.version = '
|
|
37
|
+
process.version = 'v14.0.0';
|
|
38
38
|
}
|
|
39
39
|
process.browser = !!globalThis.location;
|
|
40
40
|
|
|
@@ -2097,7 +2097,7 @@ const process$3 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), p
|
|
|
2097
2097
|
'default': process_1
|
|
2098
2098
|
});
|
|
2099
2099
|
|
|
2100
|
-
const buildId = '
|
|
2100
|
+
const buildId = '20230405110903';
|
|
2101
2101
|
const minfyJsId = 'terser5.16.1_7';
|
|
2102
2102
|
const optimizeCssId = 'autoprefixer10.4.13_postcss8.4.21_7';
|
|
2103
2103
|
const parse5Version = '7.1.2';
|
|
@@ -2105,8 +2105,8 @@ const rollupVersion = '2.42.3';
|
|
|
2105
2105
|
const sizzleVersion = '2.42.3';
|
|
2106
2106
|
const terserVersion = '5.16.1';
|
|
2107
2107
|
const typescriptVersion = '4.9.4';
|
|
2108
|
-
const vermoji = '
|
|
2109
|
-
const version$3 = '
|
|
2108
|
+
const vermoji = '🍌';
|
|
2109
|
+
const version$3 = '3.0.0-alpha.0';
|
|
2110
2110
|
const versions = {
|
|
2111
2111
|
rindo: version$3,
|
|
2112
2112
|
parse5: parse5Version,
|
|
@@ -4207,8 +4207,8 @@ const createSystem = (c) => {
|
|
|
4207
4207
|
const logger = (_a = c === null || c === void 0 ? void 0 : c.logger) !== null && _a !== void 0 ? _a : createLogger();
|
|
4208
4208
|
const items = new Map();
|
|
4209
4209
|
const destroys = new Set();
|
|
4210
|
-
const
|
|
4211
|
-
const
|
|
4210
|
+
const addDestroy = (cb) => destroys.add(cb);
|
|
4211
|
+
const removeDestroy = (cb) => destroys.delete(cb);
|
|
4212
4212
|
const events = buildEvents();
|
|
4213
4213
|
const hardwareConcurrency = (IS_BROWSER_ENV && navigator.hardwareConcurrency) || 1;
|
|
4214
4214
|
const destroy = async () => {
|
|
@@ -4435,10 +4435,10 @@ const createSystem = (c) => {
|
|
|
4435
4435
|
removedFiles: [],
|
|
4436
4436
|
error: null,
|
|
4437
4437
|
};
|
|
4438
|
-
|
|
4438
|
+
removeDirSyncRecursive(p, opts, results);
|
|
4439
4439
|
return results;
|
|
4440
4440
|
};
|
|
4441
|
-
const
|
|
4441
|
+
const removeDirSyncRecursive = (p, opts, results) => {
|
|
4442
4442
|
if (!results.error) {
|
|
4443
4443
|
p = normalize(p);
|
|
4444
4444
|
const dirItemPaths = readDirSync(p);
|
|
@@ -4447,7 +4447,7 @@ const createSystem = (c) => {
|
|
|
4447
4447
|
const item = items.get(dirItemPath);
|
|
4448
4448
|
if (item) {
|
|
4449
4449
|
if (item.isDirectory) {
|
|
4450
|
-
|
|
4450
|
+
removeDirSyncRecursive(dirItemPath, opts, results);
|
|
4451
4451
|
}
|
|
4452
4452
|
else if (item.isFile) {
|
|
4453
4453
|
const removeFileResults = removeFileSync(dirItemPath);
|
|
@@ -4527,7 +4527,7 @@ const createSystem = (c) => {
|
|
|
4527
4527
|
}
|
|
4528
4528
|
}
|
|
4529
4529
|
};
|
|
4530
|
-
|
|
4530
|
+
addDestroy(close);
|
|
4531
4531
|
if (item) {
|
|
4532
4532
|
item.isDirectory = true;
|
|
4533
4533
|
item.isFile = false;
|
|
@@ -4546,7 +4546,7 @@ const createSystem = (c) => {
|
|
|
4546
4546
|
}
|
|
4547
4547
|
return {
|
|
4548
4548
|
close() {
|
|
4549
|
-
|
|
4549
|
+
removeDestroy(close);
|
|
4550
4550
|
close();
|
|
4551
4551
|
},
|
|
4552
4552
|
};
|
|
@@ -4563,7 +4563,7 @@ const createSystem = (c) => {
|
|
|
4563
4563
|
}
|
|
4564
4564
|
}
|
|
4565
4565
|
};
|
|
4566
|
-
|
|
4566
|
+
addDestroy(close);
|
|
4567
4567
|
if (item) {
|
|
4568
4568
|
item.isDirectory = false;
|
|
4569
4569
|
item.isFile = true;
|
|
@@ -4582,7 +4582,7 @@ const createSystem = (c) => {
|
|
|
4582
4582
|
}
|
|
4583
4583
|
return {
|
|
4584
4584
|
close() {
|
|
4585
|
-
|
|
4585
|
+
removeDestroy(close);
|
|
4586
4586
|
close();
|
|
4587
4587
|
},
|
|
4588
4588
|
};
|
|
@@ -4683,7 +4683,7 @@ const createSystem = (c) => {
|
|
|
4683
4683
|
events,
|
|
4684
4684
|
access,
|
|
4685
4685
|
accessSync,
|
|
4686
|
-
|
|
4686
|
+
addDestroy,
|
|
4687
4687
|
copyFile,
|
|
4688
4688
|
createDir,
|
|
4689
4689
|
createDirSync,
|
|
@@ -4708,7 +4708,7 @@ const createSystem = (c) => {
|
|
|
4708
4708
|
readFileSync,
|
|
4709
4709
|
realpath,
|
|
4710
4710
|
realpathSync,
|
|
4711
|
-
|
|
4711
|
+
removeDestroy,
|
|
4712
4712
|
rename,
|
|
4713
4713
|
fetch,
|
|
4714
4714
|
resolvePath,
|
|
@@ -13348,15 +13348,15 @@ const relativeImport = (pathFrom, pathTo, ext, addPrefix = true) => {
|
|
|
13348
13348
|
}
|
|
13349
13349
|
return normalizePath$2(`${relativePath}/${basename(pathTo, ext)}`);
|
|
13350
13350
|
};
|
|
13351
|
-
const getComponentsDtsSrcFilePath = (config) => join(config.srcDir, GENERATED_DTS
|
|
13352
|
-
const getComponentsDtsTypesFilePath = (outputTarget) => join(outputTarget.typesDir, GENERATED_DTS
|
|
13351
|
+
const getComponentsDtsSrcFilePath = (config) => join(config.srcDir, GENERATED_DTS);
|
|
13352
|
+
const getComponentsDtsTypesFilePath = (outputTarget) => join(outputTarget.typesDir, GENERATED_DTS);
|
|
13353
13353
|
const isOutputTargetDist = (o) => o.type === DIST;
|
|
13354
13354
|
const isOutputTargetDistCollection = (o) => o.type === DIST_COLLECTION;
|
|
13355
13355
|
const isOutputTargetDistCustomElements = (o) => o.type === DIST_CUSTOM_ELEMENTS;
|
|
13356
|
+
// TODO: fully delete dist-custom-elements-bundle code
|
|
13356
13357
|
const isOutputTargetDistCustomElementsBundle = (o) => o.type === DIST_CUSTOM_ELEMENTS_BUNDLE;
|
|
13357
13358
|
const isOutputTargetCopy = (o) => o.type === COPY;
|
|
13358
13359
|
const isOutputTargetDistLazy = (o) => o.type === DIST_LAZY;
|
|
13359
|
-
const isOutputTargetAngular = (o) => o.type === ANGULAR;
|
|
13360
13360
|
const isOutputTargetDistLazyLoader = (o) => o.type === DIST_LAZY_LOADER;
|
|
13361
13361
|
const isOutputTargetDistGlobalStyles = (o) => o.type === DIST_GLOBAL_STYLES;
|
|
13362
13362
|
const isOutputTargetHydrate = (o) => o.type === DIST_HYDRATE_SCRIPT;
|
|
@@ -13370,12 +13370,12 @@ const isOutputTargetWww = (o) => o.type === WWW;
|
|
|
13370
13370
|
const isOutputTargetStats = (o) => o.type === STATS;
|
|
13371
13371
|
const isOutputTargetDistTypes = (o) => o.type === DIST_TYPES;
|
|
13372
13372
|
const getComponentsFromModules = (moduleFiles) => sortBy(flatOne(moduleFiles.map((m) => m.cmps)), (c) => c.tagName);
|
|
13373
|
-
const ANGULAR = 'angular';
|
|
13374
13373
|
const COPY = 'copy';
|
|
13375
13374
|
const CUSTOM = 'custom';
|
|
13376
13375
|
const DIST = 'dist';
|
|
13377
13376
|
const DIST_COLLECTION = 'dist-collection';
|
|
13378
13377
|
const DIST_CUSTOM_ELEMENTS = 'dist-custom-elements';
|
|
13378
|
+
// TODO: fully delete dist-custom-elements-bundle code
|
|
13379
13379
|
const DIST_CUSTOM_ELEMENTS_BUNDLE = 'dist-custom-elements-bundle';
|
|
13380
13380
|
const DIST_TYPES = 'dist-types';
|
|
13381
13381
|
const DIST_HYDRATE_SCRIPT = 'dist-hydrate-script';
|
|
@@ -13402,7 +13402,6 @@ const VALID_CONFIG_OUTPUT_TARGETS = [
|
|
|
13402
13402
|
DIST,
|
|
13403
13403
|
DIST_COLLECTION,
|
|
13404
13404
|
DIST_CUSTOM_ELEMENTS,
|
|
13405
|
-
DIST_CUSTOM_ELEMENTS_BUNDLE,
|
|
13406
13405
|
DIST_LAZY,
|
|
13407
13406
|
DIST_HYDRATE_SCRIPT,
|
|
13408
13407
|
// DOCS
|
|
@@ -13411,7 +13410,6 @@ const VALID_CONFIG_OUTPUT_TARGETS = [
|
|
|
13411
13410
|
DOCS_VSCODE,
|
|
13412
13411
|
DOCS_CUSTOM,
|
|
13413
13412
|
// MISC
|
|
13414
|
-
ANGULAR,
|
|
13415
13413
|
COPY,
|
|
13416
13414
|
CUSTOM,
|
|
13417
13415
|
STATS,
|
|
@@ -13430,7 +13428,7 @@ function isValidConfigOutputTarget(targetType) {
|
|
|
13430
13428
|
// see microsoft/TypeScript#31018 for some discussion of this
|
|
13431
13429
|
return VALID_CONFIG_OUTPUT_TARGETS.includes(targetType);
|
|
13432
13430
|
}
|
|
13433
|
-
const GENERATED_DTS
|
|
13431
|
+
const GENERATED_DTS = 'components.d.ts';
|
|
13434
13432
|
|
|
13435
13433
|
const getTsOptionsToExtend = (config) => {
|
|
13436
13434
|
const tsOptions = {
|
|
@@ -13506,7 +13504,7 @@ const createTsBuildProgram = async (config, buildCallback) => {
|
|
|
13506
13504
|
clearInterval(timeoutId);
|
|
13507
13505
|
},
|
|
13508
13506
|
};
|
|
13509
|
-
config.sys.
|
|
13507
|
+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(currentBuildTimeoutId));
|
|
13510
13508
|
/**
|
|
13511
13509
|
* Create a {@link ts.WatchCompilerHost}. A CompilerHost allows a {@link ts.Program} to interact with the
|
|
13512
13510
|
* {@link ts.System}, by acting as an intermediary:
|
|
@@ -20006,6 +20004,15 @@ const getTypeReferenceLocation = (typeName, tsNode) => {
|
|
|
20006
20004
|
if (isExported) {
|
|
20007
20005
|
return {
|
|
20008
20006
|
location: 'local',
|
|
20007
|
+
// If this is a local import, we know the path to the type
|
|
20008
|
+
// is the same as the current source file path
|
|
20009
|
+
//
|
|
20010
|
+
// We need to explicitly include the path here because
|
|
20011
|
+
// future logic for generating app types will use this resolved reference
|
|
20012
|
+
// to ensure that type name collisions do no occur in the output type
|
|
20013
|
+
// declaration file. If this path is omitted, the correct aliased type names
|
|
20014
|
+
// will not be used for component event definitions
|
|
20015
|
+
path: sourceFileObj.fileName,
|
|
20009
20016
|
};
|
|
20010
20017
|
}
|
|
20011
20018
|
// This is most likely a global type, if it is a local that is not exported then typescript will inform the dev
|
|
@@ -56062,7 +56069,7 @@ const addDefineCustomElementFunctions = (compilerCtx, components, outputTarget)
|
|
|
56062
56069
|
caseStatements.push(createCustomElementsDefineCase(principalComponent.tagName, customElementsDefineCallExpression));
|
|
56063
56070
|
setupComponentDependencies(moduleFile, components, newStatements, caseStatements, tagNames);
|
|
56064
56071
|
addDefineCustomElementFunction(tagNames, newStatements, caseStatements);
|
|
56065
|
-
if (outputTarget.
|
|
56072
|
+
if (outputTarget.customElementsExportBehavior === 'auto-define-custom-elements') {
|
|
56066
56073
|
const conditionalDefineCustomElementCall = createAutoDefinitionExpression(principalComponent.componentClassName);
|
|
56067
56074
|
newStatements.push(conditionalDefineCustomElementCall);
|
|
56068
56075
|
}
|
|
@@ -57162,9 +57169,7 @@ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
|
|
|
57162
57169
|
// @see {@link https://rollupjs.org/guide/en/#conventions} for more info.
|
|
57163
57170
|
index: '\0core',
|
|
57164
57171
|
},
|
|
57165
|
-
loader: {
|
|
57166
|
-
'\0core': generateEntryPoint$1(outputTarget),
|
|
57167
|
-
},
|
|
57172
|
+
loader: {},
|
|
57168
57173
|
inlineDynamicImports: outputTarget.inlineDynamicImports,
|
|
57169
57174
|
preserveEntrySignatures: 'allow-extension',
|
|
57170
57175
|
});
|
|
@@ -57181,7 +57186,7 @@ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => ({
|
|
|
57181
57186
|
const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarget) => {
|
|
57182
57187
|
try {
|
|
57183
57188
|
const bundleOpts = getBundleOptions(config, buildCtx, compilerCtx, outputTarget);
|
|
57184
|
-
addCustomElementInputs(buildCtx, bundleOpts);
|
|
57189
|
+
addCustomElementInputs(buildCtx, bundleOpts, outputTarget);
|
|
57185
57190
|
const build = await bundleOutput(config, compilerCtx, buildCtx, bundleOpts);
|
|
57186
57191
|
if (build) {
|
|
57187
57192
|
const rollupOutput = await build.generate({
|
|
@@ -57243,11 +57248,17 @@ const bundleCustomElements$1 = async (config, compilerCtx, buildCtx, outputTarge
|
|
|
57243
57248
|
* Create the virtual modules/input modules for the `dist-custom-elements` output target.
|
|
57244
57249
|
* @param buildCtx the context for the current build
|
|
57245
57250
|
* @param bundleOpts the bundle options to store the virtual modules under. acts as an output parameter
|
|
57251
|
+
* @param outputTarget the configuration for the custom element output target
|
|
57246
57252
|
*/
|
|
57247
|
-
const addCustomElementInputs = (buildCtx, bundleOpts) => {
|
|
57253
|
+
const addCustomElementInputs = (buildCtx, bundleOpts, outputTarget) => {
|
|
57248
57254
|
const components = buildCtx.components;
|
|
57249
|
-
//
|
|
57255
|
+
// An array to store the imports of these modules that we're going to add to our entry chunk
|
|
57250
57256
|
const indexImports = [];
|
|
57257
|
+
// An array to store the export declarations that we're going to add to our entry chunk
|
|
57258
|
+
const indexExports = [];
|
|
57259
|
+
// An array to store the exported component names that will be used for the `defineCustomElements`
|
|
57260
|
+
// function on the `bundle` export behavior option
|
|
57261
|
+
const exportNames = [];
|
|
57251
57262
|
components.forEach((cmp) => {
|
|
57252
57263
|
const exp = [];
|
|
57253
57264
|
const exportName = dashToPascalCase$1(cmp.tagName);
|
|
@@ -57256,7 +57267,7 @@ const addCustomElementInputs = (buildCtx, bundleOpts) => {
|
|
|
57256
57267
|
const coreKey = `\0${exportName}`;
|
|
57257
57268
|
if (cmp.isPlain) {
|
|
57258
57269
|
exp.push(`export { ${importName} as ${exportName} } from '${cmp.sourceFilePath}';`);
|
|
57259
|
-
|
|
57270
|
+
indexExports.push(`export { {${exportName} } from '${coreKey}';`);
|
|
57260
57271
|
}
|
|
57261
57272
|
else {
|
|
57262
57273
|
// the `importName` may collide with the `exportName`, alias it just in case it does with `importAs`
|
|
@@ -57269,25 +57280,55 @@ const addCustomElementInputs = (buildCtx, bundleOpts) => {
|
|
|
57269
57280
|
// correct virtual module, if we instead referenced, for instance,
|
|
57270
57281
|
// `cmp.sourceFilePath`, we would end up with duplicated modules in our
|
|
57271
57282
|
// output.
|
|
57272
|
-
|
|
57283
|
+
indexExports.push(`export { ${exportName}, defineCustomElement as defineCustomElement${exportName} } from '${coreKey}';`);
|
|
57273
57284
|
}
|
|
57285
|
+
indexImports.push(`import { ${exportName} } from '${coreKey}';`);
|
|
57286
|
+
exportNames.push(exportName);
|
|
57274
57287
|
bundleOpts.inputs[cmp.tagName] = coreKey;
|
|
57275
57288
|
bundleOpts.loader[coreKey] = exp.join('\n');
|
|
57276
57289
|
});
|
|
57277
|
-
|
|
57290
|
+
// Generate the contents of the entry file to be created by the bundler
|
|
57291
|
+
bundleOpts.loader['\0core'] = generateEntryPoint$1(outputTarget, indexImports, indexExports, exportNames);
|
|
57278
57292
|
};
|
|
57279
57293
|
/**
|
|
57280
57294
|
* Generate the entrypoint (`index.ts` file) contents for the `dist-custom-elements` output target
|
|
57281
57295
|
* @param outputTarget the output target's configuration
|
|
57296
|
+
* @param cmpImports The import declarations for local component modules.
|
|
57297
|
+
* @param cmpExports The export declarations for local component modules.
|
|
57298
|
+
* @param cmpNames The exported component names (could be aliased) from local component modules.
|
|
57282
57299
|
* @returns the stringified contents to be placed in the entrypoint
|
|
57283
57300
|
*/
|
|
57284
|
-
const generateEntryPoint$1 = (outputTarget) => {
|
|
57285
|
-
const
|
|
57286
|
-
|
|
57301
|
+
const generateEntryPoint$1 = (outputTarget, cmpImports = [], cmpExports = [], cmpNames = []) => {
|
|
57302
|
+
const body = [];
|
|
57303
|
+
const imports = [];
|
|
57304
|
+
const exports = [];
|
|
57305
|
+
// Exports that are always present
|
|
57306
|
+
exports.push(`export { setAssetPath, setNonce, setPlatformOptions } from '${RINDO_INTERNAL_CLIENT_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
|
|
57307
|
+
// Content related to global scripts
|
|
57287
57308
|
if (outputTarget.includeGlobalScripts !== false) {
|
|
57288
|
-
|
|
57289
|
-
|
|
57290
|
-
|
|
57309
|
+
imports.push(`import { globalScripts } from '${RINDO_APP_GLOBALS_ID}';`);
|
|
57310
|
+
body.push(`globalScripts();`);
|
|
57311
|
+
}
|
|
57312
|
+
// Content related to the `bundle` export behavior
|
|
57313
|
+
if (outputTarget.customElementsExportBehavior === 'bundle') {
|
|
57314
|
+
imports.push(...cmpImports);
|
|
57315
|
+
body.push('export const defineCustomElements = (opts) => {', " if (typeof customElements !== 'undefined') {", ' [', ...cmpNames.map((cmp) => ` ${cmp},`), ' ].forEach(cmp => {', ' if (!customElements.get(cmp.is)) {', ' customElements.define(cmp.is, cmp, opts);', ' }', ' });', ' }', '};');
|
|
57316
|
+
}
|
|
57317
|
+
// Content related to the `single-export-module` export behavior
|
|
57318
|
+
if (outputTarget.customElementsExportBehavior === 'single-export-module') {
|
|
57319
|
+
exports.push(...cmpExports);
|
|
57320
|
+
}
|
|
57321
|
+
// Generate the contents of the file based on the parts
|
|
57322
|
+
// defined above. This keeps the file structure consistent as
|
|
57323
|
+
// new export behaviors may be added
|
|
57324
|
+
let content = '';
|
|
57325
|
+
// Add imports to file content
|
|
57326
|
+
content += imports.length ? imports.join('\n') + '\n' : '';
|
|
57327
|
+
// Add exports to file content
|
|
57328
|
+
content += exports.length ? exports.join('\n') + '\n' : '';
|
|
57329
|
+
// Add body to file content
|
|
57330
|
+
content += body.length ? '\n' + body.join('\n') + '\n' : '';
|
|
57331
|
+
return content;
|
|
57291
57332
|
};
|
|
57292
57333
|
/**
|
|
57293
57334
|
* Get the series of custom transformers that will be applied to a Rindo project's source code during the TypeScript
|
|
@@ -57318,6 +57359,7 @@ const getCustomElementCustomTransformer = (config, compilerCtx, components, outp
|
|
|
57318
57359
|
];
|
|
57319
57360
|
};
|
|
57320
57361
|
|
|
57362
|
+
// TODO: fully delete dist-custom-elements-bundle code
|
|
57321
57363
|
const outputCustomElementsBundle = async (config, compilerCtx, buildCtx) => {
|
|
57322
57364
|
if (!config.buildDist) {
|
|
57323
57365
|
return;
|
|
@@ -59089,195 +59131,6 @@ const getLazyEntry = (isBrowser) => {
|
|
|
59089
59131
|
return s.toString();
|
|
59090
59132
|
};
|
|
59091
59133
|
|
|
59092
|
-
const outputAngular = async (config, compilerCtx, buildCtx) => {
|
|
59093
|
-
if (!config.buildDist) {
|
|
59094
|
-
return;
|
|
59095
|
-
}
|
|
59096
|
-
const angularOutputTargets = config.outputTargets.filter(isOutputTargetAngular);
|
|
59097
|
-
if (angularOutputTargets.length === 0) {
|
|
59098
|
-
return;
|
|
59099
|
-
}
|
|
59100
|
-
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);
|
|
59101
|
-
await Promise.all(angularOutputTargets.map((outputTarget) => angularDirectiveProxyOutput(config, compilerCtx, buildCtx, outputTarget)));
|
|
59102
|
-
timespan.finish(`generate angular proxies finished`);
|
|
59103
|
-
};
|
|
59104
|
-
const angularDirectiveProxyOutput = (config, compilerCtx, buildCtx, outputTarget) => {
|
|
59105
|
-
const filteredComponents = getFilteredComponents(outputTarget.excludeComponents, buildCtx.components);
|
|
59106
|
-
return Promise.all([
|
|
59107
|
-
generateProxies(config, compilerCtx, buildCtx, filteredComponents, outputTarget),
|
|
59108
|
-
generateAngularArray(compilerCtx, filteredComponents, outputTarget),
|
|
59109
|
-
generateAngularUtils(compilerCtx, outputTarget),
|
|
59110
|
-
]);
|
|
59111
|
-
};
|
|
59112
|
-
const getFilteredComponents = (excludeComponents = [], cmps) => {
|
|
59113
|
-
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
59114
|
-
};
|
|
59115
|
-
const generateProxies = async (config, compilerCtx, buildCtx, components, outputTarget) => {
|
|
59116
|
-
const proxies = getProxies(components);
|
|
59117
|
-
const distTypesDir = dirname(buildCtx.packageJson.types);
|
|
59118
|
-
const dtsFilePath = join(config.rootDir, distTypesDir, GENERATED_DTS);
|
|
59119
|
-
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
59120
|
-
const imports = `/* eslint-disable */
|
|
59121
|
-
/* tslint:disable */
|
|
59122
|
-
/* auto-generated angular directive proxies */
|
|
59123
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, NgZone } from '@angular/core';`;
|
|
59124
|
-
const sourceImports = !outputTarget.componentCorePackage
|
|
59125
|
-
? `import { Components } from '${componentsTypeFile}';`
|
|
59126
|
-
: `import { Components } from '${outputTarget.componentCorePackage}';`;
|
|
59127
|
-
const final = [imports, getProxyUtils(outputTarget), sourceImports, proxies];
|
|
59128
|
-
const finalText = final.join('\n') + '\n';
|
|
59129
|
-
const tsSourceFile = t.createSourceFile(GENERATED_DTS, finalText, t.ScriptTarget.Latest, false);
|
|
59130
|
-
const tsPrinter = t.createPrinter({
|
|
59131
|
-
newLine: t.NewLineKind.LineFeed,
|
|
59132
|
-
});
|
|
59133
|
-
const formattedCode = tsPrinter.printFile(tsSourceFile);
|
|
59134
|
-
return compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, formattedCode);
|
|
59135
|
-
};
|
|
59136
|
-
const getProxies = (components) => {
|
|
59137
|
-
return components.map(getProxy).join('\n');
|
|
59138
|
-
};
|
|
59139
|
-
const getProxyCmp = (inputs, methods) => {
|
|
59140
|
-
const hasInputs = inputs.length > 0;
|
|
59141
|
-
const hasMethods = methods.length > 0;
|
|
59142
|
-
const proxMeta = [];
|
|
59143
|
-
if (!hasInputs && !hasMethods) {
|
|
59144
|
-
return '';
|
|
59145
|
-
}
|
|
59146
|
-
if (hasInputs)
|
|
59147
|
-
proxMeta.push(`inputs: ['${inputs.join(`', '`)}']`);
|
|
59148
|
-
if (hasMethods)
|
|
59149
|
-
proxMeta.push(`'methods': ['${methods.join(`', '`)}']`);
|
|
59150
|
-
return `@ProxyCmp({${proxMeta.join(', ')}})`;
|
|
59151
|
-
};
|
|
59152
|
-
const getProxy = (cmpMeta) => {
|
|
59153
|
-
// Collect component meta
|
|
59154
|
-
const inputs = getInputs(cmpMeta);
|
|
59155
|
-
const outputs = getOutputs(cmpMeta);
|
|
59156
|
-
const methods = getMethods(cmpMeta);
|
|
59157
|
-
const hasOutputs = outputs.length > 0;
|
|
59158
|
-
// Generate Angular @Directive
|
|
59159
|
-
const directiveOpts = [
|
|
59160
|
-
`selector: \'${cmpMeta.tagName}\'`,
|
|
59161
|
-
`changeDetection: ChangeDetectionStrategy.OnPush`,
|
|
59162
|
-
`template: '<ng-content></ng-content>'`,
|
|
59163
|
-
];
|
|
59164
|
-
if (inputs.length > 0) {
|
|
59165
|
-
directiveOpts.push(`inputs: ['${inputs.join(`', '`)}']`);
|
|
59166
|
-
}
|
|
59167
|
-
const tagNameAsPascal = dashToPascalCase$1(cmpMeta.tagName);
|
|
59168
|
-
const lines = [
|
|
59169
|
-
`
|
|
59170
|
-
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {}
|
|
59171
|
-
${getProxyCmp(inputs, methods)}
|
|
59172
|
-
@Component({ ${directiveOpts.join(', ')} })
|
|
59173
|
-
export class ${tagNameAsPascal} {`,
|
|
59174
|
-
];
|
|
59175
|
-
// Generate outputs
|
|
59176
|
-
outputs.forEach((output) => {
|
|
59177
|
-
lines.push(` ${output}!: EventEmitter<CustomEvent>;`);
|
|
59178
|
-
});
|
|
59179
|
-
lines.push(' protected el: HTMLElement;');
|
|
59180
|
-
lines.push(` constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
59181
|
-
c.detach();
|
|
59182
|
-
this.el = r.nativeElement;`);
|
|
59183
|
-
if (hasOutputs) {
|
|
59184
|
-
lines.push(` proxyOutputs(this, this.el, ['${outputs.join(`', '`)}']);`);
|
|
59185
|
-
}
|
|
59186
|
-
lines.push(` }`);
|
|
59187
|
-
lines.push(`}`);
|
|
59188
|
-
return lines.join('\n');
|
|
59189
|
-
};
|
|
59190
|
-
const getInputs = (cmpMeta) => {
|
|
59191
|
-
return [
|
|
59192
|
-
...cmpMeta.properties.filter((prop) => !prop.internal).map((prop) => prop.name),
|
|
59193
|
-
...cmpMeta.virtualProperties.map((prop) => prop.name),
|
|
59194
|
-
].sort();
|
|
59195
|
-
};
|
|
59196
|
-
const getOutputs = (cmpMeta) => {
|
|
59197
|
-
return cmpMeta.events.filter((ev) => !ev.internal).map((prop) => prop.name);
|
|
59198
|
-
};
|
|
59199
|
-
const getMethods = (cmpMeta) => {
|
|
59200
|
-
return cmpMeta.methods.filter((method) => !method.internal).map((prop) => prop.name);
|
|
59201
|
-
};
|
|
59202
|
-
const getProxyUtils = (outputTarget) => {
|
|
59203
|
-
if (!outputTarget.directivesUtilsFile) {
|
|
59204
|
-
return PROXY_UTILS.replace(/export function/g, 'function');
|
|
59205
|
-
}
|
|
59206
|
-
else {
|
|
59207
|
-
const utilsPath = relativeImport(outputTarget.directivesProxyFile, outputTarget.directivesUtilsFile, '.ts');
|
|
59208
|
-
return `import { ProxyCmp, proxyOutputs } from '${utilsPath}';\n`;
|
|
59209
|
-
}
|
|
59210
|
-
};
|
|
59211
|
-
const generateAngularArray = (compilerCtx, components, outputTarget) => {
|
|
59212
|
-
if (!outputTarget.directivesArrayFile) {
|
|
59213
|
-
return Promise.resolve();
|
|
59214
|
-
}
|
|
59215
|
-
const proxyPath = relativeImport(outputTarget.directivesArrayFile, outputTarget.directivesProxyFile, '.ts');
|
|
59216
|
-
const directives = components
|
|
59217
|
-
.map((cmpMeta) => dashToPascalCase$1(cmpMeta.tagName))
|
|
59218
|
-
.map((className) => ` d.${className}`)
|
|
59219
|
-
.join(',\n');
|
|
59220
|
-
const c = `
|
|
59221
|
-
import type * as d from '${proxyPath}';
|
|
59222
|
-
|
|
59223
|
-
export const DIRECTIVES = [
|
|
59224
|
-
${directives}
|
|
59225
|
-
];
|
|
59226
|
-
`;
|
|
59227
|
-
return compilerCtx.fs.writeFile(outputTarget.directivesArrayFile, c);
|
|
59228
|
-
};
|
|
59229
|
-
const generateAngularUtils = async (compilerCtx, outputTarget) => {
|
|
59230
|
-
if (outputTarget.directivesUtilsFile) {
|
|
59231
|
-
await compilerCtx.fs.writeFile(outputTarget.directivesUtilsFile, '/* eslint-disable */\n/* tslint:disable */\n' + PROXY_UTILS);
|
|
59232
|
-
}
|
|
59233
|
-
};
|
|
59234
|
-
const PROXY_UTILS = `import { fromEvent } from 'rxjs';
|
|
59235
|
-
|
|
59236
|
-
export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
|
59237
|
-
const Prototype = Cmp.prototype;
|
|
59238
|
-
inputs.forEach(item => {
|
|
59239
|
-
Object.defineProperty(Prototype, item, {
|
|
59240
|
-
get() {
|
|
59241
|
-
return this.el[item];
|
|
59242
|
-
},
|
|
59243
|
-
set(val: any) {
|
|
59244
|
-
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
59245
|
-
}
|
|
59246
|
-
});
|
|
59247
|
-
});
|
|
59248
|
-
};
|
|
59249
|
-
|
|
59250
|
-
export const proxyMethods = (Cmp: any, methods: string[]) => {
|
|
59251
|
-
const Prototype = Cmp.prototype;
|
|
59252
|
-
methods.forEach(methodName => {
|
|
59253
|
-
Prototype[methodName] = function () {
|
|
59254
|
-
const args = arguments;
|
|
59255
|
-
return this.z.runOutsideAngular(() =>
|
|
59256
|
-
this.el[methodName].apply(this.el, args)
|
|
59257
|
-
);
|
|
59258
|
-
};
|
|
59259
|
-
});
|
|
59260
|
-
};
|
|
59261
|
-
|
|
59262
|
-
export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
|
59263
|
-
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
|
59264
|
-
}
|
|
59265
|
-
|
|
59266
|
-
export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
|
|
59267
|
-
const decorator = function(cls: any){
|
|
59268
|
-
if (opts.inputs) {
|
|
59269
|
-
proxyInputs(cls, opts.inputs);
|
|
59270
|
-
}
|
|
59271
|
-
if (opts.methods) {
|
|
59272
|
-
proxyMethods(cls, opts.methods);
|
|
59273
|
-
}
|
|
59274
|
-
return cls;
|
|
59275
|
-
};
|
|
59276
|
-
return decorator;
|
|
59277
|
-
}
|
|
59278
|
-
`;
|
|
59279
|
-
const GENERATED_DTS = 'components.d.ts';
|
|
59280
|
-
|
|
59281
59134
|
const generateCustomDocs = async (config, docsData, outputTargets) => {
|
|
59282
59135
|
const customOutputTargets = outputTargets.filter(isOutputTargetDocsCustom);
|
|
59283
59136
|
if (customOutputTargets.length === 0) {
|
|
@@ -60600,29 +60453,38 @@ const generateCustomElementsTypes = async (config, compilerCtx, buildCtx, typesD
|
|
|
60600
60453
|
* @param outputTarget the output target for which types are being currently generated
|
|
60601
60454
|
*/
|
|
60602
60455
|
const generateCustomElementsTypesOutput$1 = async (config, compilerCtx, buildCtx, typesDir, outputTarget) => {
|
|
60456
|
+
const isBarrelExport = outputTarget.customElementsExportBehavior === 'single-export-module';
|
|
60457
|
+
const isBundleExport = outputTarget.customElementsExportBehavior === 'bundle';
|
|
60603
60458
|
// the path where we're going to write the typedef for the whole dist-custom-elements output
|
|
60604
60459
|
const customElementsDtsPath = join(outputTarget.dir, 'index.d.ts');
|
|
60605
60460
|
// the directory where types for the individual components are written
|
|
60606
60461
|
const componentsTypeDirectoryRelPath = relative$1(outputTarget.dir, typesDir);
|
|
60607
60462
|
const components = buildCtx.components.filter((m) => !m.isCollectionDependency);
|
|
60608
60463
|
const code = [
|
|
60609
|
-
|
|
60610
|
-
|
|
60611
|
-
|
|
60612
|
-
|
|
60613
|
-
|
|
60614
|
-
|
|
60615
|
-
|
|
60616
|
-
|
|
60617
|
-
|
|
60618
|
-
|
|
60619
|
-
|
|
60620
|
-
|
|
60621
|
-
|
|
60622
|
-
|
|
60623
|
-
|
|
60624
|
-
|
|
60625
|
-
|
|
60464
|
+
// To mirror the index.js file and only export the typedefs for the
|
|
60465
|
+
// entities exported there, we will re-export the typedefs iff
|
|
60466
|
+
// the `customElementsExportBehavior` is set to barrel component exports
|
|
60467
|
+
...(isBarrelExport
|
|
60468
|
+
? [
|
|
60469
|
+
`/* ${config.namespace} custom elements */`,
|
|
60470
|
+
...components.map((component) => {
|
|
60471
|
+
const exportName = dashToPascalCase$1(component.tagName);
|
|
60472
|
+
const importName = component.componentClassName;
|
|
60473
|
+
// typedefs for individual components can be found under paths like
|
|
60474
|
+
// $TYPES_DIR/components/my-component/my-component.d.ts
|
|
60475
|
+
//
|
|
60476
|
+
// To construct this path we:
|
|
60477
|
+
//
|
|
60478
|
+
// - get the relative path to the component's source file from the source directory
|
|
60479
|
+
// - join that relative path to the relative path from the `index.d.ts` file to the
|
|
60480
|
+
// directory where typedefs are saved
|
|
60481
|
+
const componentSourceRelPath = relative$1(config.srcDir, component.sourceFilePath).replace('.tsx', '');
|
|
60482
|
+
const componentDTSPath = join(componentsTypeDirectoryRelPath, componentSourceRelPath);
|
|
60483
|
+
return `export { ${importName} as ${exportName} } from '${componentDTSPath}';`;
|
|
60484
|
+
}),
|
|
60485
|
+
``,
|
|
60486
|
+
]
|
|
60487
|
+
: []),
|
|
60626
60488
|
`/**`,
|
|
60627
60489
|
` * Used to manually set the base path where assets can be found.`,
|
|
60628
60490
|
` * If the script is used as "module", it's recommended to use "import.meta.url",`,
|
|
@@ -60650,16 +60512,41 @@ const generateCustomElementsTypesOutput$1 = async (config, compilerCtx, buildCtx
|
|
|
60650
60512
|
` rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;`,
|
|
60651
60513
|
`}`,
|
|
60652
60514
|
`export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;`,
|
|
60515
|
+
...(isBundleExport
|
|
60516
|
+
? [
|
|
60517
|
+
``,
|
|
60518
|
+
`/**`,
|
|
60519
|
+
` * Utility to define all custom elements within this package using the tag name provided in the component's source.`,
|
|
60520
|
+
` * When defining each custom element, it will also check it's safe to define by:`,
|
|
60521
|
+
` *`,
|
|
60522
|
+
` * 1. Ensuring the "customElements" registry is available in the global context (window).`,
|
|
60523
|
+
` * 2. Ensuring that the component tag name is not already defined.`,
|
|
60524
|
+
` *`,
|
|
60525
|
+
` * Use the standard [customElements.define()](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define)`,
|
|
60526
|
+
` * method instead to define custom elements individually, or to provide a different tag name.`,
|
|
60527
|
+
` */`,
|
|
60528
|
+
`export declare const defineCustomElements: (opts?: any) => void;`,
|
|
60529
|
+
]
|
|
60530
|
+
: []),
|
|
60653
60531
|
];
|
|
60654
60532
|
const componentsDtsRelPath = relDts$1(outputTarget.dir, join(typesDir, 'components.d.ts'));
|
|
60655
|
-
|
|
60656
|
-
|
|
60657
|
-
|
|
60658
|
-
|
|
60659
|
-
|
|
60660
|
-
|
|
60661
|
-
|
|
60662
|
-
|
|
60533
|
+
// To mirror the index.js file and only export the typedefs for the
|
|
60534
|
+
// entities exported there, we will re-export the typedefs iff
|
|
60535
|
+
// the `customElementsExportBehavior` is set to barrel component exports
|
|
60536
|
+
if (isBarrelExport) {
|
|
60537
|
+
// If there is an `index.ts` file in the src directory, we'll re-export anything
|
|
60538
|
+
// exported from that file
|
|
60539
|
+
// Otherwise, we'll export everything from the auto-generated `components.d.ts`
|
|
60540
|
+
// file in the output directory
|
|
60541
|
+
const usersIndexJsPath = join(config.srcDir, 'index.ts');
|
|
60542
|
+
const hasUserIndex = await compilerCtx.fs.access(usersIndexJsPath);
|
|
60543
|
+
if (hasUserIndex) {
|
|
60544
|
+
const userIndexRelPath = normalizePath$2(dirname(componentsDtsRelPath));
|
|
60545
|
+
code.push(`export * from '${userIndexRelPath}';`);
|
|
60546
|
+
}
|
|
60547
|
+
else {
|
|
60548
|
+
code.push(`export * from '${componentsDtsRelPath}';`);
|
|
60549
|
+
}
|
|
60663
60550
|
}
|
|
60664
60551
|
await compilerCtx.fs.writeFile(customElementsDtsPath, code.join('\n') + `\n`, {
|
|
60665
60552
|
outputTargetType: outputTarget.type,
|
|
@@ -60711,6 +60598,7 @@ const relDts$1 = (fromPath, dtsPath) => {
|
|
|
60711
60598
|
return normalizePath$2(dtsPath.replace('.d.ts', ''));
|
|
60712
60599
|
};
|
|
60713
60600
|
|
|
60601
|
+
// TODO: fully delete dist-custom-elements-bundle code
|
|
60714
60602
|
const generateCustomElementsBundleTypes = async (config, compilerCtx, buildCtx, distDtsFilePath) => {
|
|
60715
60603
|
const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElementsBundle);
|
|
60716
60604
|
await Promise.all(outputTargets.map((outputTarget) => generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, distDtsFilePath, outputTarget)));
|
|
@@ -61204,10 +61092,10 @@ const generateAppTypes = async (config, compilerCtx, buildCtx, destination) => {
|
|
|
61204
61092
|
// immediately write the components.d.ts file to disk and put it into fs memory
|
|
61205
61093
|
let componentsDtsFilePath = getComponentsDtsSrcFilePath(config);
|
|
61206
61094
|
if (!areTypesInternal) {
|
|
61207
|
-
componentsDtsFilePath = resolve$3(destination, GENERATED_DTS
|
|
61095
|
+
componentsDtsFilePath = resolve$3(destination, GENERATED_DTS);
|
|
61208
61096
|
componentTypesFileContent = updateRindoTypesImports(destination, componentsDtsFilePath, componentTypesFileContent);
|
|
61209
61097
|
}
|
|
61210
|
-
const writeResults = await compilerCtx.fs.writeFile(componentsDtsFilePath, componentTypesFileContent, {
|
|
61098
|
+
const writeResults = await compilerCtx.fs.writeFile(normalizePath$2(componentsDtsFilePath), componentTypesFileContent, {
|
|
61211
61099
|
immediateWrite: true,
|
|
61212
61100
|
});
|
|
61213
61101
|
const hasComponentsDtsChanged = writeResults.changedContent;
|
|
@@ -61249,17 +61137,15 @@ const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
61249
61137
|
});
|
|
61250
61138
|
c.push(COMPONENTS_DTS_HEADER);
|
|
61251
61139
|
c.push(`import { HTMLRindoElement, JSXBase } from "@rindo/core/internal";`);
|
|
61252
|
-
//
|
|
61253
|
-
|
|
61140
|
+
// Map event type metadata to partial expressions (omitting import/export keywords)
|
|
61141
|
+
// e.g. { TestEvent } from '../path/to/event/test-event.interface';
|
|
61142
|
+
const expressions = Object.keys(typeImportData).map((filePath) => {
|
|
61254
61143
|
const typeData = typeImportData[filePath];
|
|
61255
|
-
let importFilePath;
|
|
61144
|
+
let importFilePath = filePath;
|
|
61256
61145
|
if (isAbsolute$1(filePath)) {
|
|
61257
61146
|
importFilePath = normalizePath$2('./' + relative$1(config.srcDir, filePath)).replace(/\.(tsx|ts)$/, '');
|
|
61258
61147
|
}
|
|
61259
|
-
|
|
61260
|
-
importFilePath = filePath;
|
|
61261
|
-
}
|
|
61262
|
-
return `import { ${typeData
|
|
61148
|
+
return `{ ${typeData
|
|
61263
61149
|
.sort(sortImportNames)
|
|
61264
61150
|
.map((td) => {
|
|
61265
61151
|
if (td.localName === td.importName) {
|
|
@@ -61270,7 +61156,9 @@ const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
61270
61156
|
}
|
|
61271
61157
|
})
|
|
61272
61158
|
.join(`, `)} } from "${importFilePath}";`;
|
|
61273
|
-
})
|
|
61159
|
+
});
|
|
61160
|
+
// Write all import and export statements for event types
|
|
61161
|
+
c.push(...expressions.map((ref) => `import ${ref}`), ...expressions.map((ref) => `export ${ref}`));
|
|
61274
61162
|
c.push(`export namespace Components {`);
|
|
61275
61163
|
c.push(...modules.map((m) => `${m.component}`));
|
|
61276
61164
|
c.push(`}`);
|
|
@@ -61906,7 +61794,6 @@ const generateOutputTargets = async (config, compilerCtx, buildCtx) => {
|
|
|
61906
61794
|
compilerCtx.changedModules.clear();
|
|
61907
61795
|
invalidateRollupCaches(compilerCtx);
|
|
61908
61796
|
await Promise.all([
|
|
61909
|
-
outputAngular(config, compilerCtx, buildCtx),
|
|
61910
61797
|
outputCopy(config, compilerCtx, buildCtx),
|
|
61911
61798
|
outputCollection(config, compilerCtx, buildCtx, changedModuleFiles),
|
|
61912
61799
|
outputCustomElements(config, compilerCtx, buildCtx),
|
|
@@ -62281,12 +62168,6 @@ const componentDecoratorToStatic = (config, typeChecker, diagnostics, cmpNode, n
|
|
|
62281
62168
|
}
|
|
62282
62169
|
styleToStatic(newMembers, componentOptions);
|
|
62283
62170
|
const assetsDirs = componentOptions.assetsDirs || [];
|
|
62284
|
-
if (isString$1(componentOptions.assetsDir)) {
|
|
62285
|
-
assetsDirs.push(componentOptions.assetsDir);
|
|
62286
|
-
const warn = buildWarn(diagnostics);
|
|
62287
|
-
warn.messageText = `@Component option "assetsDir" should be renamed to "assetsDirs" and the value should be an array of strings.`;
|
|
62288
|
-
augmentDiagnosticWithNode(warn, componentDecorator);
|
|
62289
|
-
}
|
|
62290
62171
|
if (assetsDirs.length > 0) {
|
|
62291
62172
|
newMembers.push(createStaticGetter('assetsDirs', convertValueToLiteral(assetsDirs)));
|
|
62292
62173
|
}
|
|
@@ -66207,7 +66088,7 @@ const createTsWatchProgram = async (config, buildCallback) => {
|
|
|
66207
66088
|
return clearInterval(id);
|
|
66208
66089
|
},
|
|
66209
66090
|
};
|
|
66210
|
-
config.sys.
|
|
66091
|
+
config.sys.addDestroy(() => tsWatchSys.clearTimeout(timeoutId));
|
|
66211
66092
|
const tsWatchHost = t.createWatchCompilerHost(config.tsconfig, optionsToExtend, tsWatchSys, t.createEmitAndSemanticDiagnosticsBuilderProgram, (reportDiagnostic) => {
|
|
66212
66093
|
config.logger.debug('watch reportDiagnostic:' + reportDiagnostic.messageText);
|
|
66213
66094
|
}, (reportWatchStatus) => {
|
|
@@ -66332,7 +66213,7 @@ const createWatchBuild = async (config, compilerCtx) => {
|
|
|
66332
66213
|
watchingDirs.set(dirPath, config.sys.watchDirectory(dirPath, onDirChange, recursive));
|
|
66333
66214
|
}
|
|
66334
66215
|
};
|
|
66335
|
-
config.sys.
|
|
66216
|
+
config.sys.addDestroy(close);
|
|
66336
66217
|
return {
|
|
66337
66218
|
start,
|
|
66338
66219
|
close,
|
|
@@ -67691,7 +67572,7 @@ const createSysWorker = (config) => {
|
|
|
67691
67572
|
config.maxConcurrentWorkers > 0 &&
|
|
67692
67573
|
config.sys.hardwareConcurrency > 1) {
|
|
67693
67574
|
const workerCtrl = config.sys.createWorkerController(config.maxConcurrentWorkers);
|
|
67694
|
-
config.sys.
|
|
67575
|
+
config.sys.addDestroy(() => workerCtrl.destroy());
|
|
67695
67576
|
config.logger.debug(`create workers, maxWorkers: ${workerCtrl.maxWorkers}`);
|
|
67696
67577
|
return createWorkerMainContext(workerCtrl);
|
|
67697
67578
|
}
|
|
@@ -67949,32 +67830,6 @@ const getUserConfigName = (config, correctConfigName) => {
|
|
|
67949
67830
|
return correctConfigName;
|
|
67950
67831
|
};
|
|
67951
67832
|
|
|
67952
|
-
const validateAngular = (config, userOutputs) => {
|
|
67953
|
-
const angularOutputTargets = userOutputs.filter(isOutputTargetAngular);
|
|
67954
|
-
return angularOutputTargets.map((outputTarget) => {
|
|
67955
|
-
let directivesProxyFile = outputTarget.directivesProxyFile;
|
|
67956
|
-
if (directivesProxyFile && !isAbsolute$1(directivesProxyFile)) {
|
|
67957
|
-
directivesProxyFile = join(config.rootDir, directivesProxyFile);
|
|
67958
|
-
}
|
|
67959
|
-
let directivesArrayFile = outputTarget.directivesArrayFile;
|
|
67960
|
-
if (directivesArrayFile && !isAbsolute$1(directivesArrayFile)) {
|
|
67961
|
-
directivesArrayFile = join(config.rootDir, directivesArrayFile);
|
|
67962
|
-
}
|
|
67963
|
-
let directivesUtilsFile = outputTarget.directivesUtilsFile;
|
|
67964
|
-
if (directivesUtilsFile && !isAbsolute$1(directivesUtilsFile)) {
|
|
67965
|
-
directivesUtilsFile = join(config.rootDir, directivesUtilsFile);
|
|
67966
|
-
}
|
|
67967
|
-
return {
|
|
67968
|
-
type: 'angular',
|
|
67969
|
-
componentCorePackage: outputTarget.componentCorePackage,
|
|
67970
|
-
directivesProxyFile,
|
|
67971
|
-
directivesArrayFile,
|
|
67972
|
-
directivesUtilsFile,
|
|
67973
|
-
excludeComponents: outputTarget.excludeComponents || [],
|
|
67974
|
-
};
|
|
67975
|
-
});
|
|
67976
|
-
};
|
|
67977
|
-
|
|
67978
67833
|
/**
|
|
67979
67834
|
* Validate and return DIST_COLLECTION output targets, ensuring that the `dir`
|
|
67980
67835
|
* property is set on them.
|
|
@@ -67994,6 +67849,29 @@ const validateCollection = (config, userOutputs) => {
|
|
|
67994
67849
|
});
|
|
67995
67850
|
};
|
|
67996
67851
|
|
|
67852
|
+
/**
|
|
67853
|
+
* The collection of valid export behaviors.
|
|
67854
|
+
* Used to generate a type for typed configs as well as output target validation
|
|
67855
|
+
* for the `dist-custom-elements` output target.
|
|
67856
|
+
*
|
|
67857
|
+
* Adding a value to this const array will automatically add it as a valid option on the
|
|
67858
|
+
* output target configuration for `customElementsExportBehavior`.
|
|
67859
|
+
*
|
|
67860
|
+
* - `default`: No additional export or definition behavior will happen.
|
|
67861
|
+
* - `auto-define-custom-elements`: Enables the auto-definition of a component and its children (recursively) in the custom elements registry. This
|
|
67862
|
+
* functionality allows consumers to bypass the explicit call to define a component, its children, its children's
|
|
67863
|
+
* children, etc. Users of this flag should be aware that enabling this functionality may increase bundle size.
|
|
67864
|
+
* - `bundle`: A `defineCustomElements` function will be exported from the distribution directory. This behavior was added to allow easy migration
|
|
67865
|
+
* from `dist-custom-elements-bundle` to `dist-custom-elements`.
|
|
67866
|
+
* - `single-export-module`: All components will be re-exported from the specified directory's root `index.js` file.
|
|
67867
|
+
*/
|
|
67868
|
+
const CustomElementsExportBehaviorOptions = [
|
|
67869
|
+
'default',
|
|
67870
|
+
'auto-define-custom-elements',
|
|
67871
|
+
'bundle',
|
|
67872
|
+
'single-export-module',
|
|
67873
|
+
];
|
|
67874
|
+
|
|
67997
67875
|
/**
|
|
67998
67876
|
* Validate a series of {@link d.CopyTask}s
|
|
67999
67877
|
* @param copy the copy tasks to validate, or a boolean to specify if copy tasks are enabled
|
|
@@ -68037,6 +67915,15 @@ const validateCustomElement = (config, userOutputs) => {
|
|
|
68037
67915
|
if (!isBoolean$1(outputTarget.externalRuntime)) {
|
|
68038
67916
|
outputTarget.externalRuntime = true;
|
|
68039
67917
|
}
|
|
67918
|
+
if (!isBoolean$1(outputTarget.generateTypeDeclarations)) {
|
|
67919
|
+
outputTarget.generateTypeDeclarations = true;
|
|
67920
|
+
}
|
|
67921
|
+
// Export behavior must be defined on the validated target config and must
|
|
67922
|
+
// be one of the export behavior valid values
|
|
67923
|
+
if (outputTarget.customElementsExportBehavior == null ||
|
|
67924
|
+
!CustomElementsExportBehaviorOptions.includes(outputTarget.customElementsExportBehavior)) {
|
|
67925
|
+
outputTarget.customElementsExportBehavior = 'default';
|
|
67926
|
+
}
|
|
68040
67927
|
// unlike other output targets, Rindo does not allow users to define the output location of types at this time
|
|
68041
67928
|
if (outputTarget.generateTypeDeclarations) {
|
|
68042
67929
|
const typesDirectory = getAbsolutePath(config, join(defaultDir, 'types'));
|
|
@@ -68059,6 +67946,7 @@ const validateCustomElement = (config, userOutputs) => {
|
|
|
68059
67946
|
}, []);
|
|
68060
67947
|
};
|
|
68061
67948
|
|
|
67949
|
+
// TODO: fully delete dist-custom-elements-bundle code
|
|
68062
67950
|
const validateCustomElementBundle = (config, userOutputs) => {
|
|
68063
67951
|
return userOutputs.filter(isOutputTargetDistCustomElementsBundle).reduce((arr, o) => {
|
|
68064
67952
|
const outputTarget = {
|
|
@@ -68581,11 +68469,6 @@ const validateOutputTargets = (config, diagnostics) => {
|
|
|
68581
68469
|
const err = buildError(diagnostics);
|
|
68582
68470
|
err.messageText = `Invalid outputTarget type "${outputTarget.type}". Valid outputTarget types include: ${VALID_CONFIG_OUTPUT_TARGETS.map((t) => `"${t}"`).join(', ')}`;
|
|
68583
68471
|
}
|
|
68584
|
-
else if (outputTarget.type === DIST_CUSTOM_ELEMENTS_BUNDLE) {
|
|
68585
|
-
// TODO: Remove this check when the 'dist-custom-elements-bundle' is removed
|
|
68586
|
-
const warning = buildWarn(diagnostics);
|
|
68587
|
-
warning.messageText = `dist-custom-elements-bundle is deprecated and will be removed in a future major version release. Use "dist-custom-elements" instead.`;
|
|
68588
|
-
}
|
|
68589
68472
|
});
|
|
68590
68473
|
config.outputTargets = [
|
|
68591
68474
|
...validateCollection(config, userOutputs),
|
|
@@ -68596,7 +68479,6 @@ const validateOutputTargets = (config, diagnostics) => {
|
|
|
68596
68479
|
...validateWww(config, diagnostics, userOutputs),
|
|
68597
68480
|
...validateDist(config, userOutputs),
|
|
68598
68481
|
...validateDocs(config, diagnostics, userOutputs),
|
|
68599
|
-
...validateAngular(config, userOutputs),
|
|
68600
68482
|
...validateStats(config, userOutputs),
|
|
68601
68483
|
];
|
|
68602
68484
|
// hydrate also gets info from the www output
|
|
@@ -69188,7 +69070,7 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
69188
69070
|
validatedConfig.buildEs5 === true || (!validatedConfig.devMode && validatedConfig.buildEs5 === 'prod');
|
|
69189
69071
|
setBooleanConfig(validatedConfig, 'minifyCss', null, !validatedConfig.devMode);
|
|
69190
69072
|
setBooleanConfig(validatedConfig, 'minifyJs', null, !validatedConfig.devMode);
|
|
69191
|
-
setBooleanConfig(validatedConfig, 'sourceMap', null, typeof validatedConfig.sourceMap === 'undefined' ?
|
|
69073
|
+
setBooleanConfig(validatedConfig, 'sourceMap', null, typeof validatedConfig.sourceMap === 'undefined' ? true : validatedConfig.sourceMap);
|
|
69192
69074
|
setBooleanConfig(validatedConfig, 'watch', 'watch', false);
|
|
69193
69075
|
setBooleanConfig(validatedConfig, 'buildDocs', 'docs', !validatedConfig.devMode);
|
|
69194
69076
|
setBooleanConfig(validatedConfig, 'buildDist', 'esm', !validatedConfig.devMode || validatedConfig.buildEs5);
|
|
@@ -70091,7 +69973,7 @@ const getComponentPathContent = (componentGraph, outputTarget) => {
|
|
|
70091
69973
|
const dependencies = [
|
|
70092
69974
|
{
|
|
70093
69975
|
name: "@rindo/core",
|
|
70094
|
-
version: "
|
|
69976
|
+
version: "3.0.0-alpha.0",
|
|
70095
69977
|
main: "compiler/rindo.js",
|
|
70096
69978
|
resources: [
|
|
70097
69979
|
"package.json",
|