@stylable/core-test-kit
Advanced tools
Comparing version 4.13.0 to 4.13.1
@@ -10,2 +10,3 @@ "use strict"; | ||
const core_1 = require("@stylable/core"); | ||
const index_internal_1 = require("@stylable/core/dist/index-internal"); | ||
const generate_test_util_1 = require("./generate-test-util"); | ||
@@ -114,4 +115,4 @@ const createMatchDiagnosticState = () => ({ | ||
const source = findTestLocations(css); | ||
const root = (0, core_1.safeParse)(source.css); | ||
const res = (0, core_1.process)(root); | ||
const root = (0, index_internal_1.safeParse)(source.css); | ||
const res = (0, index_internal_1.process)(root); | ||
if (partial) { | ||
@@ -118,0 +119,0 @@ if (warnings.length === 0) { |
@@ -1,2 +0,3 @@ | ||
import { Diagnostics, FileProcessor, postProcessor, processNamespace, replaceValueHook, StylableMeta, StylableResolver, StylableTransformer, Stylable, StylableConfig } from '@stylable/core'; | ||
import { Diagnostics, FileProcessor, postProcessor, processNamespace, replaceValueHook, StylableMeta, StylableResolver, Stylable, StylableConfig } from '@stylable/core'; | ||
import { StylableTransformer } from '@stylable/core/dist/index-internal'; | ||
import * as postcss from 'postcss'; | ||
@@ -17,2 +18,3 @@ import type { IDirectoryContents } from '@file-services/types'; | ||
usedFiles?: string[]; | ||
/**@deprecated defaults to false*/ | ||
trimWS?: boolean; | ||
@@ -24,2 +26,3 @@ optimize?: boolean; | ||
export declare type RequireType = (path: string) => any; | ||
/**@deprecated use testStylableCore */ | ||
export declare function generateInfra(config: InfraConfig, diagnostics?: Diagnostics): { | ||
@@ -26,0 +29,0 @@ resolver: StylableResolver; |
@@ -28,7 +28,15 @@ "use strict"; | ||
const core_1 = require("@stylable/core"); | ||
const test_stylable_core_1 = require("./test-stylable-core"); | ||
const index_internal_1 = require("@stylable/core/dist/index-internal"); | ||
const path_1 = require("path"); | ||
const postcss = __importStar(require("postcss")); | ||
const memory_1 = require("@file-services/memory"); | ||
/**@deprecated use testStylableCore */ | ||
function generateInfra(config, diagnostics = new core_1.Diagnostics()) { | ||
const { fs, requireModule } = (0, core_1.createMinimalFS)(config); | ||
const files = {}; | ||
for (const [path, { content }] of Object.entries(config.files)) { | ||
files[path] = content; | ||
} | ||
const fs = (0, memory_1.createMemoryFs)(files); | ||
const requireModule = (0, test_stylable_core_1.createJavascriptRequireModule)(fs); | ||
const fileProcessor = (0, core_1.createStylableFileProcessor)({ | ||
@@ -50,3 +58,3 @@ fileSystem: fs, | ||
const { requireModule, fileProcessor, resolvePath } = generateInfra(config, diagnostics); | ||
return new core_1.StylableTransformer({ | ||
return new index_internal_1.StylableTransformer({ | ||
fileProcessor, | ||
@@ -64,3 +72,3 @@ moduleResolver: (directoryPath, request) => onResolve(resolvePath(directoryPath, request), directoryPath, request), | ||
function processSource(source, options = {}, resolveNamespace) { | ||
return (0, core_1.process)(postcss.parse(source, options), undefined, resolveNamespace); | ||
return (0, index_internal_1.process)(postcss.parse(source, options), undefined, resolveNamespace); | ||
} | ||
@@ -67,0 +75,0 @@ exports.processSource = processSource; |
@@ -29,2 +29,3 @@ import { Stylable, StylableConfig, StylableResults } from '@stylable/core'; | ||
} | ||
export declare function createJavascriptRequireModule(fs: IFileSystem): (id: string) => any; | ||
//# sourceMappingURL=test-stylable-core.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.testStylableCore = void 0; | ||
exports.createJavascriptRequireModule = exports.testStylableCore = void 0; | ||
const inline_expectation_1 = require("./inline-expectation"); | ||
@@ -36,3 +36,3 @@ const core_1 = require("@stylable/core"); | ||
} | ||
const meta = stylable.process(path); | ||
const meta = stylable.analyze(path); | ||
const { exports } = stylable.transform(meta); | ||
@@ -43,3 +43,3 @@ sheets[path] = { meta, exports }; | ||
for (const path of allSheets) { | ||
const meta = stylable.process(path); | ||
const meta = stylable.analyze(path); | ||
if (!meta.outputAst) { | ||
@@ -58,3 +58,2 @@ // ToDo: test | ||
}; | ||
// copied from memory-minimal | ||
function createJavascriptRequireModule(fs) { | ||
@@ -84,2 +83,3 @@ const requireModule = (id) => { | ||
} | ||
exports.createJavascriptRequireModule = createJavascriptRequireModule; | ||
//# sourceMappingURL=test-stylable-core.js.map |
{ | ||
"name": "@stylable/core-test-kit", | ||
"version": "4.13.0", | ||
"version": "4.13.1", | ||
"description": "Stylable core test-kit", | ||
@@ -11,6 +11,6 @@ "main": "dist/index.js", | ||
"@file-services/memory": "^6.0.0", | ||
"@stylable/core": "^4.13.0", | ||
"@stylable/core": "^4.13.1", | ||
"chai": "^4.3.6", | ||
"flat": "^5.0.2", | ||
"postcss": "^8.4.12" | ||
"postcss": "^8.4.13" | ||
}, | ||
@@ -17,0 +17,0 @@ "files": [ |
@@ -71,3 +71,3 @@ # @stylable/core-test-kit | ||
// transform new file | ||
const { meta, exports } = stylable.transform(stylable.process(`/new.st.css`)); | ||
const { meta, exports } = stylable.transform(stylable.analyze(`/new.st.css`)); | ||
``` | ||
@@ -74,0 +74,0 @@ |
import { expect } from 'chai'; | ||
import deindent from 'deindent'; | ||
import type { Position } from 'postcss'; | ||
import { | ||
Diagnostics, | ||
DiagnosticType, | ||
process, | ||
safeParse, | ||
StylableMeta, | ||
StylableResults, | ||
} from '@stylable/core'; | ||
import { Diagnostics, DiagnosticType, StylableMeta, StylableResults } from '@stylable/core'; | ||
import { safeParse, process } from '@stylable/core/dist/index-internal'; | ||
import { Config, generateStylableResult } from './generate-test-util'; | ||
@@ -13,0 +7,0 @@ |
import { | ||
createMinimalFS, | ||
Diagnostics, | ||
FileProcessor, | ||
postProcessor, | ||
process, | ||
processNamespace, | ||
@@ -11,3 +9,2 @@ replaceValueHook, | ||
StylableResolver, | ||
StylableTransformer, | ||
createStylableFileProcessor, | ||
@@ -18,2 +15,4 @@ createDefaultResolver, | ||
} from '@stylable/core'; | ||
import { createJavascriptRequireModule } from './test-stylable-core'; | ||
import { process, StylableTransformer } from '@stylable/core/dist/index-internal'; | ||
import { isAbsolute } from 'path'; | ||
@@ -39,2 +38,3 @@ import * as postcss from 'postcss'; | ||
usedFiles?: string[]; | ||
/**@deprecated defaults to false*/ | ||
trimWS?: boolean; | ||
@@ -48,4 +48,10 @@ optimize?: boolean; | ||
/**@deprecated use testStylableCore */ | ||
export function generateInfra(config: InfraConfig, diagnostics: Diagnostics = new Diagnostics()) { | ||
const { fs, requireModule } = createMinimalFS(config); | ||
const files: Record<string, string> = {}; | ||
for (const [path, { content }] of Object.entries(config.files)) { | ||
files[path] = content; | ||
} | ||
const fs = createMemoryFs(files); | ||
const requireModule = createJavascriptRequireModule(fs); | ||
const fileProcessor = createStylableFileProcessor({ | ||
@@ -52,0 +58,0 @@ fileSystem: fs, |
@@ -54,3 +54,3 @@ import { testInlineExpects } from './inline-expectation'; | ||
} | ||
const meta = stylable.process(path); | ||
const meta = stylable.analyze(path); | ||
const { exports } = stylable.transform(meta); | ||
@@ -62,3 +62,3 @@ sheets[path] = { meta, exports }; | ||
for (const path of allSheets) { | ||
const meta = stylable.process(path); | ||
const meta = stylable.analyze(path); | ||
if (!meta.outputAst) { | ||
@@ -78,4 +78,3 @@ // ToDo: test | ||
// copied from memory-minimal | ||
function createJavascriptRequireModule(fs: IFileSystem) { | ||
export function createJavascriptRequireModule(fs: IFileSystem) { | ||
const requireModule = (id: string): any => { | ||
@@ -82,0 +81,0 @@ if (id === '@stylable/core') { |
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
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
149908
2380
Updated@stylable/core@^4.13.1
Updatedpostcss@^8.4.13