@stencil/angular-output-target 0.6.1-dev.11648223327.1e097920 → 0.6.1-dev.11650990404.1c4facf3
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 +23 -23
- package/dist/index.js +4 -4
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -53,18 +53,18 @@ function normalizePath(str) {
|
|
|
53
53
|
return str;
|
|
54
54
|
}
|
|
55
55
|
function relativeImport(pathFrom, pathTo, ext) {
|
|
56
|
-
let relativePath = path__default[
|
|
56
|
+
let relativePath = path__default['default'].relative(path__default['default'].dirname(pathFrom), path__default['default'].dirname(pathTo));
|
|
57
57
|
if (relativePath === '') {
|
|
58
58
|
relativePath = '.';
|
|
59
59
|
}
|
|
60
60
|
else if (relativePath[0] !== '.') {
|
|
61
61
|
relativePath = './' + relativePath;
|
|
62
62
|
}
|
|
63
|
-
return normalizePath(`${relativePath}/${path__default[
|
|
63
|
+
return normalizePath(`${relativePath}/${path__default['default'].basename(pathTo, ext)}`);
|
|
64
64
|
}
|
|
65
65
|
async function readPackageJson(config, rootDir) {
|
|
66
66
|
var _a;
|
|
67
|
-
const pkgJsonPath = path__default[
|
|
67
|
+
const pkgJsonPath = path__default['default'].join(rootDir, 'package.json');
|
|
68
68
|
let pkgJson;
|
|
69
69
|
try {
|
|
70
70
|
pkgJson = (await ((_a = config.sys) === null || _a === void 0 ? void 0 : _a.readFile(pkgJsonPath, 'utf8')));
|
|
@@ -211,7 +211,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
211
211
|
outputTarget.valueAccessorConfigs.length === 0) {
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
|
-
const targetDir = path__default[
|
|
214
|
+
const targetDir = path__default['default'].dirname(outputTarget.directivesProxyFile);
|
|
215
215
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
|
216
216
|
const elementSelectors = Array.isArray(va.elementSelectors)
|
|
217
217
|
? va.elementSelectors
|
|
@@ -231,13 +231,13 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
231
231
|
await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
|
|
232
232
|
const valueAccessorType = type; // Object.keys converts to string
|
|
233
233
|
const targetFileName = `${type}-value-accessor.ts`;
|
|
234
|
-
const targetFilePath = path__default[
|
|
235
|
-
const srcFilePath = path__default[
|
|
234
|
+
const targetFilePath = path__default['default'].join(targetDir, targetFileName);
|
|
235
|
+
const srcFilePath = path__default['default'].join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
236
236
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
237
237
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
238
238
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
239
239
|
}));
|
|
240
|
-
await copyResources
|
|
240
|
+
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
241
241
|
}
|
|
242
242
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
243
243
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
@@ -245,19 +245,19 @@ function createValueAccessor(srcFileContents, valueAccessor) {
|
|
|
245
245
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
246
246
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`));
|
|
247
247
|
}
|
|
248
|
-
function copyResources
|
|
248
|
+
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
249
249
|
if (!config.sys || !config.sys.copy) {
|
|
250
250
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
|
251
251
|
}
|
|
252
252
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
253
253
|
return {
|
|
254
|
-
src: path__default[
|
|
255
|
-
dest: path__default[
|
|
254
|
+
src: path__default['default'].join(__dirname, '../resources/control-value-accessors/', rf),
|
|
255
|
+
dest: path__default['default'].join(directory, rf),
|
|
256
256
|
keepDirStructure: false,
|
|
257
257
|
warn: false,
|
|
258
258
|
};
|
|
259
259
|
});
|
|
260
|
-
return config.sys.copy(copyTasks, path__default[
|
|
260
|
+
return config.sys.copy(copyTasks, path__default['default'].join(directory));
|
|
261
261
|
}
|
|
262
262
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
263
263
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
@@ -271,7 +271,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
271
271
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
272
272
|
await Promise.all([
|
|
273
273
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
274
|
-
copyResources(config, outputTarget),
|
|
274
|
+
copyResources$1(config, outputTarget),
|
|
275
275
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
276
276
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
277
277
|
]);
|
|
@@ -279,12 +279,12 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
279
279
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
280
280
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
281
281
|
}
|
|
282
|
-
async function copyResources(config, outputTarget) {
|
|
282
|
+
async function copyResources$1(config, outputTarget) {
|
|
283
283
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
284
284
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
285
285
|
}
|
|
286
|
-
const srcDirectory = path__default[
|
|
287
|
-
const destDirectory = path__default[
|
|
286
|
+
const srcDirectory = path__default['default'].join(__dirname, '..', 'angular-component-lib');
|
|
287
|
+
const destDirectory = path__default['default'].join(path__default['default'].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
288
288
|
return config.sys.copy([
|
|
289
289
|
{
|
|
290
290
|
src: srcDirectory,
|
|
@@ -295,8 +295,8 @@ async function copyResources(config, outputTarget) {
|
|
|
295
295
|
], srcDirectory);
|
|
296
296
|
}
|
|
297
297
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
298
|
-
const distTypesDir = path__default[
|
|
299
|
-
const dtsFilePath = path__default[
|
|
298
|
+
const distTypesDir = path__default['default'].dirname(pkgData.types);
|
|
299
|
+
const dtsFilePath = path__default['default'].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
300
300
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
301
301
|
const imports = `/* tslint:disable */
|
|
302
302
|
/* auto-generated angular directive proxies */
|
|
@@ -362,14 +362,14 @@ function normalizeOutputTarget(config, outputTarget) {
|
|
|
362
362
|
if (outputTarget.directivesProxyFile == null) {
|
|
363
363
|
throw new Error('directivesProxyFile is required');
|
|
364
364
|
}
|
|
365
|
-
if (outputTarget.directivesProxyFile && !path__default[
|
|
366
|
-
results.directivesProxyFile = normalizePath(path__default[
|
|
365
|
+
if (outputTarget.directivesProxyFile && !path__default['default'].isAbsolute(outputTarget.directivesProxyFile)) {
|
|
366
|
+
results.directivesProxyFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesProxyFile));
|
|
367
367
|
}
|
|
368
|
-
if (outputTarget.directivesArrayFile && !path__default[
|
|
369
|
-
results.directivesArrayFile = normalizePath(path__default[
|
|
368
|
+
if (outputTarget.directivesArrayFile && !path__default['default'].isAbsolute(outputTarget.directivesArrayFile)) {
|
|
369
|
+
results.directivesArrayFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesArrayFile));
|
|
370
370
|
}
|
|
371
|
-
if (outputTarget.directivesUtilsFile && !path__default[
|
|
372
|
-
results.directivesUtilsFile = normalizePath(path__default[
|
|
371
|
+
if (outputTarget.directivesUtilsFile && !path__default['default'].isAbsolute(outputTarget.directivesUtilsFile)) {
|
|
372
|
+
results.directivesUtilsFile = normalizePath(path__default['default'].join(config.rootDir, outputTarget.directivesUtilsFile));
|
|
373
373
|
}
|
|
374
374
|
return results;
|
|
375
375
|
}
|
package/dist/index.js
CHANGED
|
@@ -229,7 +229,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
229
229
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
230
230
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
231
231
|
}));
|
|
232
|
-
await copyResources
|
|
232
|
+
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
233
233
|
}
|
|
234
234
|
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
235
235
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
@@ -237,7 +237,7 @@ function createValueAccessor(srcFileContents, valueAccessor) {
|
|
|
237
237
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
238
238
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`));
|
|
239
239
|
}
|
|
240
|
-
function copyResources
|
|
240
|
+
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
241
241
|
if (!config.sys || !config.sys.copy) {
|
|
242
242
|
throw new Error('stencil is not properly intialized at this step. Notify the developer');
|
|
243
243
|
}
|
|
@@ -263,7 +263,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
263
263
|
const finalText = generateProxies(filteredComponents, pkgData, outputTarget, config.rootDir);
|
|
264
264
|
await Promise.all([
|
|
265
265
|
compilerCtx.fs.writeFile(outputTarget.directivesProxyFile, finalText),
|
|
266
|
-
copyResources(config, outputTarget),
|
|
266
|
+
copyResources$1(config, outputTarget),
|
|
267
267
|
generateAngularDirectivesFile(compilerCtx, filteredComponents, outputTarget),
|
|
268
268
|
generateValueAccessors(compilerCtx, filteredComponents, outputTarget, config),
|
|
269
269
|
]);
|
|
@@ -271,7 +271,7 @@ async function angularDirectiveProxyOutput(compilerCtx, outputTarget, components
|
|
|
271
271
|
function getFilteredComponents(excludeComponents = [], cmps) {
|
|
272
272
|
return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal);
|
|
273
273
|
}
|
|
274
|
-
async function copyResources(config, outputTarget) {
|
|
274
|
+
async function copyResources$1(config, outputTarget) {
|
|
275
275
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
276
276
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
277
277
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.6.1-dev.
|
|
3
|
+
"version": "0.6.1-dev.11650990404.1c4facf3",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
],
|
|
56
56
|
"testURL": "http://localhost"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c4facf34607b1500dd33dd5c5d1ba5685edd90d4"
|
|
59
59
|
}
|