@stylable/node
Advanced tools
Comparing version 6.0.0 to 6.0.1
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 const packageJsonLookupCache: Map<string, string>; | ||
export declare function createNamespaceStrategyNode(options?: Partial<CreateNamespaceOptions>): (namespace: string, stylesheetOriginPath: string, stylesheetPath?: string | undefined) => string; | ||
export declare function createNamespaceStrategyNode(options?: Partial<CreateNamespaceOptions>, devMode?: boolean): (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,2 +6,3 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const node_fs_1 = require("node:fs"); | ||
const find_package_json_1 = require("./find-package-json"); | ||
@@ -13,3 +14,3 @@ function resolveNamespaceFactory(hashSalt = '', prefix = '', options = {}) { | ||
exports.packageJsonLookupCache = new Map(); | ||
function createNamespaceStrategyNode(options = {}) { | ||
function createNamespaceStrategyNode(options = {}, devMode) { | ||
return (0, core_1.createNamespaceStrategy)({ | ||
@@ -31,4 +32,13 @@ normalizePath(packageRoot, stylesheetPath) { | ||
}, | ||
handleNoMatch(strict, ns, stylesheetPath, usedBy) { | ||
return strict ? (0, core_1.defaultNoMatchHandler)(strict, ns, stylesheetPath, usedBy) : ns; | ||
handleNoMatch(strict, ns, stylesheetPath, usedByMap) { | ||
if (strict && devMode) { | ||
const usedBy = usedByMap.get(ns); | ||
if (usedBy) { | ||
if (!(0, node_fs_1.existsSync)(usedBy)) { | ||
usedByMap.set(ns, stylesheetPath); | ||
return ns; | ||
} | ||
} | ||
} | ||
return strict ? (0, core_1.defaultNoMatchHandler)(strict, ns, stylesheetPath, usedByMap) : ns; | ||
}, | ||
@@ -35,0 +45,0 @@ hashSalt: '', |
{ | ||
"name": "@stylable/node", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Integrate Stylable into your node application", | ||
@@ -11,5 +11,5 @@ "main": "dist/index.js", | ||
"@file-services/node": "^9.0.0", | ||
"@stylable/build-tools": "^6.0.0", | ||
"@stylable/core": "^6.0.0", | ||
"@stylable/module-utils": "^6.0.0", | ||
"@stylable/build-tools": "^6.0.1", | ||
"@stylable/core": "^6.0.1", | ||
"@stylable/module-utils": "^6.0.1", | ||
"find-config": "^1.0.0" | ||
@@ -16,0 +16,0 @@ }, |
@@ -7,2 +7,3 @@ import { | ||
import { dirname, relative } from 'path'; | ||
import { existsSync } from 'node:fs'; | ||
import { findPackageJson } from './find-package-json'; | ||
@@ -20,3 +21,6 @@ | ||
export function createNamespaceStrategyNode(options: Partial<CreateNamespaceOptions> = {}) { | ||
export function createNamespaceStrategyNode( | ||
options: Partial<CreateNamespaceOptions> = {}, | ||
devMode?: boolean | ||
) { | ||
return createNamespaceStrategy({ | ||
@@ -41,4 +45,13 @@ normalizePath(packageRoot: string, stylesheetPath: string) { | ||
}, | ||
handleNoMatch(strict, ns, stylesheetPath, usedBy) { | ||
return strict ? defaultNoMatchHandler(strict, ns, stylesheetPath, usedBy) : ns; | ||
handleNoMatch(strict, ns, stylesheetPath, usedByMap) { | ||
if (strict && devMode) { | ||
const usedBy = usedByMap.get(ns); | ||
if (usedBy) { | ||
if (!existsSync(usedBy)) { | ||
usedByMap.set(ns, stylesheetPath); | ||
return ns; | ||
} | ||
} | ||
} | ||
return strict ? defaultNoMatchHandler(strict, ns, stylesheetPath, usedByMap) : ns; | ||
}, | ||
@@ -45,0 +58,0 @@ hashSalt: '', |
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
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
35799
550
Updated@stylable/build-tools@^6.0.1
Updated@stylable/core@^6.0.1