@stylable/core-test-kit
Advanced tools
Comparing version 5.16.1 to 6.0.0-rc.1
import { Diagnostics, processNamespace, StylableMeta, Stylable, StylableConfig } from '@stylable/core'; | ||
import { FileProcessor, StylableResolver, StylableTransformer, postProcessor, replaceValueHook } from '@stylable/core/dist/index-internal'; | ||
import * as postcss from 'postcss'; | ||
import type { IFileSystem } from '@file-services/types'; | ||
import type { IDirectoryContents } from '@file-services/types'; | ||
@@ -43,6 +44,7 @@ export interface File { | ||
export declare function createProcess(fileProcessor: FileProcessor<StylableMeta>): (path: string) => StylableMeta; | ||
export declare function createResolveExtendsResults(fileSystem: IFileSystem, fileToProcess: string, classNameToLookup: string, isElement?: boolean): import("@stylable/core/dist/stylable-resolver").CSSResolvePath; | ||
export declare function generateStylableResult(config: Config, diagnostics?: Diagnostics): import("@stylable/core").StylableResults; | ||
export declare function generateStylableRoot(config: Config): postcss.Root; | ||
export declare function generateStylableExports(config: Config): import("@stylable/core/dist/stylable-transformer").StylableExports; | ||
export declare function generateStylableEnvironment(content: IDirectoryContents, stylableConfig?: Partial<StylableConfig>): { | ||
export declare function generateStylableEnvironment(content: IDirectoryContents, stylableConfig?: Partial<Omit<StylableConfig, 'fileSystem'>>): { | ||
stylable: Stylable; | ||
@@ -49,0 +51,0 @@ fs: import("@file-services/memory").IMemFileSystem; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateStylableEnvironment = exports.generateStylableExports = exports.generateStylableRoot = exports.generateStylableResult = exports.createProcess = exports.processSource = exports.createTransformer = exports.generateInfra = void 0; | ||
exports.generateStylableEnvironment = exports.generateStylableExports = exports.generateStylableRoot = exports.generateStylableResult = exports.createResolveExtendsResults = exports.createProcess = exports.processSource = exports.createTransformer = exports.generateInfra = void 0; | ||
const core_1 = require("@stylable/core"); | ||
@@ -50,3 +50,3 @@ const test_stylable_core_1 = require("./test-stylable-core"); | ||
}); | ||
const resolveModule = (0, core_1.createDefaultResolver)(fs, {}); | ||
const resolveModule = (0, core_1.createDefaultResolver)({ fs }); | ||
const resolvePath = (context = '/', moduleId) => resolveModule(context, moduleId); | ||
@@ -79,2 +79,10 @@ const resolver = new index_internal_1.StylableResolver(fileProcessor, requireModule, resolvePath); | ||
exports.createProcess = createProcess; | ||
function createResolveExtendsResults(fileSystem, fileToProcess, classNameToLookup, isElement = false) { | ||
const stylable = new core_1.Stylable({ | ||
fileSystem, | ||
projectRoot: '/', | ||
}); | ||
return stylable.resolver.resolveExtends(stylable.analyze(fileToProcess), classNameToLookup, isElement); | ||
} | ||
exports.createResolveExtendsResults = createResolveExtendsResults; | ||
function generateStylableResult(config, diagnostics = new core_1.Diagnostics()) { | ||
@@ -81,0 +89,0 @@ const { entry } = config; |
export { Diagnostic, expectAnalyzeDiagnostics, expectTransformDiagnostics, findTestLocations, shouldReportNoDiagnostics, diagnosticBankReportToStrings, } from './diagnostics'; | ||
export { Config, File, InfraConfig, RequireType, createProcess, createTransformer, generateInfra, generateStylableExports, generateStylableResult, generateStylableRoot, processSource, generateStylableEnvironment, } from './generate-test-util'; | ||
export { Config, File, InfraConfig, RequireType, createProcess, createTransformer, generateInfra, generateStylableExports, generateStylableResult, generateStylableRoot, processSource, generateStylableEnvironment, createResolveExtendsResults, } from './generate-test-util'; | ||
export { flatMatch } from './matchers/flat-match'; | ||
@@ -4,0 +4,0 @@ export { matchCSSMatchers } from './matchers/match-css'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.logCalls = exports.spyCalls = exports.assertRule = exports.assertDecl = exports.assertComment = exports.assertAtRule = exports.copyDirectory = exports.createTempDirectorySync = exports.MinimalElement = exports.MinimalDocument = exports.deindent = exports.testStylableCore = exports.testInlineExpectsErrors = exports.testInlineExpects = exports.collectAst = exports.matchRuleAndDeclaration = exports.matchAllRulesAndDeclarations = exports.matchCSSMatchers = exports.flatMatch = exports.generateStylableEnvironment = exports.processSource = exports.generateStylableRoot = exports.generateStylableResult = exports.generateStylableExports = exports.generateInfra = exports.createTransformer = exports.createProcess = exports.diagnosticBankReportToStrings = exports.shouldReportNoDiagnostics = exports.findTestLocations = exports.expectTransformDiagnostics = exports.expectAnalyzeDiagnostics = void 0; | ||
exports.logCalls = exports.spyCalls = exports.assertRule = exports.assertDecl = exports.assertComment = exports.assertAtRule = exports.copyDirectory = exports.createTempDirectorySync = exports.MinimalElement = exports.MinimalDocument = exports.deindent = exports.testStylableCore = exports.testInlineExpectsErrors = exports.testInlineExpects = exports.collectAst = exports.matchRuleAndDeclaration = exports.matchAllRulesAndDeclarations = exports.matchCSSMatchers = exports.flatMatch = exports.createResolveExtendsResults = exports.generateStylableEnvironment = exports.processSource = exports.generateStylableRoot = exports.generateStylableResult = exports.generateStylableExports = exports.generateInfra = exports.createTransformer = exports.createProcess = exports.diagnosticBankReportToStrings = exports.shouldReportNoDiagnostics = exports.findTestLocations = exports.expectTransformDiagnostics = exports.expectAnalyzeDiagnostics = void 0; | ||
var diagnostics_1 = require("./diagnostics"); | ||
@@ -19,2 +19,3 @@ Object.defineProperty(exports, "expectAnalyzeDiagnostics", { enumerable: true, get: function () { return diagnostics_1.expectAnalyzeDiagnostics; } }); | ||
Object.defineProperty(exports, "generateStylableEnvironment", { enumerable: true, get: function () { return generate_test_util_1.generateStylableEnvironment; } }); | ||
Object.defineProperty(exports, "createResolveExtendsResults", { enumerable: true, get: function () { return generate_test_util_1.createResolveExtendsResults; } }); | ||
var flat_match_1 = require("./matchers/flat-match"); | ||
@@ -21,0 +22,0 @@ Object.defineProperty(exports, "flatMatch", { enumerable: true, get: function () { return flat_match_1.flatMatch; } }); |
{ | ||
"name": "@stylable/core-test-kit", | ||
"version": "5.16.1", | ||
"version": "6.0.0-rc.1", | ||
"description": "Stylable core test-kit", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@file-services/memory": "^8.3.1", | ||
"@stylable/core": "^5.16.1", | ||
"@file-services/memory": "^8.3.2", | ||
"@stylable/core": "^5.16.0", | ||
"chai": "^4.3.10", | ||
@@ -24,3 +24,3 @@ "flat": "^5.0.2", | ||
"engines": { | ||
"node": ">=14.14.0" | ||
"node": ">=18.12.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "publishConfig": { |
@@ -22,2 +22,3 @@ import { | ||
import { createMemoryFs } from '@file-services/memory'; | ||
import type { IFileSystem } from '@file-services/types'; | ||
import type { IDirectoryContents } from '@file-services/types'; | ||
@@ -66,3 +67,3 @@ | ||
const resolveModule = createDefaultResolver(fs, {}); | ||
const resolveModule = createDefaultResolver({ fs }); | ||
const resolvePath = (context: string | undefined = '/', moduleId: string) => | ||
@@ -123,2 +124,20 @@ resolveModule(context, moduleId); | ||
export function createResolveExtendsResults( | ||
fileSystem: IFileSystem, | ||
fileToProcess: string, | ||
classNameToLookup: string, | ||
isElement = false | ||
) { | ||
const stylable = new Stylable({ | ||
fileSystem, | ||
projectRoot: '/', | ||
}); | ||
return stylable.resolver.resolveExtends( | ||
stylable.analyze(fileToProcess), | ||
classNameToLookup, | ||
isElement | ||
); | ||
} | ||
export function generateStylableResult( | ||
@@ -146,3 +165,3 @@ config: Config, | ||
content: IDirectoryContents, | ||
stylableConfig: Partial<StylableConfig> = {} | ||
stylableConfig: Partial<Omit<StylableConfig, 'fileSystem'>> = {} | ||
) { | ||
@@ -149,0 +168,0 @@ const fs = createMemoryFs(content); |
@@ -22,2 +22,3 @@ export { | ||
generateStylableEnvironment, | ||
createResolveExtendsResults, | ||
} from './generate-test-util'; | ||
@@ -24,0 +25,0 @@ export { flatMatch } from './matchers/flat-match'; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
185144
3036
1
2
Updated@file-services/memory@^8.3.2
Updated@stylable/core@^5.16.0