@stencil/angular-output-target
Advanced tools
Comparing version 0.0.1-dev.11730928290.1699ee88 to 0.0.1-dev.11734409046.189fd148
@@ -7,5 +7,6 @@ import { createComponentEventTypeImports, dashToPascalCase, formatToQuotedList } from './utils'; | ||
* @param type The name of the type (e.g. 'string') | ||
* @param inlinePropertyAsSetter Inlines the entire property as an empty Setter, to aid Angulars Compilerp | ||
* @returns The property declaration as a string. | ||
*/ | ||
function createPropertyDeclaration(prop, type) { | ||
function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) { | ||
const comment = createDocComment(prop.docs); | ||
@@ -18,4 +19,10 @@ let eventName = prop.name; | ||
} | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
if (inlinePropertyAsSetter) { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
set ${eventName}(_: ${type}) {};`; | ||
} | ||
else { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
${eventName}: ${type};`; | ||
} | ||
} | ||
@@ -60,4 +67,4 @@ /** | ||
} | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`)); | ||
const propertiesDeclarationText = ['protected el: HTMLElement;', ...propertyDeclarations].join('\n '); | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true)); | ||
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n '); | ||
/** | ||
@@ -64,0 +71,0 @@ * Notes on the generated output: |
@@ -46,6 +46,5 @@ import { EOL } from 'os'; | ||
const copyTasks = resourcesFilesToCopy.map((rf) => { | ||
const dest = path.resolve(directory, rf); | ||
return { | ||
src: path.join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path.extname(dest) ? path.dirname(dest) : dest, | ||
dest: path.join(directory, rf), | ||
keepDirStructure: false, | ||
@@ -52,0 +51,0 @@ warn: false, |
'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 = { | ||
@@ -61,3 +55,3 @@ Component: 'component', | ||
function relativeImport(pathFrom, pathTo, ext) { | ||
let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo)); | ||
let relativePath = path.relative(path.dirname(pathFrom), path.dirname(pathTo)); | ||
if (relativePath === '') { | ||
@@ -69,7 +63,7 @@ relativePath = '.'; | ||
} | ||
return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`); | ||
return normalizePath(`${relativePath}/${path.basename(pathTo, ext)}`); | ||
} | ||
async function readPackageJson(config, rootDir) { | ||
var _a; | ||
const pkgJsonPath = path__default["default"].join(rootDir, 'package.json'); | ||
const pkgJsonPath = path.join(rootDir, 'package.json'); | ||
let pkgJson; | ||
@@ -154,5 +148,6 @@ try { | ||
* @param type The name of the type (e.g. 'string') | ||
* @param inlinePropertyAsSetter Inlines the entire property as an empty Setter, to aid Angulars Compilerp | ||
* @returns The property declaration as a string. | ||
*/ | ||
function createPropertyDeclaration(prop, type) { | ||
function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) { | ||
const comment = createDocComment(prop.docs); | ||
@@ -165,4 +160,10 @@ let eventName = prop.name; | ||
} | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
if (inlinePropertyAsSetter) { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
set ${eventName}(_: ${type}) {};`; | ||
} | ||
else { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
${eventName}: ${type};`; | ||
} | ||
} | ||
@@ -207,4 +208,4 @@ /** | ||
} | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`)); | ||
const propertiesDeclarationText = ['protected el: HTMLElement;', ...propertyDeclarations].join('\n '); | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true)); | ||
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n '); | ||
/** | ||
@@ -355,3 +356,3 @@ * Notes on the generated output: | ||
} | ||
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile); | ||
const targetDir = path.dirname(outputTarget.directivesProxyFile); | ||
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => { | ||
@@ -374,4 +375,4 @@ const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors]; | ||
const targetFileName = `${type}-value-accessor.ts`; | ||
const targetFilePath = path__default["default"].join(targetDir, targetFileName); | ||
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName); | ||
const targetFilePath = path.join(targetDir, targetFileName); | ||
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName); | ||
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath); | ||
@@ -395,6 +396,5 @@ const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType); | ||
const copyTasks = resourcesFilesToCopy.map((rf) => { | ||
const dest = path__default["default"].resolve(directory, rf); | ||
return { | ||
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path__default["default"].extname(dest) ? path__default["default"].dirname(dest) : dest, | ||
src: path.join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path.join(directory, rf), | ||
keepDirStructure: false, | ||
@@ -405,3 +405,3 @@ warn: false, | ||
}); | ||
return config.sys.copy(copyTasks, path__default["default"].join(directory)); | ||
return config.sys.copy(copyTasks, path.join(directory)); | ||
} | ||
@@ -450,4 +450,4 @@ const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`; | ||
} | ||
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'); | ||
const srcDirectory = path.join(__dirname, '..', 'angular-component-lib'); | ||
const destDirectory = path.join(path.dirname(outputTarget.directivesProxyFile), 'angular-component-lib'); | ||
return config.sys.copy([ | ||
@@ -464,4 +464,4 @@ { | ||
function generateProxies(components, pkgData, outputTarget, rootDir) { | ||
const distTypesDir = path__default["default"].dirname(pkgData.types); | ||
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS); | ||
const distTypesDir = path.dirname(pkgData.types); | ||
const dtsFilePath = path.join(rootDir, distTypesDir, GENERATED_DTS); | ||
const { outputType } = outputTarget; | ||
@@ -592,7 +592,7 @@ const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts'); | ||
} | ||
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) { | ||
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile)); | ||
if (outputTarget.directivesProxyFile && !path.isAbsolute(outputTarget.directivesProxyFile)) { | ||
results.directivesProxyFile = normalizePath(path.join(config.rootDir, outputTarget.directivesProxyFile)); | ||
} | ||
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) { | ||
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile)); | ||
if (outputTarget.directivesArrayFile && !path.isAbsolute(outputTarget.directivesArrayFile)) { | ||
results.directivesArrayFile = normalizePath(path.join(config.rootDir, outputTarget.directivesArrayFile)); | ||
} | ||
@@ -599,0 +599,0 @@ if (outputTarget.includeSingleComponentAngularModules !== undefined) { |
@@ -144,5 +144,6 @@ import path from 'path'; | ||
* @param type The name of the type (e.g. 'string') | ||
* @param inlinePropertyAsSetter Inlines the entire property as an empty Setter, to aid Angulars Compilerp | ||
* @returns The property declaration as a string. | ||
*/ | ||
function createPropertyDeclaration(prop, type) { | ||
function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) { | ||
const comment = createDocComment(prop.docs); | ||
@@ -155,4 +156,10 @@ let eventName = prop.name; | ||
} | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
if (inlinePropertyAsSetter) { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
set ${eventName}(_: ${type}) {};`; | ||
} | ||
else { | ||
return `${comment.length > 0 ? ` ${comment}` : ''} | ||
${eventName}: ${type};`; | ||
} | ||
} | ||
@@ -197,4 +204,4 @@ /** | ||
} | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`)); | ||
const propertiesDeclarationText = ['protected el: HTMLElement;', ...propertyDeclarations].join('\n '); | ||
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true)); | ||
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n '); | ||
/** | ||
@@ -383,6 +390,5 @@ * Notes on the generated output: | ||
const copyTasks = resourcesFilesToCopy.map((rf) => { | ||
const dest = path.resolve(directory, rf); | ||
return { | ||
src: path.join(__dirname, '../resources/control-value-accessors/', rf), | ||
dest: path.extname(dest) ? path.dirname(dest) : dest, | ||
dest: path.join(directory, rf), | ||
keepDirStructure: false, | ||
@@ -389,0 +395,0 @@ warn: false, |
{ | ||
"name": "@stencil/angular-output-target", | ||
"version": "0.0.1-dev.11730928290.1699ee88", | ||
"version": "0.0.1-dev.11734409046.189fd148", | ||
"description": "Angular output target for @stencil/core components.", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs.js" | ||
} | ||
}, | ||
"types": "dist/index.d.ts", | ||
@@ -30,4 +37,4 @@ "files": [ | ||
"release": "np", | ||
"test": "jest --passWithNoTests", | ||
"test.watch": "jest --watch" | ||
"test": "vitest --run", | ||
"test.watch": "vitest" | ||
}, | ||
@@ -48,8 +55,7 @@ "repository": { | ||
"@types/node": "^18.0.0", | ||
"jest": "^27.0.0", | ||
"jest-environment-jsdom": "^27.0.0", | ||
"npm-run-all2": "^6.2.4", | ||
"rimraf": "^5.0.0", | ||
"rollup": "^2.23.1", | ||
"typescript": "~5.6.0" | ||
"typescript": "~5.7.0", | ||
"vitest": "^2.1.4" | ||
}, | ||
@@ -59,17 +65,3 @@ "peerDependencies": { | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.(js|ts|tsx)$": "<rootDir>/test/jest.preprocessor.js" | ||
}, | ||
"testRegex": "(\\.(test|spec))\\.(ts?|tsx?|jsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"json", | ||
"jsx" | ||
], | ||
"testURL": "http://localhost" | ||
}, | ||
"gitHead": "699ee88cb3dc0726b12a985c49a3875b9eb7745a" | ||
"gitHead": "89fd148dd07aef968f8806f1bc97cf0bffa5844d" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
2114
109197