@stencil/angular-output-target 0.7.2-dev.11691590901.1db83f93 → 0.7.2-dev.11691677969.1304fff5
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/dist/index.cjs.js +14 -21
- package/dist/index.js +14 -21
- package/dist/output-angular.js +3 -4
- package/dist/plugin.js +7 -7
- package/dist/types.d.ts +3 -7
- package/dist/types.js +0 -12
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +6 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -9,19 +9,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
var OutputType;
|
|
19
|
-
(function (OutputType) {
|
|
20
|
-
OutputType["Component"] = "component";
|
|
21
|
-
OutputType["Scam"] = "scam";
|
|
22
|
-
OutputType["Standalone"] = "standalone";
|
|
23
|
-
})(OutputType || (OutputType = {}));
|
|
24
|
-
|
|
12
|
+
const OutputTypes = {
|
|
13
|
+
Component: 'component',
|
|
14
|
+
Scam: 'scam',
|
|
15
|
+
Standalone: 'standalone',
|
|
16
|
+
};
|
|
25
17
|
const toLowerCase = (str) => str.toLowerCase();
|
|
26
18
|
const dashToPascalCase = (str) => toLowerCase(str)
|
|
27
19
|
.split('-')
|
|
@@ -119,7 +111,7 @@ const createImportStatement = (imports, module) => {
|
|
|
119
111
|
* @returns `true` if the output type is for the custom elements build.
|
|
120
112
|
*/
|
|
121
113
|
const isOutputTypeCustomElementsBuild = (outputType) => {
|
|
122
|
-
return outputType ===
|
|
114
|
+
return outputType === OutputTypes.Standalone || outputType === OutputTypes.Scam;
|
|
123
115
|
};
|
|
124
116
|
/**
|
|
125
117
|
* Creates the collection of import statements for a component based on the component's events type dependencies.
|
|
@@ -418,9 +410,9 @@ function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
|
418
410
|
const dtsFilePath = path__default['default'].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
419
411
|
const { outputType } = outputTarget;
|
|
420
412
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
421
|
-
const includeSingleComponentAngularModules = outputType ===
|
|
413
|
+
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
422
414
|
const isCustomElementsBuild = isOutputTypeCustomElementsBuild(outputType);
|
|
423
|
-
const isStandaloneBuild = outputType ===
|
|
415
|
+
const isStandaloneBuild = outputType === OutputTypes.Standalone;
|
|
424
416
|
const includeOutputImports = components.some((component) => component.events.some((event) => !event.internal));
|
|
425
417
|
/**
|
|
426
418
|
* The collection of named imports from @angular/core.
|
|
@@ -516,20 +508,21 @@ ${createImportStatement(componentLibImports, './angular-component-lib/utils')}\n
|
|
|
516
508
|
const GENERATED_DTS = 'components.d.ts';
|
|
517
509
|
const IMPORT_TYPES = 'Components';
|
|
518
510
|
|
|
511
|
+
let validatedOutputTarget;
|
|
519
512
|
const angularOutputTarget = (outputTarget) => ({
|
|
520
513
|
type: 'custom',
|
|
521
514
|
name: 'angular-library',
|
|
522
515
|
validate(config) {
|
|
523
|
-
|
|
516
|
+
validatedOutputTarget = normalizeOutputTarget(config, outputTarget);
|
|
524
517
|
},
|
|
525
518
|
async generator(config, compilerCtx, buildCtx) {
|
|
526
519
|
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);
|
|
527
|
-
await angularDirectiveProxyOutput(compilerCtx,
|
|
520
|
+
await angularDirectiveProxyOutput(compilerCtx, validatedOutputTarget, buildCtx.components, config);
|
|
528
521
|
timespan.finish(`generate angular proxies finished`);
|
|
529
522
|
},
|
|
530
523
|
});
|
|
531
524
|
function normalizeOutputTarget(config, outputTarget) {
|
|
532
|
-
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType ||
|
|
525
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType || OutputTypes.Component });
|
|
533
526
|
if (config.rootDir == null) {
|
|
534
527
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
535
528
|
}
|
|
@@ -545,8 +538,8 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
545
538
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
546
539
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
547
540
|
}
|
|
548
|
-
if (outputTarget.outputType ===
|
|
549
|
-
console.warn(`**Experimental**: outputType: "${
|
|
541
|
+
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
542
|
+
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
550
543
|
}
|
|
551
544
|
return results;
|
|
552
545
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { EOL } from 'os';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
var OutputType;
|
|
11
|
-
(function (OutputType) {
|
|
12
|
-
OutputType["Component"] = "component";
|
|
13
|
-
OutputType["Scam"] = "scam";
|
|
14
|
-
OutputType["Standalone"] = "standalone";
|
|
15
|
-
})(OutputType || (OutputType = {}));
|
|
16
|
-
|
|
4
|
+
const OutputTypes = {
|
|
5
|
+
Component: 'component',
|
|
6
|
+
Scam: 'scam',
|
|
7
|
+
Standalone: 'standalone',
|
|
8
|
+
};
|
|
17
9
|
const toLowerCase = (str) => str.toLowerCase();
|
|
18
10
|
const dashToPascalCase = (str) => toLowerCase(str)
|
|
19
11
|
.split('-')
|
|
@@ -111,7 +103,7 @@ const createImportStatement = (imports, module) => {
|
|
|
111
103
|
* @returns `true` if the output type is for the custom elements build.
|
|
112
104
|
*/
|
|
113
105
|
const isOutputTypeCustomElementsBuild = (outputType) => {
|
|
114
|
-
return outputType ===
|
|
106
|
+
return outputType === OutputTypes.Standalone || outputType === OutputTypes.Scam;
|
|
115
107
|
};
|
|
116
108
|
/**
|
|
117
109
|
* Creates the collection of import statements for a component based on the component's events type dependencies.
|
|
@@ -410,9 +402,9 @@ function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
|
410
402
|
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
|
|
411
403
|
const { outputType } = outputTarget;
|
|
412
404
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
413
|
-
const includeSingleComponentAngularModules = outputType ===
|
|
405
|
+
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
414
406
|
const isCustomElementsBuild = isOutputTypeCustomElementsBuild(outputType);
|
|
415
|
-
const isStandaloneBuild = outputType ===
|
|
407
|
+
const isStandaloneBuild = outputType === OutputTypes.Standalone;
|
|
416
408
|
const includeOutputImports = components.some((component) => component.events.some((event) => !event.internal));
|
|
417
409
|
/**
|
|
418
410
|
* The collection of named imports from @angular/core.
|
|
@@ -508,20 +500,21 @@ ${createImportStatement(componentLibImports, './angular-component-lib/utils')}\n
|
|
|
508
500
|
const GENERATED_DTS = 'components.d.ts';
|
|
509
501
|
const IMPORT_TYPES = 'Components';
|
|
510
502
|
|
|
503
|
+
let validatedOutputTarget;
|
|
511
504
|
const angularOutputTarget = (outputTarget) => ({
|
|
512
505
|
type: 'custom',
|
|
513
506
|
name: 'angular-library',
|
|
514
507
|
validate(config) {
|
|
515
|
-
|
|
508
|
+
validatedOutputTarget = normalizeOutputTarget(config, outputTarget);
|
|
516
509
|
},
|
|
517
510
|
async generator(config, compilerCtx, buildCtx) {
|
|
518
511
|
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);
|
|
519
|
-
await angularDirectiveProxyOutput(compilerCtx,
|
|
512
|
+
await angularDirectiveProxyOutput(compilerCtx, validatedOutputTarget, buildCtx.components, config);
|
|
520
513
|
timespan.finish(`generate angular proxies finished`);
|
|
521
514
|
},
|
|
522
515
|
});
|
|
523
516
|
function normalizeOutputTarget(config, outputTarget) {
|
|
524
|
-
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType ||
|
|
517
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType || OutputTypes.Component });
|
|
525
518
|
if (config.rootDir == null) {
|
|
526
519
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
527
520
|
}
|
|
@@ -537,8 +530,8 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
537
530
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
538
531
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
539
532
|
}
|
|
540
|
-
if (outputTarget.outputType ===
|
|
541
|
-
console.warn(`**Experimental**: outputType: "${
|
|
533
|
+
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
534
|
+
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
542
535
|
}
|
|
543
536
|
return results;
|
|
544
537
|
}
|
package/dist/output-angular.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import {
|
|
3
|
-
import { relativeImport, normalizePath, sortBy, readPackageJson, dashToPascalCase, createImportStatement, isOutputTypeCustomElementsBuild, } from './utils';
|
|
2
|
+
import { relativeImport, normalizePath, sortBy, readPackageJson, dashToPascalCase, createImportStatement, isOutputTypeCustomElementsBuild, OutputTypes, } from './utils';
|
|
4
3
|
import { createAngularComponentDefinition, createComponentTypeDefinition } from './generate-angular-component';
|
|
5
4
|
import { generateAngularDirectivesFile } from './generate-angular-directives-file';
|
|
6
5
|
import generateValueAccessors from './generate-value-accessors';
|
|
@@ -40,9 +39,9 @@ export function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
|
40
39
|
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
|
|
41
40
|
const { outputType } = outputTarget;
|
|
42
41
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
43
|
-
const includeSingleComponentAngularModules = outputType ===
|
|
42
|
+
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
44
43
|
const isCustomElementsBuild = isOutputTypeCustomElementsBuild(outputType);
|
|
45
|
-
const isStandaloneBuild = outputType ===
|
|
44
|
+
const isStandaloneBuild = outputType === OutputTypes.Standalone;
|
|
46
45
|
const includeOutputImports = components.some((component) => component.events.some((event) => !event.internal));
|
|
47
46
|
/**
|
|
48
47
|
* The collection of named imports from @angular/core.
|
package/dist/plugin.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { normalizePath } from './utils';
|
|
1
|
+
import { OutputTypes, normalizePath } from './utils';
|
|
2
2
|
import { angularDirectiveProxyOutput } from './output-angular';
|
|
3
|
-
import { OutputType } from './types';
|
|
4
3
|
import path from 'path';
|
|
4
|
+
let validatedOutputTarget;
|
|
5
5
|
export const angularOutputTarget = (outputTarget) => ({
|
|
6
6
|
type: 'custom',
|
|
7
7
|
name: 'angular-library',
|
|
8
8
|
validate(config) {
|
|
9
|
-
|
|
9
|
+
validatedOutputTarget = normalizeOutputTarget(config, outputTarget);
|
|
10
10
|
},
|
|
11
11
|
async generator(config, compilerCtx, buildCtx) {
|
|
12
12
|
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);
|
|
13
|
-
await angularDirectiveProxyOutput(compilerCtx,
|
|
13
|
+
await angularDirectiveProxyOutput(compilerCtx, validatedOutputTarget, buildCtx.components, config);
|
|
14
14
|
timespan.finish(`generate angular proxies finished`);
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
export function normalizeOutputTarget(config, outputTarget) {
|
|
18
|
-
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType ||
|
|
18
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: outputTarget.customElementsDir || 'components', outputType: outputTarget.outputType || OutputTypes.Component });
|
|
19
19
|
if (config.rootDir == null) {
|
|
20
20
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
21
21
|
}
|
|
@@ -31,8 +31,8 @@ export function normalizeOutputTarget(config, outputTarget) {
|
|
|
31
31
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
32
32
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
|
33
33
|
}
|
|
34
|
-
if (outputTarget.outputType ===
|
|
35
|
-
console.warn(`**Experimental**: outputType: "${
|
|
34
|
+
if (outputTarget.outputType === OutputTypes.Scam) {
|
|
35
|
+
console.warn(`**Experimental**: outputType: "${OutputTypes.Scam}" is a developer preview feature and may change or be removed in the future.`);
|
|
36
36
|
}
|
|
37
37
|
return results;
|
|
38
38
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
5
5
|
* - `standalone` - Generate a component with the `standalone` flag set to `true`.
|
|
6
6
|
*/
|
|
7
|
-
export declare
|
|
8
|
-
Component = "component",
|
|
9
|
-
Scam = "scam",
|
|
10
|
-
Standalone = "standalone"
|
|
11
|
-
}
|
|
7
|
+
export declare type OutputType = 'component' | 'scam' | 'standalone';
|
|
12
8
|
export interface OutputTargetAngular {
|
|
13
9
|
/**
|
|
14
10
|
* The package name of the component library.
|
|
@@ -27,10 +23,10 @@ export interface OutputTargetAngular {
|
|
|
27
23
|
/**
|
|
28
24
|
* The type of output that should be generated.
|
|
29
25
|
* - `component` - Generate many component wrappers tied to a single Angular module (lazy/hydrated approach).
|
|
30
|
-
* - `scam` -
|
|
26
|
+
* - `scam` - **Experimental** - Generate a Single Component Angular Module for each component.
|
|
31
27
|
* - `standalone` - Generate a component with the `standalone` flag set to `true`.
|
|
32
28
|
*/
|
|
33
|
-
outputType
|
|
29
|
+
outputType?: OutputType;
|
|
34
30
|
}
|
|
35
31
|
export declare type ValueAccessorTypes = 'text' | 'radio' | 'select' | 'number' | 'boolean';
|
|
36
32
|
export interface ValueAccessorConfig {
|
package/dist/types.js
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The type of output that can be generated with the Angular output target.
|
|
3
|
-
* - `component` - Generate many component wrappers tied to a single Angular module (lazy/hydrated approach).
|
|
4
|
-
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
5
|
-
* - `standalone` - Generate a component with the `standalone` flag set to `true`.
|
|
6
|
-
*/
|
|
7
|
-
export var OutputType;
|
|
8
|
-
(function (OutputType) {
|
|
9
|
-
OutputType["Component"] = "component";
|
|
10
|
-
OutputType["Scam"] = "scam";
|
|
11
|
-
OutputType["Standalone"] = "standalone";
|
|
12
|
-
})(OutputType || (OutputType = {}));
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ComponentCompilerEvent, Config } from '@stencil/core/internal';
|
|
2
2
|
import { OutputType, PackageJSON } from './types';
|
|
3
|
+
export declare const OutputTypes: {
|
|
4
|
+
[key: string]: OutputType;
|
|
5
|
+
};
|
|
3
6
|
export declare const toLowerCase: (str: string) => string;
|
|
4
7
|
export declare const dashToPascalCase: (str: string) => string;
|
|
5
8
|
export declare function sortBy<T>(array: T[], prop: (item: T) => string): T[];
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
|
|
2
|
+
export const OutputTypes = {
|
|
3
|
+
Component: 'component',
|
|
4
|
+
Scam: 'scam',
|
|
5
|
+
Standalone: 'standalone',
|
|
6
|
+
};
|
|
3
7
|
export const toLowerCase = (str) => str.toLowerCase();
|
|
4
8
|
export const dashToPascalCase = (str) => toLowerCase(str)
|
|
5
9
|
.split('-')
|
|
@@ -100,7 +104,7 @@ export const createImportStatement = (imports, module) => {
|
|
|
100
104
|
* @returns `true` if the output type is for the custom elements build.
|
|
101
105
|
*/
|
|
102
106
|
export const isOutputTypeCustomElementsBuild = (outputType) => {
|
|
103
|
-
return outputType ===
|
|
107
|
+
return outputType === OutputTypes.Standalone || outputType === OutputTypes.Scam;
|
|
104
108
|
};
|
|
105
109
|
/**
|
|
106
110
|
* Creates the collection of import statements for a component based on the component's events type dependencies.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.7.2-dev.
|
|
3
|
+
"version": "0.7.2-dev.11691677969.1304fff5",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
],
|
|
59
59
|
"testURL": "http://localhost"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "304fff5690890bd3baf8fd4ea5041f544889b1ee",
|
|
62
62
|
"volta": {
|
|
63
63
|
"extends": "../../package.json"
|
|
64
64
|
}
|