Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wixc3/codux-librarian

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/codux-librarian - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

1

dist/services/board-parser/board-parser.d.ts

@@ -13,4 +13,3 @@ import type { IFileSystem } from '@file-services/types';

private findCreateBoardExpression;
private getSourceAST;
}
//# sourceMappingURL=board-parser.d.ts.map
"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 (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};

@@ -28,3 +8,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

const resolve_1 = require("@file-services/resolve");
const typescript_1 = __importStar(require("typescript"));
const typescript_1 = __importDefault(require("typescript"));
const ast_utils_1 = require("../../utils/ast-utils");

@@ -34,2 +14,3 @@ const image_file_to_data_url_1 = require("../../utils/image-file-to-data-url");

const parse_utils_1 = require("../../utils/parse-utils");
const ast_utils_2 = require("../../utils/ast-utils");
class BoardParser {

@@ -44,3 +25,3 @@ constructor(boardPath, fs) {

async parse() {
const source = await this.getSourceAST();
const source = await (0, ast_utils_2.getSourceAST)(this.fs, this.boardPath);
const importedPackages = (0, parse_utils_1.getImportedPackages)(source);

@@ -117,8 +98,4 @@ const createBoardExpression = this.findCreateBoardExpression(source);

}
async getSourceAST() {
const rawSource = await this.fs.promises.readFile(this.boardPath, { encoding: 'utf-8' });
return typescript_1.default.createSourceFile(this.boardPath, rawSource, typescript_1.ScriptTarget.Latest, false, typescript_1.ScriptKind.JSX);
}
}
exports.BoardParser = BoardParser;
//# sourceMappingURL=board-parser.js.map

1

dist/services/library-builder.d.ts

@@ -22,2 +22,3 @@ import type { IFileSystem } from '@file-services/types';

private parseBoards;
private getImportsFromGlobalSetup;
private getBoardPathForManifest;

@@ -24,0 +25,0 @@ private getBoardCategory;

@@ -11,2 +11,5 @@ "use strict";

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");
class LibraryBuilder {

@@ -23,6 +26,11 @@ constructor({ shouldRemoveBuildDir, config, currentRoot }, fs) {

const boardPaths = this.findBoards();
const { boards, errors, } = await this.parseBoards(boardPaths);
const boardsGlobalSetupPath = (0, path_utils_2.getBoardsGlobalSetupPath)(this.fs, this.currentRoot);
let boardsGlobalSetupImports = new Set();
if (boardsGlobalSetupPath) {
boardsGlobalSetupImports = await this.getImportsFromGlobalSetup(boardsGlobalSetupPath);
}
const { boards, errors } = await this.parseBoards(boardPaths);
if (errors.length)
return { errors };
await this.packageBuilder?.buildPackage(boards);
await this.packageBuilder?.buildPackage(boards, boardsGlobalSetupImports);
const manifest = await this.generateManifest(boards);

@@ -50,2 +58,11 @@ return { manifest };

}
async getImportsFromGlobalSetup(boardsGlobalSetupPath) {
try {
const source = await (0, ast_utils_1.getSourceAST)(this.fs, boardsGlobalSetupPath);
return (0, parse_utils_1.getImportedPackages)(source);
}
catch (error) {
throw new Error(`Failed to parse boards-global-setup file at ${boardsGlobalSetupPath}: ${error.message}`);
}
}
getBoardPathForManifest(originalBoardPath) {

@@ -52,0 +69,0 @@ const path = this.config.manifestOnly

@@ -14,3 +14,3 @@ import type { IFileSystem } from '@file-services/types';

constructor({ config, shouldRemoveBuildDir, currentRoot }: PackageBuilderOptions, fs: IFileSystem);
buildPackage(boards: BoardDetails[]): Promise<void>;
buildPackage(boards: BoardDetails[], boardsGlobalSetupImports: Set<string>): Promise<void>;
private copyBoards;

@@ -17,0 +17,0 @@ private copyBoard;

@@ -12,3 +12,3 @@ "use strict";

}
async buildPackage(boards) {
async buildPackage(boards, boardsGlobalSetupImports) {
const { buildDir } = this.config;

@@ -22,2 +22,3 @@ if (this.shouldRemoveBuildDir && this.fs.existsSync(buildDir)) {

});
boardsGlobalSetupImports.forEach((dep) => allImportedPackages.add(dep));
this.fs.ensureDirectorySync(buildDir);

@@ -40,3 +41,5 @@ await Promise.all([this.copyBoards(boards), this.generatePackageJson(allImportedPackages)]);

const peerDependencies = packageJson.peerDependencies || {};
const usedPeerDependencies = {};
const usedDependencies = {};
const usedDevDependencies = {};
allImportedPackages.forEach(dep => {

@@ -47,15 +50,16 @@ if (dependencies[dep]) {

else if (devDependencies[dep]) {
usedDependencies[dep] = devDependencies[dep];
usedDevDependencies[dep] = devDependencies[dep];
}
else if (peerDependencies[dep]) {
usedDependencies[dep] = peerDependencies[dep];
usedPeerDependencies[dep] = peerDependencies[dep];
}
else {
throw new Error(`Dependency "${dep}" is used in the board but not listed in package.json dependencies or peerDependencies.`);
throw new Error(`Dependency "${dep}" is used in the board but not listed in package.json dependencies, devDependencies, or peerDependencies.`);
}
});
return usedDependencies;
return { dependencies: usedDependencies, devDependencies: usedDevDependencies, peerDependencies: usedPeerDependencies };
}
async generatePackageJson(allImportedPackages) {
const { packageName, packageVersion } = this.config;
const { dependencies, devDependencies, peerDependencies } = this.getUsedDependencies(allImportedPackages);
const packageJson = {

@@ -67,3 +71,5 @@ name: packageName,

},
dependencies: this.getUsedDependencies(allImportedPackages),
dependencies,
devDependencies,
peerDependencies,
};

@@ -70,0 +76,0 @@ const outputPackageJsonPath = this.fs.join(this.config.buildDir, 'package.json');

import type { IFileSystem } from '@file-services/types';
export declare function getRelativeBoardPathInPackage(fs: IFileSystem, originalBoardPath: string, boardsPath: string): string;
export declare function getAbsoluteBoardPathInPackage(fs: IFileSystem, originalBoardPath: string, boardsPath: string, buildDir: string): string;
export declare function getBoardsGlobalSetupPath(fs: IFileSystem, currentRoot: string): string | undefined;
//# sourceMappingURL=path-utils.d.ts.map

@@ -5,2 +5,3 @@ "use strict";

exports.getAbsoluteBoardPathInPackage = getAbsoluteBoardPathInPackage;
exports.getBoardsGlobalSetupPath = getBoardsGlobalSetupPath;
const constants_1 = require("../constants");

@@ -14,2 +15,18 @@ function getRelativeBoardPathInPackage(fs, originalBoardPath, boardsPath) {

}
function getBoardsGlobalSetupPath(fs, currentRoot) {
const configPath = fs.join(currentRoot, 'codux.config.json');
if (!fs.existsSync(configPath)) {
return undefined;
}
try {
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
if (!config.boardGlobalSetup) {
return undefined;
}
return fs.resolve(currentRoot, config.boardGlobalSetup);
}
catch (error) {
throw new Error(`Failed to read codux.config.json: ${error.message}`);
}
}
//# sourceMappingURL=path-utils.js.map

@@ -1,5 +0,6 @@

import ts from 'typescript';
import type { Node, PropertyAssignment, ImportDeclaration, SourceFile } from 'typescript';
import type { IFileSystem } from '@file-services/types';
import ts, { SourceFile, Node, PropertyAssignment, ImportDeclaration } from 'typescript';
export declare function isPropertyAssignment(node: Node): node is PropertyAssignment | ts.ShorthandPropertyAssignment;
export declare function findIdentifierImportDeclaration(identifier: string, source: SourceFile): ImportDeclaration | null;
export declare function getSourceAST(fs: IFileSystem, filePath: string): Promise<SourceFile>;
//# sourceMappingURL=ast-utils.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
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 (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};

@@ -8,3 +28,4 @@ Object.defineProperty(exports, "__esModule", { value: true });

exports.findIdentifierImportDeclaration = findIdentifierImportDeclaration;
const typescript_1 = __importDefault(require("typescript"));
exports.getSourceAST = getSourceAST;
const typescript_1 = __importStar(require("typescript"));
function isPropertyAssignment(node) {

@@ -20,2 +41,6 @@ return typescript_1.default.isPropertyAssignment(node) || typescript_1.default.isShorthandPropertyAssignment(node);

}
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.JSX);
}
//# sourceMappingURL=ast-utils.js.map
{
"name": "@wixc3/codux-librarian",
"version": "0.4.1",
"version": "0.4.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc