@itrocks/compose
Advanced tools
Comparing version 0.0.5 to 0.0.6
export type ComposeConfig = Record<string, string | string[]>; | ||
export default compose; | ||
export declare function compose(config: ComposeConfig): void; | ||
export declare function compose(baseDir: string, config: ComposeConfig): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compose = compose; | ||
const app_dir_1 = require("@itrocks/app-dir"); | ||
const class_type_1 = require("@itrocks/class-type"); | ||
@@ -13,7 +12,7 @@ const uses_1 = require("@itrocks/uses"); | ||
const replacements = {}; | ||
function configPath(config) { | ||
return (0, path_1.normalize)(require.resolve((config[0] === '/') ? (app_dir_1.default + config) : config)); | ||
function configPath(baseDir, config) { | ||
return (0, path_1.normalize)(require.resolve((config[0] === '/') ? (baseDir + '/' + config) : config)); | ||
} | ||
exports.default = compose; | ||
function compose(config) { | ||
function compose(baseDir, config) { | ||
// initReplacements | ||
@@ -23,3 +22,3 @@ for (let [module, configReplacements] of Object.entries(config)) { | ||
[module, moduleExport] = module.split(':'); | ||
module = configPath(module); | ||
module = configPath(baseDir, module); | ||
moduleExport ??= 'default'; | ||
@@ -33,3 +32,3 @@ if (!replacements[module]) { | ||
[replacement, replacementExport] = replacement.split(':'); | ||
replacement = configPath(replacement); | ||
replacement = configPath(baseDir, replacement); | ||
replacementExport ??= 'default'; | ||
@@ -36,0 +35,0 @@ replacements[module][moduleExport].push({ script: replacement, export: replacementExport }); |
export type ComposeConfig = Record<string, string | string[]>; | ||
export default compose; | ||
export declare function compose(config: ComposeConfig): void; | ||
export declare function compose(baseDir: string, config: ComposeConfig): void; |
@@ -1,2 +0,1 @@ | ||
import appDir from '@itrocks/app-dir'; | ||
import { inherits } from '@itrocks/class-type'; | ||
@@ -10,7 +9,7 @@ import { Uses } from '@itrocks/uses'; | ||
const replacements = {}; | ||
function configPath(config) { | ||
return normalize(require.resolve((config[0] === '/') ? (appDir + config) : config)); | ||
function configPath(baseDir, config) { | ||
return normalize(require.resolve((config[0] === '/') ? (baseDir + '/' + config) : config)); | ||
} | ||
export default compose; | ||
export function compose(config) { | ||
export function compose(baseDir, config) { | ||
// initReplacements | ||
@@ -20,3 +19,3 @@ for (let [module, configReplacements] of Object.entries(config)) { | ||
[module, moduleExport] = module.split(':'); | ||
module = configPath(module); | ||
module = configPath(baseDir, module); | ||
moduleExport ??= 'default'; | ||
@@ -30,3 +29,3 @@ if (!replacements[module]) { | ||
[replacement, replacementExport] = replacement.split(':'); | ||
replacement = configPath(replacement); | ||
replacement = configPath(baseDir, replacement); | ||
replacementExport ??= 'default'; | ||
@@ -33,0 +32,0 @@ replacements[module][moduleExport].push({ script: replacement, export: replacementExport }); |
@@ -7,3 +7,2 @@ { | ||
"dependencies": { | ||
"@itrocks/app-dir": "latest", | ||
"@itrocks/class-type": "latest", | ||
@@ -56,3 +55,3 @@ "@itrocks/uses": "latest" | ||
"types": "./esm/compose.d.ts", | ||
"version": "0.0.5" | ||
"version": "0.0.6" | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
17013
173
+ Added@itrocks/decorator@0.0.8(transitive)
+ Added@itrocks/uses@0.0.6(transitive)
+ Addedreflect-metadata@0.2.2(transitive)
- Removed@itrocks/app-dir@latest
- Removed@itrocks/app-dir@0.0.21(transitive)