@baloise/angular-output-target 1.1.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.2.0](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.1.2...@baloise/angular-output-target@1.2.0) (2022-03-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * **react:** add custom react output ([11eabd3](https://github.com/baloise/stencil-ds-output-targets/commit/11eabd33271a12c9a5d15d64c114f30c017cc1d5))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.1.2](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.1.1...@baloise/angular-output-target@1.1.2) (2022-02-10)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **angular:** remove all component module ([dcf567d](https://github.com/baloise/stencil-ds-output-targets/commit/dcf567d597313a5b5bf1ec003ef9f7f25dd4bcad))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.1.1](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.1.0...@baloise/angular-output-target@1.1.1) (2022-01-31)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **angular:** add common module ([6387334](https://github.com/baloise/stencil-ds-output-targets/commit/63873341511fe0dfe9490fda06bb785df3fc1404))
34
+ * **angular:** add common module ([10798bb](https://github.com/baloise/stencil-ds-output-targets/commit/10798bb22e435a87cf12d0ccd6d868ff0314f685))
35
+
36
+
37
+
38
+
39
+
6
40
  # [1.1.0](https://github.com/baloise/stencil-ds-output-targets/compare/@baloise/angular-output-target@1.0.26...@baloise/angular-output-target@1.1.0) (2022-01-31)
7
41
 
8
42
 
@@ -40,7 +40,7 @@ ${getProxyCmp(inputs, methods)}
40
40
  @Component({
41
41
  ${directiveOpts.join(',\n ')}
42
42
  })
43
- export class ${tagNameAsPascal} {`,
43
+ class ${tagNameAsPascal} {`,
44
44
  ];
45
45
  // Generate outputs
46
46
  outputs.forEach(output => {
@@ -44,6 +44,7 @@ ${declarationImports.join('\n ')}
44
44
  declarations: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
45
45
  exports: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
46
46
  providers: [${providers.join(', ')}],
47
+ imports: [CommonModule],
47
48
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
48
49
  })
49
50
  export class ${tagNameAsPascal}Module {
package/dist/index.cjs.js CHANGED
@@ -128,7 +128,7 @@ ${getProxyCmp(inputs, methods)}
128
128
  @Component({
129
129
  ${directiveOpts.join(',\n ')}
130
130
  })
131
- export class ${tagNameAsPascal} {`,
131
+ class ${tagNameAsPascal} {`,
132
132
  ];
133
133
  // Generate outputs
134
134
  outputs.forEach(output => {
@@ -280,6 +280,7 @@ ${declarationImports.join('\n ')}
280
280
  declarations: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
281
281
  exports: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
282
282
  providers: [${providers.join(', ')}],
283
+ imports: [CommonModule],
283
284
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
284
285
  })
285
286
  export class ${tagNameAsPascal}Module {
@@ -295,10 +296,8 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
295
296
  const rootDir = config.rootDir;
296
297
  const pkgData = await readPackageJson(rootDir);
297
298
  const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
298
- const allComponentModule = generateAllComponentModule(filteredComponents, outputTarget);
299
299
  await Promise.all([
300
300
  compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
301
- compilerCtx.fs.writeFile(outputTarget.directivesProxyFile.replace('.ts', '.module.ts'), allComponentModule),
302
301
  copyResources(config, outputTarget),
303
302
  generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
304
303
  generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
@@ -322,34 +321,6 @@ async function copyResources(config, outputTarget) {
322
321
  },
323
322
  ], srcDirectory);
324
323
  }
325
- function generateAllComponentModule(components, outputTarget) {
326
- const childComponent = Object.values(outputTarget.componentGroups || {})
327
- .flat()
328
- .map(o => o.components)
329
- .flat();
330
- const moduleImports = components
331
- .map(c => c.tagName)
332
- .filter(c => !childComponent.includes(c))
333
- .map(c => ` ${dashToPascalCase(c)}Module,`);
334
- return `/* tslint:disable */
335
- /* auto-generated angular directive proxies */
336
- import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
337
- import {
338
- ${moduleImports.join('\n')}
339
- } from './proxies'
340
-
341
- const modules = [
342
- ${moduleImports.join('\n')}
343
- ]
344
-
345
- @NgModule({
346
- imports: [...modules],
347
- exports: [...modules],
348
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
349
- })
350
- export class BalAllComponentModule {}
351
- `;
352
- }
353
324
  function generateProxies(components, pkgData, outputTarget, rootDir) {
354
325
  const distTypesDir = path__default['default'].dirname(pkgData.types);
355
326
  const dtsFilePath = path__default['default'].join(rootDir, distTypesDir, GENERATED_DTS);
@@ -357,6 +328,7 @@ function generateProxies(components, pkgData, outputTarget, rootDir) {
357
328
  const imports = `/* tslint:disable */
358
329
  /* auto-generated angular directive proxies */
359
330
  import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, NgZone, EventEmitter, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
331
+ import { CommonModule } from '@angular/common';
360
332
  import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
361
333
  const componentImports = components.map(c => `import { defineCustomElement as define${dashToPascalCase(c.tagName)} } from '${normalizePath(outputTarget.componentCorePackage || '')}/dist/components/${c.tagName}';`);
362
334
  const typeImports = !outputTarget.componentCorePackage
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ ${getProxyCmp(inputs, methods)}
119
119
  @Component({
120
120
  ${directiveOpts.join(',\n ')}
121
121
  })
122
- export class ${tagNameAsPascal} {`,
122
+ class ${tagNameAsPascal} {`,
123
123
  ];
124
124
  // Generate outputs
125
125
  outputs.forEach(output => {
@@ -271,6 +271,7 @@ ${declarationImports.join('\n ')}
271
271
  declarations: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
272
272
  exports: [${[tagNameAsPascal, ...cmpImports, ...declarations].join(', ')}],
273
273
  providers: [${providers.join(', ')}],
274
+ imports: [CommonModule],
274
275
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
275
276
  })
276
277
  export class ${tagNameAsPascal}Module {
@@ -286,10 +287,8 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
286
287
  const rootDir = config.rootDir;
287
288
  const pkgData = await readPackageJson(rootDir);
288
289
  const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
289
- const allComponentModule = generateAllComponentModule(filteredComponents, outputTarget);
290
290
  await Promise.all([
291
291
  compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
292
- compilerCtx.fs.writeFile(outputTarget.directivesProxyFile.replace('.ts', '.module.ts'), allComponentModule),
293
292
  copyResources(config, outputTarget),
294
293
  generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
295
294
  generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
@@ -313,34 +312,6 @@ async function copyResources(config, outputTarget) {
313
312
  },
314
313
  ], srcDirectory);
315
314
  }
316
- function generateAllComponentModule(components, outputTarget) {
317
- const childComponent = Object.values(outputTarget.componentGroups || {})
318
- .flat()
319
- .map(o => o.components)
320
- .flat();
321
- const moduleImports = components
322
- .map(c => c.tagName)
323
- .filter(c => !childComponent.includes(c))
324
- .map(c => ` ${dashToPascalCase(c)}Module,`);
325
- return `/* tslint:disable */
326
- /* auto-generated angular directive proxies */
327
- import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
328
- import {
329
- ${moduleImports.join('\n')}
330
- } from './proxies'
331
-
332
- const modules = [
333
- ${moduleImports.join('\n')}
334
- ]
335
-
336
- @NgModule({
337
- imports: [...modules],
338
- exports: [...modules],
339
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
340
- })
341
- export class BalAllComponentModule {}
342
- `;
343
- }
344
315
  function generateProxies(components, pkgData, outputTarget, rootDir) {
345
316
  const distTypesDir = path.dirname(pkgData.types);
346
317
  const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
@@ -348,6 +319,7 @@ function generateProxies(components, pkgData, outputTarget, rootDir) {
348
319
  const imports = `/* tslint:disable */
349
320
  /* auto-generated angular directive proxies */
350
321
  import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, NgZone, EventEmitter, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
322
+ import { CommonModule } from '@angular/common';
351
323
  import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
352
324
  const componentImports = components.map(c => `import { defineCustomElement as define${dashToPascalCase(c.tagName)} } from '${normalizePath(outputTarget.componentCorePackage || '')}/dist/components/${c.tagName}';`);
353
325
  const typeImports = !outputTarget.componentCorePackage
@@ -1,5 +1,4 @@
1
1
  import type { CompilerCtx, ComponentCompilerMeta, Config } from '@stencil/core/internal';
2
2
  import type { OutputTargetAngular, PackageJSON } from './types';
3
3
  export declare function angularDirectiveProxyOutput(compilerCtx: CompilerCtx, outputTarget: OutputTargetAngular, components: ComponentCompilerMeta[], config: Config): Promise<void>;
4
- export declare function generateAllComponentModule(components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular): string;
5
4
  export declare function generateProxies(components: ComponentCompilerMeta[], pkgData: PackageJSON, outputTarget: OutputTargetAngular, rootDir: string): string;
@@ -9,10 +9,8 @@ export async function angularDirectiveProxyOutput(compilerCtx, outputTarget, com
9
9
  const rootDir = config.rootDir;
10
10
  const pkgData = await readPackageJson(rootDir);
11
11
  const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
12
- const allComponentModule = generateAllComponentModule(filteredComponents, outputTarget);
13
12
  await Promise.all([
14
13
  compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
15
- compilerCtx.fs.writeFile(outputTarget.directivesProxyFile.replace('.ts', '.module.ts'), allComponentModule),
16
14
  copyResources(config, outputTarget),
17
15
  generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
18
16
  generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
@@ -36,34 +34,6 @@ async function copyResources(config, outputTarget) {
36
34
  },
37
35
  ], srcDirectory);
38
36
  }
39
- export function generateAllComponentModule(components, outputTarget) {
40
- const childComponent = Object.values(outputTarget.componentGroups || {})
41
- .flat()
42
- .map(o => o.components)
43
- .flat();
44
- const moduleImports = components
45
- .map(c => c.tagName)
46
- .filter(c => !childComponent.includes(c))
47
- .map(c => ` ${dashToPascalCase(c)}Module,`);
48
- return `/* tslint:disable */
49
- /* auto-generated angular directive proxies */
50
- import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
51
- import {
52
- ${moduleImports.join('\n')}
53
- } from './proxies'
54
-
55
- const modules = [
56
- ${moduleImports.join('\n')}
57
- ]
58
-
59
- @NgModule({
60
- imports: [...modules],
61
- exports: [...modules],
62
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
63
- })
64
- export class BalAllComponentModule {}
65
- `;
66
- }
67
37
  export function generateProxies(components, pkgData, outputTarget, rootDir) {
68
38
  const distTypesDir = path.dirname(pkgData.types);
69
39
  const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
@@ -71,6 +41,7 @@ export function generateProxies(components, pkgData, outputTarget, rootDir) {
71
41
  const imports = `/* tslint:disable */
72
42
  /* auto-generated angular directive proxies */
73
43
  import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, NgZone, EventEmitter, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
44
+ import { CommonModule } from '@angular/common';
74
45
  import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
75
46
  const componentImports = components.map(c => `import { defineCustomElement as define${dashToPascalCase(c.tagName)} } from '${normalizePath(outputTarget.componentCorePackage || '')}/dist/components/${c.tagName}';`);
76
47
  const typeImports = !outputTarget.componentCorePackage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baloise/angular-output-target",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Angular output target for @stencil/core components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -61,5 +61,5 @@
61
61
  ],
62
62
  "testURL": "http://localhost"
63
63
  },
64
- "gitHead": "6074bb9ab1b327fafca6ad13c5bc07366f7d27f2"
64
+ "gitHead": "63f0fcb394011881616c2cf16c65d07279fe9c1f"
65
65
  }