@wixc3/codux-librarian
Advanced tools
Comparing version 0.7.0 to 0.8.0
#!/usr/bin/env node | ||
require('../dist/cli.js'); | ||
import '../dist/cli.js'; |
@@ -1,18 +0,13 @@ | ||
"use strict"; | ||
/* eslint-disable no-console */ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const node_1 = __importDefault(require("@file-services/node")); | ||
const commander_1 = require("commander"); | ||
const node_path_1 = require("node:path"); | ||
const constants_1 = require("./constants"); | ||
const index_1 = require("./index"); | ||
const read_config_1 = require("./read-config"); | ||
const create_terminal_link_1 = require("./utils/create-terminal-link"); | ||
const is_path_strictly_inside_directory_1 = require("./utils/is-path-strictly-inside-directory"); | ||
const to_error_1 = require("./utils/to-error"); | ||
const runtime_1 = require("./runtime"); | ||
const program = new commander_1.Command(); | ||
import { nodeFs as fs } from '@file-services/node'; | ||
import { Command } from 'commander'; | ||
import { join } from 'node:path'; | ||
import { readMeLink } from './constants.js'; | ||
import { LibraryBuilder } from './services/library-builder.js'; | ||
import { readConfig } from './read-config.js'; | ||
import { createTerminalLink } from './utils/create-terminal-link.js'; | ||
import { isPathStrictlyInsideDirectory } from './utils/is-path-strictly-inside-directory.js'; | ||
import { toError } from './utils/to-error.js'; | ||
import { TemplatesRuntime } from './runtime.js'; | ||
const program = new Command(); | ||
program.addHelpText('beforeAll', `codux-librarian is a CLI tool for packaging libraries of third-party boards | ||
@@ -26,5 +21,5 @@ into a format that can be consumed by the Add Panel in Codux. | ||
See the ${(0, create_terminal_link_1.createTerminalLink)('README', constants_1.readMeLink)} for additional information. | ||
See the ${createTerminalLink('README', readMeLink)} for additional information. | ||
`); | ||
program.version(node_1.default.readJsonFileSync((0, node_path_1.join)(__dirname, '../package.json')).version); | ||
program.version(fs.readJsonFileSync(join(__dirname, '../package.json')).version); | ||
program | ||
@@ -36,8 +31,8 @@ .command('build') | ||
try { | ||
const config = (0, read_config_1.readConfig)(args.config); | ||
const config = readConfig(args.config); | ||
const rootPath = process.cwd(); | ||
const shouldRemoveBuildDir = !config.manifestOnly | ||
? (0, is_path_strictly_inside_directory_1.isPathStrictlyInsideDirectory)(config.buildDir, rootPath) | ||
? isPathStrictlyInsideDirectory(config.buildDir, rootPath) | ||
: false; | ||
const packageBuilder = new index_1.LibraryBuilder({ config, shouldRemoveBuildDir, currentRoot: rootPath }, node_1.default); | ||
const packageBuilder = new LibraryBuilder({ config, shouldRemoveBuildDir, currentRoot: rootPath }, fs); | ||
const stats = await packageBuilder.build(); | ||
@@ -59,3 +54,3 @@ if ('errors' in stats) { | ||
catch (e) { | ||
console.error((0, to_error_1.toError)(e).message); | ||
console.error(toError(e).message); | ||
process.exit(1); | ||
@@ -72,5 +67,5 @@ } | ||
const rootPath = process.cwd(); | ||
const templatePath = (0, node_path_1.join)(rootPath, args.source); | ||
const destinationPath = (0, node_path_1.join)(rootPath, args.destination); | ||
const { warnings } = new runtime_1.TemplatesRuntime(node_1.default).copyTemplate(templatePath, destinationPath); | ||
const templatePath = join(rootPath, args.source); | ||
const destinationPath = join(rootPath, args.destination); | ||
const { warnings } = new TemplatesRuntime(fs).copyTemplate(templatePath, destinationPath); | ||
console.log(`Template "${args.source}" copied to "${args.destination}"`); | ||
@@ -85,3 +80,3 @@ if (warnings.length) { | ||
catch (e) { | ||
console.error((0, to_error_1.toError)(e).message); | ||
console.error(toError(e).message); | ||
process.exit(1); | ||
@@ -88,0 +83,0 @@ } |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readMeLink = exports.boardsDirectoryInPackage = exports.manifestFileVersion = exports.manifestFileName = void 0; | ||
exports.manifestFileName = 'codux.manifest.json'; | ||
exports.manifestFileVersion = 1; | ||
exports.boardsDirectoryInPackage = 'boards'; | ||
exports.readMeLink = 'https://github.com/wixplosives/codux-librarian/blob/master/README.md'; | ||
export const manifestFileName = 'codux.manifest.json'; | ||
export const manifestFileVersion = 1; | ||
export const boardsDirectoryInPackage = 'boards'; | ||
export const readMeLink = 'https://github.com/wixplosives/codux-librarian/blob/master/README.md'; | ||
//# sourceMappingURL=constants.js.map |
@@ -1,2 +0,2 @@ | ||
export * from './services/library-builder'; | ||
export * from './services/library-builder.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,18 +0,2 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./services/library-builder"), exports); | ||
export * from './services/library-builder.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
import type { LibrarianConfig } from './types'; | ||
import type { LibrarianConfig } from './types/index.js'; | ||
export declare function readConfig(pathToConfig: string): LibrarianConfig; | ||
//# sourceMappingURL=read-config.d.ts.map |
@@ -1,32 +0,26 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readConfig = readConfig; | ||
const node_1 = __importDefault(require("@file-services/node")); | ||
const node_path_1 = require("node:path"); | ||
const librarian_config_validator_1 = require("./services/librarian-config-validator"); | ||
import { nodeFs as fs } from '@file-services/node'; | ||
import { dirname, resolve } from 'node:path'; | ||
import { formatConfigValidatorError, LibrarianConfigValidator } from './services/librarian-config-validator.js'; | ||
function resolvePathsInConfig(config, configPath) { | ||
const resolved = { | ||
...config, | ||
boardsPath: (0, node_path_1.resolve)(configPath, config.boardsPath), | ||
libraryIcon: (0, node_path_1.resolve)(configPath, config.libraryIcon), | ||
boardsPath: resolve(configPath, config.boardsPath), | ||
libraryIcon: resolve(configPath, config.libraryIcon), | ||
}; | ||
if (!resolved.manifestOnly) { | ||
resolved.buildDir = (0, node_path_1.resolve)(configPath, resolved.buildDir); | ||
resolved.buildDir = resolve(configPath, resolved.buildDir); | ||
} | ||
return resolved; | ||
} | ||
function readConfig(pathToConfig) { | ||
const resolvedPathToConfig = (0, node_path_1.resolve)(pathToConfig); | ||
if (!node_1.default.existsSync(resolvedPathToConfig)) | ||
export function readConfig(pathToConfig) { | ||
const resolvedPathToConfig = resolve(pathToConfig); | ||
if (!fs.existsSync(resolvedPathToConfig)) | ||
throw new Error(`Config file doesn't exist at ${pathToConfig}`); | ||
const rawConfig = node_1.default.readJsonFileSync(resolvedPathToConfig); | ||
const result = librarian_config_validator_1.LibrarianConfigValidator.safeParse(rawConfig); | ||
const rawConfig = fs.readJsonFileSync(resolvedPathToConfig); | ||
const result = LibrarianConfigValidator.safeParse(rawConfig); | ||
if (result.success) { | ||
return resolvePathsInConfig(result.data, (0, node_path_1.dirname)(resolvedPathToConfig)); | ||
return resolvePathsInConfig(result.data, dirname(resolvedPathToConfig)); | ||
} | ||
throw new Error((0, librarian_config_validator_1.formatConfigValidatorError)(result.error)); | ||
throw new Error(formatConfigValidatorError(result.error)); | ||
} | ||
//# sourceMappingURL=read-config.js.map |
import { IFileSystem } from '@file-services/types'; | ||
import { PackageJson } from './types'; | ||
export { componentManifestValidator } from './services/component-file-validator'; | ||
import { PackageJson } from './types/index.js'; | ||
export { componentManifestValidator } from './services/component-file-validator.js'; | ||
export declare class TemplatesRuntime { | ||
@@ -5,0 +5,0 @@ private fs; |
@@ -1,9 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TemplatesRuntime = exports.componentManifestValidator = void 0; | ||
const common_1 = require("@wixc3/common"); | ||
const semver_1 = require("semver"); | ||
var component_file_validator_1 = require("./services/component-file-validator"); | ||
Object.defineProperty(exports, "componentManifestValidator", { enumerable: true, get: function () { return component_file_validator_1.componentManifestValidator; } }); | ||
class TemplatesRuntime { | ||
import { toKebabCase, toCamelCase, toPascalCase } from '@wixc3/common'; | ||
import { satisfies, coerce } from 'semver'; | ||
export { componentManifestValidator } from './services/component-file-validator.js'; | ||
export class TemplatesRuntime { | ||
fs; | ||
constructor(fs) { | ||
@@ -17,10 +14,10 @@ this.fs = fs; | ||
// source | ||
const sourceCamelCase = (0, common_1.toCamelCase)(sourceCompName); | ||
const sourcePascalCase = (0, common_1.toPascalCase)(sourceCompName); | ||
const sourceKebabCase = (0, common_1.toKebabCase)(sourceCompName); | ||
const sourceCamelCase = toCamelCase(sourceCompName); | ||
const sourcePascalCase = toPascalCase(sourceCompName); | ||
const sourceKebabCase = toKebabCase(sourceCompName); | ||
// target | ||
const targetCompNameInput = componentName || targetDirName; | ||
const targetCamelCase = (0, common_1.toCamelCase)(targetCompNameInput); | ||
const targetPascalCase = (0, common_1.toPascalCase)(targetCompNameInput); | ||
const targetKebabCase = (0, common_1.toKebabCase)(targetCompNameInput); | ||
const targetCamelCase = toCamelCase(targetCompNameInput); | ||
const targetPascalCase = toPascalCase(targetCompNameInput); | ||
const targetKebabCase = toKebabCase(targetCompNameInput); | ||
const warnings = []; | ||
@@ -84,3 +81,3 @@ const files = []; | ||
const projectDepVersion = projectPackageJson.dependencies?.[tplDep]; | ||
const normVersion = (0, semver_1.coerce)(projectDepVersion)?.version; | ||
const normVersion = coerce(projectDepVersion)?.version; | ||
if (!tplPeerDepVersionRange) { | ||
@@ -100,3 +97,3 @@ throw new Error(`Template dependency ${tplDep} is missing from the template's peerDependencies`); | ||
} | ||
else if ((0, semver_1.satisfies)(normVersion, tplPeerDepVersionRange)) { | ||
else if (satisfies(normVersion, tplPeerDepVersionRange)) { | ||
compatibleDeps.push(tplDep); | ||
@@ -127,3 +124,2 @@ } | ||
} | ||
exports.TemplatesRuntime = TemplatesRuntime; | ||
function validateSourceName(sourceCompName) { | ||
@@ -133,3 +129,3 @@ if (!sourceCompName) { | ||
} | ||
if ((0, common_1.toKebabCase)(sourceCompName) !== sourceCompName) { | ||
if (toKebabCase(sourceCompName) !== sourceCompName) { | ||
throw new Error('Source component name must be kebab-case'); | ||
@@ -136,0 +132,0 @@ } |
import type { IFileSystem } from '@file-services/types'; | ||
import type { BoardDetails } from '../../types'; | ||
import type { BoardDetails } from '../../types/index.js'; | ||
export declare class BoardParser { | ||
@@ -4,0 +4,0 @@ private boardPath; |
@@ -1,15 +0,12 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BoardParser = void 0; | ||
const resolve_1 = require("@file-services/resolve"); | ||
const typescript_1 = __importDefault(require("typescript")); | ||
const ast_utils_1 = require("../../utils/ast-utils"); | ||
const image_file_to_data_url_1 = require("../../utils/image-file-to-data-url"); | ||
const board_parsing_error_1 = require("./board-parsing-error"); | ||
const parse_utils_1 = require("../../utils/parse-utils"); | ||
const ast_utils_2 = require("../../utils/ast-utils"); | ||
class BoardParser { | ||
import { createRequestResolver } from '@file-services/resolve'; | ||
import ts from 'typescript'; | ||
import { findIdentifierImportDeclaration, isPropertyAssignment } from '../../utils/ast-utils.js'; | ||
import { imageFileToDataUrl } from '../../utils/image-file-to-data-url.js'; | ||
import { BoardParsingError } from './board-parsing-error.js'; | ||
import { getImportedPackages } from '../../utils/parse-utils.js'; | ||
import { getSourceAST } from '../../utils/ast-utils.js'; | ||
export class BoardParser { | ||
boardPath; | ||
fs; | ||
resolve; | ||
constructor(boardPath, fs) { | ||
@@ -20,11 +17,11 @@ this.boardPath = boardPath; | ||
throw new Error('Board has to have .board.tsx extension'); | ||
this.resolve = (0, resolve_1.createRequestResolver)({ fs }); | ||
this.resolve = createRequestResolver({ fs }); | ||
} | ||
async parse() { | ||
const source = await (0, ast_utils_2.getSourceAST)(this.fs, this.boardPath); | ||
const importedPackages = (0, parse_utils_1.getImportedPackages)(source); | ||
const source = await getSourceAST(this.fs, this.boardPath); | ||
const importedPackages = getImportedPackages(source); | ||
const createBoardExpression = this.findCreateBoardExpression(source); | ||
const boardOptions = createBoardExpression.arguments[0]; | ||
if (!boardOptions || !typescript_1.default.isObjectLiteralExpression(boardOptions)) { | ||
throw new board_parsing_error_1.BoardParsingError('Create board function must have an object literal as first argument', this.boardPath); | ||
if (!boardOptions || !ts.isObjectLiteralExpression(boardOptions)) { | ||
throw new BoardParsingError('Create board function must have an object literal as first argument', this.boardPath); | ||
} | ||
@@ -34,3 +31,3 @@ let boardName; | ||
for (const prop of boardOptions.properties) { | ||
if (!(0, ast_utils_1.isPropertyAssignment)(prop) || !('text' in prop.name)) | ||
if (!isPropertyAssignment(prop) || !('text' in prop.name)) | ||
continue; | ||
@@ -46,3 +43,3 @@ const propName = prop.name.text; | ||
if (!boardName) | ||
throw new board_parsing_error_1.BoardParsingError('Board has no name', this.boardPath); | ||
throw new BoardParsingError('Board has no name', this.boardPath); | ||
return { | ||
@@ -56,7 +53,7 @@ name: boardName, | ||
parseName(prop) { | ||
if ('initializer' in prop && typescript_1.default.isStringLiteral(prop.initializer)) { | ||
if ('initializer' in prop && ts.isStringLiteral(prop.initializer)) { | ||
return prop.initializer.text; | ||
} | ||
else { | ||
throw new board_parsing_error_1.BoardParsingError('Board name has to be defined as a string literal', this.boardPath); | ||
throw new BoardParsingError('Board name has to be defined as a string literal', this.boardPath); | ||
} | ||
@@ -66,14 +63,14 @@ } | ||
let identifierToLookUp; | ||
if (typescript_1.default.isShorthandPropertyAssignment(prop)) { | ||
if (ts.isShorthandPropertyAssignment(prop)) { | ||
identifierToLookUp = prop.name.text; | ||
} | ||
else if (typescript_1.default.isPropertyAssignment(prop) && typescript_1.default.isIdentifier(prop.initializer)) { | ||
else if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.initializer)) { | ||
identifierToLookUp = prop.initializer.text; | ||
} | ||
else { | ||
throw new board_parsing_error_1.BoardParsingError('Unable to parse cover', this.boardPath); | ||
throw new BoardParsingError('Unable to parse cover', this.boardPath); | ||
} | ||
const importedCover = (0, ast_utils_1.findIdentifierImportDeclaration)(identifierToLookUp, source); | ||
const importedCover = findIdentifierImportDeclaration(identifierToLookUp, source); | ||
if (!importedCover) | ||
throw new board_parsing_error_1.BoardParsingError('Unable to parse cover. Cover has to be a direct image import', this.boardPath); | ||
throw new BoardParsingError('Unable to parse cover. Cover has to be a direct image import', this.boardPath); | ||
return importedCover.moduleSpecifier.text; | ||
@@ -84,12 +81,12 @@ } | ||
if (!resolvedFile) | ||
throw new board_parsing_error_1.BoardParsingError('Unable to locate cover file', this.boardPath); | ||
return (0, image_file_to_data_url_1.imageFileToDataUrl)(resolvedFile, this.fs); | ||
throw new BoardParsingError('Unable to locate cover file', this.boardPath); | ||
return imageFileToDataUrl(resolvedFile, this.fs); | ||
} | ||
findCreateBoardExpression(source) { | ||
for (const statement of source.statements) { | ||
if (!typescript_1.default.isExportAssignment(statement)) | ||
if (!ts.isExportAssignment(statement)) | ||
continue; | ||
const { expression } = statement; | ||
if (typescript_1.default.isCallExpression(expression) && | ||
typescript_1.default.isIdentifier(expression.expression) && | ||
if (ts.isCallExpression(expression) && | ||
ts.isIdentifier(expression.expression) && | ||
expression.expression.text === 'createBoard') { | ||
@@ -99,6 +96,5 @@ return expression; | ||
} | ||
throw new board_parsing_error_1.BoardParsingError('No exported board', this.boardPath); | ||
throw new BoardParsingError('No exported board', this.boardPath); | ||
} | ||
} | ||
exports.BoardParser = BoardParser; | ||
//# sourceMappingURL=board-parser.js.map |
@@ -1,9 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BoardParsingError = void 0; | ||
class BoardParsingError extends Error { | ||
export class BoardParsingError extends Error { | ||
boardPath; | ||
name = 'BoardParsingError'; | ||
constructor(message, boardPath) { | ||
super(message); | ||
this.boardPath = boardPath; | ||
this.name = 'BoardParsingError'; | ||
} | ||
@@ -14,3 +12,2 @@ toString() { | ||
} | ||
exports.BoardParsingError = BoardParsingError; | ||
//# sourceMappingURL=board-parsing-error.js.map |
@@ -1,3 +0,3 @@ | ||
export * from './board-parser'; | ||
export * from './board-parsing-error'; | ||
export * from './board-parser.js'; | ||
export * from './board-parsing-error.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,19 +0,3 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./board-parser"), exports); | ||
__exportStar(require("./board-parsing-error"), exports); | ||
export * from './board-parser.js'; | ||
export * from './board-parsing-error.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.componentManifestValidator = void 0; | ||
const zod_1 = require("zod"); | ||
exports.componentManifestValidator = zod_1.z.object({ | ||
kind: zod_1.z.union([zod_1.z.literal('component'), zod_1.z.literal('component-template')]), | ||
name: zod_1.z | ||
import { z } from 'zod'; | ||
export const componentManifestValidator = z.object({ | ||
kind: z.union([z.literal('component'), z.literal('component-template')]), | ||
name: z | ||
.string() | ||
@@ -14,10 +11,10 @@ .min(1, { message: 'Name must not be empty' }) | ||
}), | ||
description: zod_1.z.string(), | ||
cover: zod_1.z.string(), | ||
inlineCover: zod_1.z.optional(zod_1.z.string()), | ||
tags: zod_1.z.optional(zod_1.z.array(zod_1.z.string())), | ||
dependencies: zod_1.z.optional(zod_1.z.array(zod_1.z.string())), | ||
internalPath: zod_1.z.optional(zod_1.z.string()), | ||
mainComponentPath: zod_1.z.optional(zod_1.z.string()), | ||
description: z.string(), | ||
cover: z.string(), | ||
inlineCover: z.optional(z.string()), | ||
tags: z.optional(z.array(z.string())), | ||
dependencies: z.optional(z.array(z.string())), | ||
internalPath: z.optional(z.string()), | ||
mainComponentPath: z.optional(z.string()), | ||
}); | ||
//# sourceMappingURL=component-file-validator.js.map |
import { z } from 'zod'; | ||
import type { LibrarianConfig } from '../types'; | ||
import type { LibrarianConfig } from '../types/index.js'; | ||
export declare const LibrarianConfigValidator: z.ZodType<LibrarianConfig>; | ||
@@ -4,0 +4,0 @@ /** Format validation errors to human readable format. */ |
@@ -1,7 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LibrarianConfigValidator = void 0; | ||
exports.formatConfigValidatorError = formatConfigValidatorError; | ||
const zod_1 = require("zod"); | ||
const nonEmptyRequiredString = zod_1.z | ||
import { z } from 'zod'; | ||
const nonEmptyRequiredString = z | ||
.string({ required_error: 'is required field', invalid_type_error: 'has to be a string' }) | ||
@@ -11,3 +7,3 @@ .min(1, "can't be empty"); | ||
boardsPath: nonEmptyRequiredString, | ||
componentsPath: zod_1.z.optional(zod_1.z.string().min(1, "can't be empty")), | ||
componentsPath: z.optional(z.string().min(1, "can't be empty")), | ||
libraryName: nonEmptyRequiredString, | ||
@@ -21,3 +17,3 @@ libraryIcon: nonEmptyRequiredString, | ||
packageVersion: nonEmptyRequiredString, | ||
ignorePackagesValidation: zod_1.z.optional(zod_1.z.array(zod_1.z.string())), | ||
ignorePackagesValidation: z.optional(z.array(z.string())), | ||
}; | ||
@@ -27,13 +23,13 @@ const objectError = { | ||
}; | ||
exports.LibrarianConfigValidator = zod_1.z.discriminatedUnion('manifestOnly', [ | ||
zod_1.z.object({ | ||
manifestOnly: zod_1.z.literal(true), | ||
export const LibrarianConfigValidator = z.discriminatedUnion('manifestOnly', [ | ||
z.object({ | ||
manifestOnly: z.literal(true), | ||
...manifestFields, | ||
}, objectError), | ||
zod_1.z.object({ | ||
manifestOnly: zod_1.z.literal(false), | ||
z.object({ | ||
manifestOnly: z.literal(false), | ||
...allFields, | ||
}, objectError), | ||
zod_1.z.object({ | ||
manifestOnly: zod_1.z.undefined(), | ||
z.object({ | ||
manifestOnly: z.undefined(), | ||
...allFields, | ||
@@ -43,3 +39,3 @@ }, objectError), | ||
/** Format validation errors to human readable format. */ | ||
function formatConfigValidatorError(error) { | ||
export function formatConfigValidatorError(error) { | ||
const { _errors, ...invalidKeys } = error.format(); | ||
@@ -46,0 +42,0 @@ const errors = _errors.slice(); |
import type { IFileSystem } from '@file-services/types'; | ||
import type { CoduxManifest, LibrarianConfig } from '../types'; | ||
import { ComponentManifest } from './component-file-validator'; | ||
import type { CoduxManifest, LibrarianConfig } from '../types/index.js'; | ||
import { ComponentManifest } from './component-file-validator.js'; | ||
export type BuildResult = { | ||
@@ -5,0 +5,0 @@ errors: Error[]; |
@@ -1,16 +0,17 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LibraryBuilder = void 0; | ||
const constants_1 = require("../constants"); | ||
const image_file_to_data_url_1 = require("../utils/image-file-to-data-url"); | ||
const to_error_1 = require("../utils/to-error"); | ||
const ensure_posix_path_1 = require("../utils/ensure-posix-path"); | ||
const board_parser_1 = require("./board-parser"); | ||
const package_builder_1 = require("./package-builder"); | ||
const path_utils_1 = require("./path-utils"); | ||
const ast_utils_1 = require("../utils/ast-utils"); | ||
const parse_utils_1 = require("../utils/parse-utils"); | ||
const path_utils_2 = require("./path-utils"); | ||
const component_file_validator_1 = require("./component-file-validator"); | ||
class LibraryBuilder { | ||
import { manifestFileName, manifestFileVersion } from '../constants.js'; | ||
import { imageFileToDataUrl } from '../utils/image-file-to-data-url.js'; | ||
import { toError } from '../utils/to-error.js'; | ||
import { ensurePosixPath } from '../utils/ensure-posix-path.js'; | ||
import { BoardParser } from './board-parser/index.js'; | ||
import { PackageBuilder } from './package-builder.js'; | ||
import { getRelativeBoardPathInPackage } from './path-utils.js'; | ||
import { getSourceAST } from '../utils/ast-utils.js'; | ||
import { getImportedPackages } from '../utils/parse-utils.js'; | ||
import { getBoardsGlobalSetupPath } from './path-utils.js'; | ||
import { componentManifestValidator } from './component-file-validator.js'; | ||
export class LibraryBuilder { | ||
fs; | ||
config; | ||
packageBuilder; | ||
currentRoot; | ||
constructor({ shouldRemoveBuildDir, config, currentRoot }, fs) { | ||
@@ -20,3 +21,3 @@ this.fs = fs; | ||
if (!config.manifestOnly) { | ||
this.packageBuilder = new package_builder_1.PackageBuilder({ config, shouldRemoveBuildDir, currentRoot }, this.fs); | ||
this.packageBuilder = new PackageBuilder({ config, shouldRemoveBuildDir, currentRoot }, this.fs); | ||
} | ||
@@ -30,3 +31,3 @@ this.currentRoot = currentRoot; | ||
const allComponents = await this.processComponents(components); | ||
const boardsGlobalSetupPath = (0, path_utils_2.getBoardsGlobalSetupPath)(this.fs, this.currentRoot); | ||
const boardsGlobalSetupPath = getBoardsGlobalSetupPath(this.fs, this.currentRoot); | ||
let boardsGlobalSetupImports = new Set(); | ||
@@ -53,3 +54,3 @@ if (boardsGlobalSetupPath) { | ||
const componentTemplateCode = this.fs.readFileSync(componentTemplate, 'utf8'); | ||
const componentManifest = component_file_validator_1.componentManifestValidator.parse(JSON.parse(componentTemplateCode)); | ||
const componentManifest = componentManifestValidator.parse(JSON.parse(componentTemplateCode)); | ||
if (componentManifest.kind !== 'component-template') { | ||
@@ -111,7 +112,7 @@ // we only support component templates at this point | ||
try { | ||
const parser = new board_parser_1.BoardParser(path, this.fs); | ||
const parser = new BoardParser(path, this.fs); | ||
boards.push(await parser.parse()); | ||
} | ||
catch (error) { | ||
errors.push((0, to_error_1.toError)(error)); | ||
errors.push(toError(error)); | ||
} | ||
@@ -123,4 +124,4 @@ })); | ||
try { | ||
const source = await (0, ast_utils_1.getSourceAST)(this.fs, boardsGlobalSetupPath); | ||
return (0, parse_utils_1.getImportedPackages)(source); | ||
const source = await getSourceAST(this.fs, boardsGlobalSetupPath); | ||
return getImportedPackages(source); | ||
} | ||
@@ -134,4 +135,4 @@ catch (error) { | ||
? this.fs.relative(this.currentRoot, originalBoardPath) | ||
: (0, path_utils_1.getRelativeBoardPathInPackage)(this.fs, originalBoardPath, this.config.boardsPath); | ||
return (0, ensure_posix_path_1.ensurePosixPath)(path); | ||
: getRelativeBoardPathInPackage(this.fs, originalBoardPath, this.config.boardsPath); | ||
return ensurePosixPath(path); | ||
} | ||
@@ -153,4 +154,4 @@ getBoardCategory(originalBoardPath) { | ||
name: this.config.libraryName, | ||
icon: await (0, image_file_to_data_url_1.imageFileToDataUrl)(this.config.libraryIcon, this.fs), | ||
manifestFileVersion: constants_1.manifestFileVersion, | ||
icon: await imageFileToDataUrl(this.config.libraryIcon, this.fs), | ||
manifestFileVersion, | ||
boards: boards.map((board) => this.prepareBoardForManifest(board)), | ||
@@ -161,3 +162,3 @@ components: await this.inlineAssets(allComponents), | ||
const baseDir = this.config.manifestOnly ? this.currentRoot : this.config.buildDir; | ||
const manifestPath = this.fs.join(baseDir, constants_1.manifestFileName); | ||
const manifestPath = this.fs.join(baseDir, manifestFileName); | ||
await this.fs.promises.writeFile(manifestPath, JSON.stringify(manifest, null, 2)); | ||
@@ -169,3 +170,3 @@ return manifest; | ||
componentManifest.inlineCover = componentManifest.cover | ||
? await (0, image_file_to_data_url_1.imageFileToDataUrl)(this.fs.join(componentDirectory, componentManifest.cover), this.fs) | ||
? await imageFileToDataUrl(this.fs.join(componentDirectory, componentManifest.cover), this.fs) | ||
: undefined; | ||
@@ -176,3 +177,3 @@ return componentManifest; | ||
findReadme() { | ||
const readmePath = this.fs.join(this.currentRoot, "README.md"); | ||
const readmePath = this.fs.join(this.currentRoot, 'README.md'); | ||
if (this.fs.existsSync(readmePath)) { | ||
@@ -184,3 +185,2 @@ return readmePath; | ||
} | ||
exports.LibraryBuilder = LibraryBuilder; | ||
function validateUniqComponentNames(components) { | ||
@@ -187,0 +187,0 @@ const names = new Set(); |
import type { IFileSystem } from '@file-services/types'; | ||
import type { BoardDetails, ManifestConfig, PackageConfig } from '../types'; | ||
import { type ComponentBuildData } from './library-builder'; | ||
import type { BoardDetails, ManifestConfig, PackageConfig } from '../types/index.js'; | ||
import { type ComponentBuildData } from './library-builder.js'; | ||
type PackageBuilderOptions = { | ||
@@ -5,0 +5,0 @@ config: ManifestConfig & PackageConfig; |
@@ -1,6 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PackageBuilder = void 0; | ||
const path_utils_1 = require("./path-utils"); | ||
class PackageBuilder { | ||
import { getAbsoluteBoardPathInPackage } from './path-utils.js'; | ||
export class PackageBuilder { | ||
fs; | ||
config; | ||
shouldRemoveBuildDir; | ||
currentRoot; | ||
constructor({ config, shouldRemoveBuildDir, currentRoot }, fs) { | ||
@@ -44,3 +45,3 @@ this.fs = fs; | ||
async copyBoard(board) { | ||
const pathToBoardInPackage = (0, path_utils_1.getAbsoluteBoardPathInPackage)(this.fs, board.path, this.config.boardsPath, this.config.buildDir); | ||
const pathToBoardInPackage = getAbsoluteBoardPathInPackage(this.fs, board.path, this.config.boardsPath, this.config.buildDir); | ||
await this.fs.promises.ensureDirectory(this.fs.dirname(pathToBoardInPackage)); | ||
@@ -128,3 +129,2 @@ await this.fs.promises.copyFile(board.path, pathToBoardInPackage); | ||
} | ||
exports.PackageBuilder = PackageBuilder; | ||
//# sourceMappingURL=package-builder.js.map |
@@ -1,15 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRelativeBoardPathInPackage = getRelativeBoardPathInPackage; | ||
exports.getAbsoluteBoardPathInPackage = getAbsoluteBoardPathInPackage; | ||
exports.getBoardsGlobalSetupPath = getBoardsGlobalSetupPath; | ||
const constants_1 = require("../constants"); | ||
function getRelativeBoardPathInPackage(fs, originalBoardPath, boardsPath) { | ||
import { boardsDirectoryInPackage } from '../constants.js'; | ||
export function getRelativeBoardPathInPackage(fs, originalBoardPath, boardsPath) { | ||
const relativeSourcePath = fs.relative(boardsPath, originalBoardPath); | ||
return fs.join(constants_1.boardsDirectoryInPackage, relativeSourcePath); | ||
return fs.join(boardsDirectoryInPackage, relativeSourcePath); | ||
} | ||
function getAbsoluteBoardPathInPackage(fs, originalBoardPath, boardsPath, buildDir) { | ||
export function getAbsoluteBoardPathInPackage(fs, originalBoardPath, boardsPath, buildDir) { | ||
return fs.join(buildDir, getRelativeBoardPathInPackage(fs, originalBoardPath, boardsPath)); | ||
} | ||
function getBoardsGlobalSetupPath(fs, currentRoot) { | ||
export function getBoardsGlobalSetupPath(fs, currentRoot) { | ||
const configPath = fs.join(currentRoot, 'codux.config.json'); | ||
@@ -16,0 +11,0 @@ if (!fs.existsSync(configPath)) { |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=board-details.js.map |
@@ -1,2 +0,2 @@ | ||
import { type ComponentManifest } from '../services/component-file-validator'; | ||
import { type ComponentManifest } from '../services/component-file-validator.js'; | ||
export interface ManifestBoardDetails { | ||
@@ -3,0 +3,0 @@ /** Board name. */ |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=codux-manifest.js.map |
@@ -1,5 +0,5 @@ | ||
export * from './board-details'; | ||
export * from './codux-manifest'; | ||
export * from './librarian-config'; | ||
export * from './package-json'; | ||
export * from './board-details.js'; | ||
export * from './codux-manifest.js'; | ||
export * from './librarian-config.js'; | ||
export * from './package-json.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,21 +0,5 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./board-details"), exports); | ||
__exportStar(require("./codux-manifest"), exports); | ||
__exportStar(require("./librarian-config"), exports); | ||
__exportStar(require("./package-json"), exports); | ||
export * from './board-details.js'; | ||
export * from './codux-manifest.js'; | ||
export * from './librarian-config.js'; | ||
export * from './package-json.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=librarian-config.js.map |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=package-json.js.map |
@@ -1,46 +0,8 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPropertyAssignment = isPropertyAssignment; | ||
exports.findIdentifierImportDeclaration = findIdentifierImportDeclaration; | ||
exports.getSourceAST = getSourceAST; | ||
const typescript_1 = __importStar(require("typescript")); | ||
function isPropertyAssignment(node) { | ||
return typescript_1.default.isPropertyAssignment(node) || typescript_1.default.isShorthandPropertyAssignment(node); | ||
import ts, { ScriptKind, ScriptTarget } from 'typescript'; | ||
export function isPropertyAssignment(node) { | ||
return ts.isPropertyAssignment(node) || ts.isShorthandPropertyAssignment(node); | ||
} | ||
function findIdentifierImportDeclaration(identifier, source) { | ||
export function findIdentifierImportDeclaration(identifier, source) { | ||
for (const statement of source.statements) { | ||
if (typescript_1.default.isImportDeclaration(statement) && statement.importClause?.name?.text === identifier) | ||
if (ts.isImportDeclaration(statement) && statement.importClause?.name?.text === identifier) | ||
return statement; | ||
@@ -50,6 +12,6 @@ } | ||
} | ||
async function getSourceAST(fs, filePath) { | ||
export async function getSourceAST(fs, filePath) { | ||
const rawSource = await fs.promises.readFile(filePath, { encoding: 'utf-8' }); | ||
return typescript_1.default.createSourceFile(filePath, rawSource, typescript_1.ScriptTarget.Latest, false, typescript_1.ScriptKind.TSX); | ||
return ts.createSourceFile(filePath, rawSource, ScriptTarget.Latest, false, ScriptKind.TSX); | ||
} | ||
//# sourceMappingURL=ast-utils.js.map |
@@ -1,8 +0,2 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createTerminalLink = createTerminalLink; | ||
const supports_hyperlinks_1 = __importDefault(require("supports-hyperlinks")); | ||
import supportsHyperlinks from 'supports-hyperlinks'; | ||
const OSC = '\u001B]'; | ||
@@ -24,5 +18,5 @@ const BEL = '\u0007'; | ||
*/ | ||
function createTerminalLink(text, url) { | ||
return supports_hyperlinks_1.default.stdout ? createLink(text, url) : `${text} (\u200B${url}\u200B)`; | ||
export function createTerminalLink(text, url) { | ||
return supportsHyperlinks.stdout ? createLink(text, url) : `${text} (\u200B${url}\u200B)`; | ||
} | ||
//# sourceMappingURL=create-terminal-link.js.map |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensurePosixPath = ensurePosixPath; | ||
const path_1 = require("path"); | ||
function ensurePosixPath(path) { | ||
return path.replaceAll(path_1.win32.sep, path_1.posix.sep); | ||
import { win32, posix } from 'path'; | ||
export function ensurePosixPath(path) { | ||
return path.replaceAll(win32.sep, posix.sep); | ||
} | ||
//# sourceMappingURL=ensure-posix-path.js.map |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.imageFileToDataUrl = imageFileToDataUrl; | ||
const js_base64_1 = require("js-base64"); | ||
const node_path_1 = require("node:path"); | ||
import { Base64 } from 'js-base64'; | ||
import { extname } from 'node:path'; | ||
const extnameToFormatMap = { | ||
@@ -12,9 +9,9 @@ '.png': 'png', | ||
}; | ||
async function imageFileToDataUrl(imagePath, fs) { | ||
const iconFormat = extnameToFormatMap[(0, node_path_1.extname)(imagePath)]; | ||
export async function imageFileToDataUrl(imagePath, fs) { | ||
const iconFormat = extnameToFormatMap[extname(imagePath)]; | ||
if (!iconFormat) | ||
throw new Error(`Failed to parse ${imagePath}. Unsupported format`); | ||
const rawImage = await fs.promises.readFile(imagePath); | ||
return `data:image/${iconFormat};base64,${js_base64_1.Base64.fromUint8Array(rawImage)}`; | ||
return `data:image/${iconFormat};base64,${Base64.fromUint8Array(rawImage)}`; | ||
} | ||
//# sourceMappingURL=image-file-to-data-url.js.map |
@@ -1,10 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPathStrictlyInsideDirectory = isPathStrictlyInsideDirectory; | ||
const node_path_1 = require("node:path"); | ||
function isPathStrictlyInsideDirectory(path, directory) { | ||
const absolutePath = (0, node_path_1.resolve)(path); | ||
const directoryAbsolutePath = (0, node_path_1.resolve)(directory); | ||
return absolutePath.startsWith(directoryAbsolutePath + node_path_1.sep); | ||
import { resolve, sep } from 'node:path'; | ||
export function isPathStrictlyInsideDirectory(path, directory) { | ||
const absolutePath = resolve(path); | ||
const directoryAbsolutePath = resolve(directory); | ||
return absolutePath.startsWith(directoryAbsolutePath + sep); | ||
} | ||
//# sourceMappingURL=is-path-strictly-inside-directory.js.map |
@@ -1,17 +0,11 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getImportedPackages = getImportedPackages; | ||
const typescript_1 = __importDefault(require("typescript")); | ||
const specifier_1 = require("./specifier"); | ||
function getImportedPackages(source) { | ||
import ts from 'typescript'; | ||
import { parseModuleSpecifier } from './specifier.js'; | ||
export function getImportedPackages(source) { | ||
const importedPackages = new Set(); | ||
for (const statement of source.statements) { | ||
if (typescript_1.default.isImportDeclaration(statement) && statement.moduleSpecifier) { | ||
if (ts.isImportDeclaration(statement) && statement.moduleSpecifier) { | ||
const moduleSpecifier = statement.moduleSpecifier; | ||
if (typescript_1.default.isStringLiteral(moduleSpecifier)) { | ||
if (ts.isStringLiteral(moduleSpecifier)) { | ||
const importPath = moduleSpecifier.text; | ||
const parsedSpecifier = (0, specifier_1.parseModuleSpecifier)(importPath); | ||
const parsedSpecifier = parseModuleSpecifier(importPath); | ||
if (parsedSpecifier.type === 'bare') { | ||
@@ -18,0 +12,0 @@ importedPackages.add(parsedSpecifier.packageName); |
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseModuleSpecifier = void 0; | ||
const isRelativeModuleSpecifier = (specifier) => specifier.startsWith('./') || specifier.startsWith('../') || specifier === '.' || specifier === '..'; | ||
@@ -8,3 +5,3 @@ const isValidNpmScopeName = (name) => /^@[a-z0-9-][a-z0-9._-]+$/.test(name); | ||
const urlSchemeRe = /^[a-z][a-z-0-9+.-]+:/i; | ||
const parseModuleSpecifier = (specifier) => { | ||
export const parseModuleSpecifier = (specifier) => { | ||
if (isRelativeModuleSpecifier(specifier)) { | ||
@@ -32,3 +29,2 @@ return { type: 'relative', relativePath: specifier }; | ||
}; | ||
exports.parseModuleSpecifier = parseModuleSpecifier; | ||
//# sourceMappingURL=specifier.js.map |
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toError = void 0; | ||
/** | ||
@@ -8,4 +5,3 @@ * Convert any kind of value to an error instance. Unless the value is already | ||
*/ | ||
const toError = (value) => value instanceof Error ? value : new Error(value === undefined ? undefined : String(value)); | ||
exports.toError = toError; | ||
export const toError = (value) => value instanceof Error ? value : new Error(value === undefined ? undefined : String(value)); | ||
//# sourceMappingURL=to-error.js.map |
{ | ||
"name": "@wixc3/codux-librarian", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"bin": { | ||
@@ -10,2 +10,3 @@ "codux-librarian": "./bin/codux-librarian.js" | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./runtime": "./dist/runtime.js", | ||
@@ -24,3 +25,3 @@ "./package.json": "./package.json" | ||
"@file-services/resolve": "^9.4.1", | ||
"@wixc3/common": "^17.1.1", | ||
"@wixc3/common": "^18.0.0", | ||
"commander": "^12.1.0", | ||
@@ -36,10 +37,10 @@ "js-base64": "^3.7.7", | ||
"@file-services/types": "^9.4.1", | ||
"@types/chai": "^4.3.20", | ||
"@types/chai-as-promised": "^7.1.8", | ||
"@types/chai": "^5.0.1", | ||
"@types/chai-as-promised": "^8.0.1", | ||
"@types/mocha": "^10.0.10", | ||
"@types/node": "20", | ||
"@types/semver": "^7.5.8", | ||
"chai": "^4.4.1", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^9.16.0", | ||
"chai": "^5.1.2", | ||
"chai-as-promised": "^8.0.1", | ||
"eslint": "^9.17.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
@@ -46,0 +47,0 @@ "eslint-plugin-no-only-tests": "^3.3.0", |
{ | ||
"compilerOptions": { | ||
/* Visit https://aka.ms/tsconfig.json to read more about this file */ | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
/* Basic Options */ | ||
"target": "ES2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, | ||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, | ||
"lib": ["ES2021"] /* Specify library files to be included in the compilation. */, | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
// "checkJs": true, /* Report errors in .js files. */ | ||
"declaration": true /* Generates corresponding '.d.ts' file. */, | ||
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, | ||
"sourceMap": true /* Generates corresponding '.map' file. */, | ||
// "outFile": "./", /* Concatenate and emit output to single file. */ | ||
"outDir": "./dist" /* Redirect output structure to the directory. */, | ||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, | ||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ | ||
// "removeComments": true, /* Do not emit comments to output. */ | ||
// "noEmit": true, /* Do not emit outputs. */ | ||
// "importsNotUsedAsValues": "error" /* Specify emit/checking behavior for imports that are only used for types. */, | ||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ | ||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ | ||
/* Projects */ | ||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ | ||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ | ||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ | ||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ | ||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ | ||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ | ||
/* Strict Type-Checking Options */ | ||
"strict": true /* Enable all strict type-checking options. */, | ||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
// "strictNullChecks": true, /* Enable strict null checks. */ | ||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ | ||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ | ||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ | ||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ | ||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ | ||
/* Language and Environment */ | ||
"target": "es2023", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ | ||
"lib": ["es2023"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ | ||
// "jsx": "preserve", /* Specify what JSX code is generated. */ | ||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ | ||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ | ||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ | ||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ | ||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ | ||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ | ||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ | ||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ | ||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ | ||
/* Additional Checks */ | ||
"noUnusedLocals": true /* Enable error reporting when local variables aren't read. */, | ||
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */, | ||
"exactOptionalPropertyTypes": true /* Interpret optional property types as written, rather than adding 'undefined'. */, | ||
"noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */, | ||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */, | ||
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, | ||
"noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */, | ||
"noPropertyAccessFromIndexSignature": true /* Require undeclared properties from index signatures to use element accesses. */, | ||
/* Module Resolution Options */ | ||
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, | ||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ | ||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ | ||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ | ||
// "typeRoots": [], /* List of folders to include type definitions from. */ | ||
"types": ["node", "mocha"] /* Type declaration files to be included in compilation. */, | ||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ | ||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, | ||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ | ||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ | ||
/* Modules */ | ||
"module": "node16", /* Specify what module code is generated. */ | ||
// "rootDir": "./", /* Specify the root folder within your source files. */ | ||
"moduleResolution": "node16", /* Specify how TypeScript looks up a file from a given module specifier. */ | ||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ | ||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ | ||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ | ||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ | ||
"types": ["node", "mocha"], /* Specify type package names to be included without being referenced in a source file. */ | ||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ | ||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ | ||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ | ||
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */ | ||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ | ||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ | ||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ | ||
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */ | ||
// "resolveJsonModule": true, /* Enable importing .json files. */ | ||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ | ||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */ | ||
/* Source Map Options */ | ||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ | ||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ | ||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ | ||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ | ||
/* JavaScript Support */ | ||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ | ||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ | ||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ | ||
/* Experimental Options */ | ||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ | ||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ | ||
/* Emit */ | ||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ | ||
"declarationMap": true, /* Create sourcemaps for d.ts files. */ | ||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ | ||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */ | ||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ | ||
// "noEmit": true, /* Disable emitting files from a compilation. */ | ||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ | ||
"outDir": "./dist", /* Specify an output folder for all emitted files. */ | ||
// "removeComments": true, /* Disable emitting comments. */ | ||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ | ||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ | ||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ | ||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ | ||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ | ||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ | ||
// "newLine": "crlf", /* Set the newline character for emitting files. */ | ||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ | ||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ | ||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ | ||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ | ||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */ | ||
/* Advanced Options */ | ||
// "skipLibCheck": true, /* Skip type checking of declaration files. */ | ||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ | ||
}, | ||
"include": ["src"] | ||
/* Interop Constraints */ | ||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ | ||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ | ||
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ | ||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ | ||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ | ||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ | ||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ | ||
/* Type Checking */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ | ||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ | ||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ | ||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ | ||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ | ||
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */ | ||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ | ||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ | ||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ | ||
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ | ||
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ | ||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ | ||
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ | ||
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ | ||
"noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ | ||
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ | ||
"noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ | ||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ | ||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ | ||
/* Completeness */ | ||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ | ||
// "skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Yes
119453
111
1316
+ Added@wixc3/common@18.1.1(transitive)
- Removed@wixc3/common@17.1.1(transitive)
Updated@wixc3/common@^18.0.0