@stylable/node
Advanced tools
Comparing version 4.13.2 to 4.13.3
export { Options, attachHook } from './require-hook'; | ||
export { resolveNamespace, resolveNamespaceFactory } from './resolve-namespace'; | ||
export { resolveNamespace, resolveNamespaceFactory, createNamespaceStrategyNode, } from './resolve-namespace'; | ||
export { FileSystem, findFiles } from './find-files'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findFiles = exports.resolveNamespaceFactory = exports.resolveNamespace = exports.attachHook = void 0; | ||
exports.findFiles = exports.createNamespaceStrategyNode = exports.resolveNamespaceFactory = exports.resolveNamespace = exports.attachHook = void 0; | ||
var require_hook_1 = require("./require-hook"); | ||
@@ -9,4 +9,5 @@ Object.defineProperty(exports, "attachHook", { enumerable: true, get: function () { return require_hook_1.attachHook; } }); | ||
Object.defineProperty(exports, "resolveNamespaceFactory", { enumerable: true, get: function () { return resolve_namespace_1.resolveNamespaceFactory; } }); | ||
Object.defineProperty(exports, "createNamespaceStrategyNode", { enumerable: true, get: function () { return resolve_namespace_1.createNamespaceStrategyNode; } }); | ||
var find_files_1 = require("./find-files"); | ||
Object.defineProperty(exports, "findFiles", { enumerable: true, get: function () { return find_files_1.findFiles; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,5 @@ | ||
import { packageNamespaceFactory } from '@stylable/core'; | ||
export declare function resolveNamespaceFactory(hashSalt?: string, prefix?: string): ReturnType<typeof packageNamespaceFactory>; | ||
export declare const resolveNamespace: ReturnType<typeof packageNamespaceFactory>; | ||
import { CreateNamespaceOptions } from '@stylable/core'; | ||
export declare function resolveNamespaceFactory(hashSalt?: string, prefix?: string, options?: Partial<Omit<CreateNamespaceOptions, 'hashSalt' | 'prefix'>>): (namespace: string, stylesheetOriginPath: string, stylesheetPath?: string | undefined) => string; | ||
export declare function createNamespaceStrategyNode(options?: Partial<CreateNamespaceOptions>): (namespace: string, stylesheetOriginPath: string, stylesheetPath?: string | undefined) => string; | ||
export declare const resolveNamespace: (namespace: string, stylesheetOriginPath: string, stylesheetPath?: string | undefined) => string; | ||
//# sourceMappingURL=resolve-namespace.d.ts.map |
@@ -6,11 +6,39 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveNamespace = exports.resolveNamespaceFactory = void 0; | ||
exports.resolveNamespace = exports.createNamespaceStrategyNode = exports.resolveNamespaceFactory = void 0; | ||
const core_1 = require("@stylable/core"); | ||
const path_1 = require("path"); | ||
const find_config_1 = __importDefault(require("find-config")); | ||
function resolveNamespaceFactory(hashSalt = '', prefix = '') { | ||
return (0, core_1.packageNamespaceFactory)(find_config_1.default, require, { dirname: path_1.dirname, relative: path_1.relative }, hashSalt, prefix); | ||
function resolveNamespaceFactory(hashSalt = '', prefix = '', options = {}) { | ||
return createNamespaceStrategyNode({ hashSalt, prefix, ...options }); | ||
} | ||
exports.resolveNamespaceFactory = resolveNamespaceFactory; | ||
exports.resolveNamespace = resolveNamespaceFactory(); | ||
function createNamespaceStrategyNode(options = {}) { | ||
return (0, core_1.createNamespaceStrategy)({ | ||
normalizePath(packageRoot, stylesheetPath) { | ||
return (0, path_1.relative)(packageRoot, stylesheetPath).replace(/\\/g, '/'); | ||
}, | ||
getPackageInfo: (stylesheetPath) => { | ||
const configPath = (0, find_config_1.default)('package.json', { cwd: (0, path_1.dirname)(stylesheetPath) }); | ||
if (!configPath) { | ||
throw new Error(`Could not find package.json for ${stylesheetPath}`); | ||
} | ||
const config = require(configPath); | ||
return { | ||
name: config.name, | ||
version: config.version, | ||
dirPath: (0, path_1.dirname)(configPath), | ||
}; | ||
}, | ||
handleNoMatch(strict, ns, stylesheetPath, usedBy) { | ||
return strict ? (0, core_1.defaultNoMatchHandler)(strict, ns, stylesheetPath, usedBy) : ns; | ||
}, | ||
hashSalt: '', | ||
hashFragment: 'full', | ||
hashSeparator: '', | ||
strict: false, | ||
...options, | ||
}); | ||
} | ||
exports.createNamespaceStrategyNode = createNamespaceStrategyNode; | ||
exports.resolveNamespace = createNamespaceStrategyNode(); | ||
//# sourceMappingURL=resolve-namespace.js.map |
{ | ||
"name": "@stylable/node", | ||
"version": "4.13.2", | ||
"version": "4.13.3", | ||
"description": "Integrate Stylable into your node application", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@stylable/core": "^4.13.2", | ||
"@stylable/module-utils": "^4.13.2", | ||
"@stylable/core": "^4.13.3", | ||
"@stylable/module-utils": "^4.13.3", | ||
"find-config": "^1.0.0" | ||
@@ -14,0 +14,0 @@ }, |
export { Options, attachHook } from './require-hook'; | ||
export { resolveNamespace, resolveNamespaceFactory } from './resolve-namespace'; | ||
export { | ||
resolveNamespace, | ||
resolveNamespaceFactory, | ||
createNamespaceStrategyNode, | ||
} from './resolve-namespace'; | ||
export { FileSystem, findFiles } from './find-files'; |
@@ -1,2 +0,6 @@ | ||
import { packageNamespaceFactory } from '@stylable/core'; | ||
import { | ||
createNamespaceStrategy, | ||
CreateNamespaceOptions, | ||
defaultNoMatchHandler, | ||
} from '@stylable/core'; | ||
import { dirname, relative } from 'path'; | ||
@@ -7,8 +11,36 @@ import findConfig from 'find-config'; | ||
hashSalt = '', | ||
prefix = '' | ||
): ReturnType<typeof packageNamespaceFactory> { | ||
return packageNamespaceFactory(findConfig, require, { dirname, relative }, hashSalt, prefix); | ||
prefix = '', | ||
options: Partial<Omit<CreateNamespaceOptions, 'hashSalt' | 'prefix'>> = {} | ||
) { | ||
return createNamespaceStrategyNode({ hashSalt, prefix, ...options }); | ||
} | ||
export const resolveNamespace: ReturnType<typeof packageNamespaceFactory> = | ||
resolveNamespaceFactory(); | ||
export function createNamespaceStrategyNode(options: Partial<CreateNamespaceOptions> = {}) { | ||
return createNamespaceStrategy({ | ||
normalizePath(packageRoot: string, stylesheetPath: string) { | ||
return relative(packageRoot, stylesheetPath).replace(/\\/g, '/'); | ||
}, | ||
getPackageInfo: (stylesheetPath) => { | ||
const configPath = findConfig('package.json', { cwd: dirname(stylesheetPath) }); | ||
if (!configPath) { | ||
throw new Error(`Could not find package.json for ${stylesheetPath}`); | ||
} | ||
const config = require(configPath) as { name: string; version: string }; | ||
return { | ||
name: config.name, | ||
version: config.version, | ||
dirPath: dirname(configPath), | ||
}; | ||
}, | ||
handleNoMatch(strict, ns, stylesheetPath, usedBy) { | ||
return strict ? defaultNoMatchHandler(strict, ns, stylesheetPath, usedBy) : ns; | ||
}, | ||
hashSalt: '', | ||
hashFragment: 'full', | ||
hashSeparator: '', | ||
strict: false, | ||
...options, | ||
}); | ||
} | ||
export const resolveNamespace = createNamespaceStrategyNode(); |
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
22027
293
5
Updated@stylable/core@^4.13.3