@stencil/angular-output-target 0.10.1 → 0.10.2

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.
@@ -139,6 +139,10 @@ const formatOutputType = (componentClassName, event) => {
139
139
  return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
140
140
  }
141
141
  return [p1, dst, p2].join('');
142
+ })
143
+ // Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
144
+ .replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
145
+ return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
142
146
  }));
143
147
  }, event.complexType.original
144
148
  .replace(/\n/g, ' ')
package/dist/index.cjs.js CHANGED
@@ -1,8 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var path = require('path');
4
6
  var os = require('os');
5
7
 
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
11
+
6
12
  const OutputTypes = {
7
13
  Component: 'component',
8
14
  Scam: 'scam',
@@ -52,18 +58,18 @@ function normalizePath(str) {
52
58
  return str;
53
59
  }
54
60
  function relativeImport(pathFrom, pathTo, ext) {
55
- let relativePath = path.relative(path.dirname(pathFrom), path.dirname(pathTo));
61
+ let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo));
56
62
  if (relativePath === '') {
57
63
  relativePath = '.';
58
64
  }
59
65
  else if (relativePath[0] !== '.') {
60
66
  relativePath = './' + relativePath;
61
67
  }
62
- return normalizePath(`${relativePath}/${path.basename(pathTo, ext)}`);
68
+ return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`);
63
69
  }
64
70
  async function readPackageJson(config, rootDir) {
65
71
  var _a;
66
- const pkgJsonPath = path.join(rootDir, 'package.json');
72
+ const pkgJsonPath = path__default["default"].join(rootDir, 'package.json');
67
73
  let pkgJson;
68
74
  try {
69
75
  pkgJson = (await ((_a = config.sys) === null || _a === void 0 ? void 0 : _a.readFile(pkgJsonPath, 'utf8')));
@@ -278,6 +284,10 @@ const formatOutputType = (componentClassName, event) => {
278
284
  return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
279
285
  }
280
286
  return [p1, dst, p2].join('');
287
+ })
288
+ // Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
289
+ .replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
290
+ return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
281
291
  }));
282
292
  }, event.complexType.original
283
293
  .replace(/\n/g, ' ')
@@ -348,7 +358,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
348
358
  if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
349
359
  return;
350
360
  }
351
- const targetDir = path.dirname(outputTarget.directivesProxyFile);
361
+ const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile);
352
362
  const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
353
363
  const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
354
364
  const type = va.type;
@@ -366,8 +376,8 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
366
376
  await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
367
377
  const valueAccessorType = type; // Object.keys converts to string
368
378
  const targetFileName = `${type}-value-accessor.ts`;
369
- const targetFilePath = path.join(targetDir, targetFileName);
370
- const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
379
+ const targetFilePath = path__default["default"].join(targetDir, targetFileName);
380
+ const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName);
371
381
  const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
372
382
  const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
373
383
  await compilerCtx.fs.writeFile(targetFilePath, finalText);
@@ -387,14 +397,14 @@ function copyResources$1(config, resourcesFilesToCopy, directory) {
387
397
  }
388
398
  const copyTasks = resourcesFilesToCopy.map((rf) => {
389
399
  return {
390
- src: path.join(__dirname, '../resources/control-value-accessors/', rf),
391
- dest: path.join(directory, rf),
400
+ src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf),
401
+ dest: path__default["default"].join(directory, rf),
392
402
  keepDirStructure: false,
393
403
  warn: false,
394
404
  ignore: [],
395
405
  };
396
406
  });
397
- return config.sys.copy(copyTasks, path.join(directory));
407
+ return config.sys.copy(copyTasks, path__default["default"].join(directory));
398
408
  }
399
409
  const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
400
410
  const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
@@ -438,8 +448,8 @@ async function copyResources(config, outputTarget) {
438
448
  if (!config.sys || !config.sys.copy || !config.sys.glob) {
439
449
  throw new Error('stencil is not properly initialized at this step. Notify the developer');
440
450
  }
441
- const srcDirectory = path.join(__dirname, '..', 'angular-component-lib');
442
- const destDirectory = path.join(path.dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
451
+ const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib');
452
+ const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
443
453
  return config.sys.copy([
444
454
  {
445
455
  src: srcDirectory,
@@ -451,8 +461,8 @@ async function copyResources(config, outputTarget) {
451
461
  ], srcDirectory);
452
462
  }
453
463
  function generateProxies(components, pkgData, outputTarget, rootDir) {
454
- const distTypesDir = path.dirname(pkgData.types);
455
- const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
464
+ const distTypesDir = path__default["default"].dirname(pkgData.types);
465
+ const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS);
456
466
  const { outputType } = outputTarget;
457
467
  const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
458
468
  const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
@@ -578,11 +588,11 @@ function normalizeOutputTarget(config, outputTarget) {
578
588
  if (outputTarget.directivesProxyFile == null) {
579
589
  throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
580
590
  }
581
- if (outputTarget.directivesProxyFile && !path.isAbsolute(outputTarget.directivesProxyFile)) {
582
- results.directivesProxyFile = normalizePath(path.join(config.rootDir, outputTarget.directivesProxyFile));
591
+ if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) {
592
+ results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile));
583
593
  }
584
- if (outputTarget.directivesArrayFile && !path.isAbsolute(outputTarget.directivesArrayFile)) {
585
- results.directivesArrayFile = normalizePath(path.join(config.rootDir, outputTarget.directivesArrayFile));
594
+ if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) {
595
+ results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile));
586
596
  }
587
597
  if (outputTarget.includeSingleComponentAngularModules !== undefined) {
588
598
  throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
package/dist/index.js CHANGED
@@ -276,6 +276,10 @@ const formatOutputType = (componentClassName, event) => {
276
276
  return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
277
277
  }
278
278
  return [p1, dst, p2].join('');
279
+ })
280
+ // Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
281
+ .replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
282
+ return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
279
283
  }));
280
284
  }, event.complexType.original
281
285
  .replace(/\n/g, ' ')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/angular-output-target",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Angular output target for @stencil/core components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "scripts": {
24
24
  "prepublishOnly": "pnpm run build",
25
- "prebuild": "rimraf ./dist && pnpm run test",
25
+ "prebuild": "rimraf ./dist",
26
26
  "build": "tsc && pnpm run rollup",
27
27
  "dev": "run-p dev:*",
28
28
  "dev:build": "tsc --watch --preserveWatchOutput",