@stencil/angular-output-target 0.0.1-dev.11734586318.14947a27 → 0.0.1-dev.11735332610.1971f219
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 +17 -23
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var path = require('path');
|
|
6
4
|
var os = require('os');
|
|
7
5
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
11
|
-
|
|
12
6
|
const OutputTypes = {
|
|
13
7
|
Component: 'component',
|
|
14
8
|
Scam: 'scam',
|
|
@@ -58,18 +52,18 @@ function normalizePath(str) {
|
|
|
58
52
|
return str;
|
|
59
53
|
}
|
|
60
54
|
function relativeImport(pathFrom, pathTo, ext) {
|
|
61
|
-
let relativePath =
|
|
55
|
+
let relativePath = path.relative(path.dirname(pathFrom), path.dirname(pathTo));
|
|
62
56
|
if (relativePath === '') {
|
|
63
57
|
relativePath = '.';
|
|
64
58
|
}
|
|
65
59
|
else if (relativePath[0] !== '.') {
|
|
66
60
|
relativePath = './' + relativePath;
|
|
67
61
|
}
|
|
68
|
-
return normalizePath(`${relativePath}/${
|
|
62
|
+
return normalizePath(`${relativePath}/${path.basename(pathTo, ext)}`);
|
|
69
63
|
}
|
|
70
64
|
async function readPackageJson(config, rootDir) {
|
|
71
65
|
var _a;
|
|
72
|
-
const pkgJsonPath =
|
|
66
|
+
const pkgJsonPath = path.join(rootDir, 'package.json');
|
|
73
67
|
let pkgJson;
|
|
74
68
|
try {
|
|
75
69
|
pkgJson = (await ((_a = config.sys) === null || _a === void 0 ? void 0 : _a.readFile(pkgJsonPath, 'utf8')));
|
|
@@ -358,7 +352,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
358
352
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
359
353
|
return;
|
|
360
354
|
}
|
|
361
|
-
const targetDir =
|
|
355
|
+
const targetDir = path.dirname(outputTarget.directivesProxyFile);
|
|
362
356
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
|
363
357
|
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
|
364
358
|
const type = va.type;
|
|
@@ -376,8 +370,8 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
376
370
|
await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
|
|
377
371
|
const valueAccessorType = type; // Object.keys converts to string
|
|
378
372
|
const targetFileName = `${type}-value-accessor.ts`;
|
|
379
|
-
const targetFilePath =
|
|
380
|
-
const srcFilePath =
|
|
373
|
+
const targetFilePath = path.join(targetDir, targetFileName);
|
|
374
|
+
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
381
375
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
382
376
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
383
377
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
@@ -397,14 +391,14 @@ function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
|
397
391
|
}
|
|
398
392
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
399
393
|
return {
|
|
400
|
-
src:
|
|
401
|
-
dest:
|
|
394
|
+
src: path.join(__dirname, '../resources/control-value-accessors/', rf),
|
|
395
|
+
dest: path.join(directory, rf),
|
|
402
396
|
keepDirStructure: false,
|
|
403
397
|
warn: false,
|
|
404
398
|
ignore: [],
|
|
405
399
|
};
|
|
406
400
|
});
|
|
407
|
-
return config.sys.copy(copyTasks,
|
|
401
|
+
return config.sys.copy(copyTasks, path.join(directory));
|
|
408
402
|
}
|
|
409
403
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
410
404
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
@@ -448,8 +442,8 @@ async function copyResources(config, outputTarget) {
|
|
|
448
442
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
449
443
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
450
444
|
}
|
|
451
|
-
const srcDirectory =
|
|
452
|
-
const destDirectory =
|
|
445
|
+
const srcDirectory = path.join(__dirname, '..', 'angular-component-lib');
|
|
446
|
+
const destDirectory = path.join(path.dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
453
447
|
return config.sys.copy([
|
|
454
448
|
{
|
|
455
449
|
src: srcDirectory,
|
|
@@ -461,8 +455,8 @@ async function copyResources(config, outputTarget) {
|
|
|
461
455
|
], srcDirectory);
|
|
462
456
|
}
|
|
463
457
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
464
|
-
const distTypesDir =
|
|
465
|
-
const dtsFilePath =
|
|
458
|
+
const distTypesDir = path.dirname(pkgData.types);
|
|
459
|
+
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS);
|
|
466
460
|
const { outputType } = outputTarget;
|
|
467
461
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
468
462
|
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
@@ -588,11 +582,11 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
588
582
|
if (outputTarget.directivesProxyFile == null) {
|
|
589
583
|
throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
|
|
590
584
|
}
|
|
591
|
-
if (outputTarget.directivesProxyFile && !
|
|
592
|
-
results.directivesProxyFile = normalizePath(
|
|
585
|
+
if (outputTarget.directivesProxyFile && !path.isAbsolute(outputTarget.directivesProxyFile)) {
|
|
586
|
+
results.directivesProxyFile = normalizePath(path.join(config.rootDir, outputTarget.directivesProxyFile));
|
|
593
587
|
}
|
|
594
|
-
if (outputTarget.directivesArrayFile && !
|
|
595
|
-
results.directivesArrayFile = normalizePath(
|
|
588
|
+
if (outputTarget.directivesArrayFile && !path.isAbsolute(outputTarget.directivesArrayFile)) {
|
|
589
|
+
results.directivesArrayFile = normalizePath(path.join(config.rootDir, outputTarget.directivesArrayFile));
|
|
596
590
|
}
|
|
597
591
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
598
592
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.11735332610.1971f219",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@stencil/core": ">=2.0.0 || >=3 || >= 4.0.0-beta.0 || >= 4.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "971f219ebe92260d416e7da4af036715b8009e9f"
|
|
64
64
|
}
|