@stencil/angular-output-target
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -142,2 +142,6 @@ import { createComponentEventTypeImports, dashToPascalCase, formatToQuotedList } from './utils'; | ||
return [p1, dst, p2].join(''); | ||
}) | ||
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`. | ||
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => { | ||
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`; | ||
})); | ||
@@ -144,0 +148,0 @@ }, event.complexType.original |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var path = require('path'); | ||
var os = require('os'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
const OutputTypes = { | ||
@@ -55,3 +61,3 @@ Component: 'component', | ||
function relativeImport(pathFrom, pathTo, ext) { | ||
let relativePath = path.relative(path.dirname(pathFrom), path.dirname(pathTo)); | ||
let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo)); | ||
if (relativePath === '') { | ||
@@ -63,7 +69,7 @@ relativePath = '.'; | ||
} | ||
return normalizePath(`${relativePath}/${path.basename(pathTo, ext)}`); | ||
return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`); | ||
} | ||
async function readPackageJson(config, rootDir) { | ||
var _a; | ||
const pkgJsonPath = path.join(rootDir, 'package.json'); | ||
const pkgJsonPath = path__default["default"].join(rootDir, 'package.json'); | ||
let pkgJson; | ||
@@ -283,2 +289,6 @@ try { | ||
return [p1, dst, p2].join(''); | ||
}) | ||
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`. | ||
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => { | ||
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`; | ||
})); | ||
@@ -354,3 +364,3 @@ }, event.complexType.original | ||
} | ||
const targetDir = path.dirname(outputTarget.directivesProxyFile); | ||
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile); | ||
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => { | ||
@@ -373,4 +383,4 @@ const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors]; | ||
const targetFileName = `${type}-value-accessor.ts`; | ||
const targetFilePath = path.join(targetDir, targetFileName); | ||
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName); | ||
const targetFilePath = path__default["default"].join(targetDir, targetFileName); | ||
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName); | ||
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath); | ||
@@ -395,4 +405,4 @@ const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType); | ||
return { | ||
src: path.join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path.join(directory, rf), | ||
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path__default["default"].join(directory, rf), | ||
keepDirStructure: false, | ||
@@ -403,3 +413,3 @@ warn: false, | ||
}); | ||
return config.sys.copy(copyTasks, path.join(directory)); | ||
return config.sys.copy(copyTasks, path__default["default"].join(directory)); | ||
} | ||
@@ -448,4 +458,4 @@ const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`; | ||
} | ||
const srcDirectory = path.join(__dirname, '..', 'angular-component-lib'); | ||
const destDirectory = path.join(path.dirname(outputTarget.directivesProxyFile), 'angular-component-lib'); | ||
const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib'); | ||
const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib'); | ||
return config.sys.copy([ | ||
@@ -462,4 +472,4 @@ { | ||
function generateProxies(components, pkgData, outputTarget, rootDir) { | ||
const distTypesDir = path.dirname(pkgData.types); | ||
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS); | ||
const distTypesDir = path__default["default"].dirname(pkgData.types); | ||
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS); | ||
const { outputType } = outputTarget; | ||
@@ -590,7 +600,7 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts'); | ||
} | ||
if (outputTarget.directivesProxyFile && !path.isAbsolute(outputTarget.directivesProxyFile)) { | ||
results.directivesProxyFile = normalizePath(path.join(config.rootDir, outputTarget.directivesProxyFile)); | ||
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) { | ||
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile)); | ||
} | ||
if (outputTarget.directivesArrayFile && !path.isAbsolute(outputTarget.directivesArrayFile)) { | ||
results.directivesArrayFile = normalizePath(path.join(config.rootDir, outputTarget.directivesArrayFile)); | ||
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) { | ||
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile)); | ||
} | ||
@@ -597,0 +607,0 @@ if (outputTarget.includeSingleComponentAngularModules !== undefined) { |
@@ -279,2 +279,6 @@ import path from 'path'; | ||
return [p1, dst, p2].join(''); | ||
}) | ||
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`. | ||
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => { | ||
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`; | ||
})); | ||
@@ -281,0 +285,0 @@ }, event.complexType.original |
{ | ||
"name": "@stencil/angular-output-target", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Angular output target for @stencil/core components.", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.cjs.js", | ||
"prepublishOnly": "pnpm run build", | ||
"prebuild": "rimraf ./dist && pnpm run test", | ||
"prebuild": "rimraf ./dist", | ||
"build": "tsc && pnpm run rollup", | ||
@@ -28,0 +28,0 @@ "dev": "run-p dev:*", |
110642
2129