@stylable/module-utils
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -10,3 +10,3 @@ import { StylableConfig } from '@stylable/core'; | ||
} | ||
export declare function stylableModuleFactory(stylableOptions: StylableConfig, { runtimePath, runtimeStylesheetId, injectCSS, renderableOnly, legacyRuntime, staticImports }?: Partial<Options>): (source: string, path: string) => string; | ||
export declare function stylableModuleFactory(stylableOptions: StylableConfig, { runtimePath, runtimeStylesheetId, injectCSS, renderableOnly, legacyRuntime, staticImports, }?: Partial<Options>): (source: string, path: string) => string; | ||
//# sourceMappingURL=module-factory.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const module_source_1 = require("./module-source"); | ||
function stylableModuleFactory(stylableOptions, { runtimePath = '@stylable/runtime', runtimeStylesheetId = 'module', injectCSS = true, renderableOnly = false, legacyRuntime, staticImports = [] } = {}) { | ||
function stylableModuleFactory(stylableOptions, { runtimePath = '@stylable/runtime', runtimeStylesheetId = 'module', injectCSS = true, renderableOnly = false, legacyRuntime, staticImports = [], } = {}) { | ||
let afterModule = ''; | ||
@@ -16,4 +16,4 @@ const stylable = core_1.Stylable.create(stylableOptions); | ||
return module_source_1.generateModuleSource(res, runtimeStylesheetId === 'module' ? 'module.id' : res.meta.namespace, [ | ||
...staticImports.map(request => `import ${JSON.stringify(request)}`), | ||
`const runtime = require(${JSON.stringify(runtimePath)})` | ||
...staticImports.map((request) => `import ${JSON.stringify(request)}`), | ||
`const runtime = require(${JSON.stringify(runtimePath)})`, | ||
], `runtime.$`, `runtime.create`, `runtime.createRenderable`, injectCSS ? JSON.stringify(res.meta.outputAst.toString()) : '""', '-1', // ToDo: calc depth for node as well | ||
@@ -20,0 +20,0 @@ 'module.exports', afterModule, renderableOnly); |
@@ -40,8 +40,8 @@ "use strict"; | ||
return generateModuleSource(stylableResult, moduleId, [ | ||
...staticRequests.map(request => `import ${JSON.stringify(request)}`), | ||
`import { $, ${importKey} } from ${JSON.stringify(runtimeRequest)}` | ||
...staticRequests.map((request) => `import ${JSON.stringify(request)}`), | ||
`import { $, ${importKey} } from ${JSON.stringify(runtimeRequest)}`, | ||
], `$`, `create`, `createRenderable`, cssString, depth, 'const { classes, keyframes, vars, stVars, cssStates, style, st, $depth, $id, $css }', // = $ | ||
[ | ||
`export { classes, keyframes, vars, stVars, cssStates, style, st, $depth, $id, $css };`, | ||
...afterModule | ||
...afterModule, | ||
].join('\n'), renderableOnly); | ||
@@ -51,4 +51,4 @@ } | ||
return generateModuleSource(stylableResult, moduleId, [ | ||
...staticRequests.map(request => `require(${JSON.stringify(request)})`), | ||
`const runtime = require(${JSON.stringify(runtimeRequest)})` | ||
...staticRequests.map((request) => `require(${JSON.stringify(request)})`), | ||
`const runtime = require(${JSON.stringify(runtimeRequest)})`, | ||
], `runtime.$`, `runtime.create`, `runtime.createRenderable`, cssString, depth, 'module.exports', afterModule.join('\n'), renderableOnly); | ||
@@ -55,0 +55,0 @@ } |
{ | ||
"name": "@stylable/module-utils", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Stylable module creation utilities", | ||
@@ -14,3 +14,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@stylable/core": "^3.4.0" | ||
"@stylable/core": "^3.4.1" | ||
}, | ||
@@ -30,3 +30,3 @@ "files": [ | ||
"license": "BSD-3-Clause", | ||
"gitHead": "af5fcd5514c9364e8fdd6fda29585ae4ea1b27e1" | ||
"gitHead": "396407607f59f09f3f07826b6028a6274371db45" | ||
} |
@@ -21,3 +21,3 @@ import { Stylable, StylableConfig } from '@stylable/core'; | ||
legacyRuntime, | ||
staticImports = [] | ||
staticImports = [], | ||
}: Partial<Options> = {} | ||
@@ -37,4 +37,4 @@ ) { | ||
[ | ||
...staticImports.map(request => `import ${JSON.stringify(request)}`), | ||
`const runtime = require(${JSON.stringify(runtimePath)})` | ||
...staticImports.map((request) => `import ${JSON.stringify(request)}`), | ||
`const runtime = require(${JSON.stringify(runtimePath)})`, | ||
], | ||
@@ -41,0 +41,0 @@ `runtime.$`, |
@@ -57,3 +57,3 @@ import { StylableResults } from '@stylable/core'; | ||
: '""'; | ||
switch (moduleFormat) { | ||
@@ -68,4 +68,4 @@ case 'dts': | ||
[ | ||
...staticRequests.map(request => `import ${JSON.stringify(request)}`), | ||
`import { $, ${importKey} } from ${JSON.stringify(runtimeRequest)}` | ||
...staticRequests.map((request) => `import ${JSON.stringify(request)}`), | ||
`import { $, ${importKey} } from ${JSON.stringify(runtimeRequest)}`, | ||
], | ||
@@ -80,3 +80,3 @@ `$`, | ||
`export { classes, keyframes, vars, stVars, cssStates, style, st, $depth, $id, $css };`, | ||
...afterModule | ||
...afterModule, | ||
].join('\n'), | ||
@@ -91,4 +91,4 @@ renderableOnly | ||
[ | ||
...staticRequests.map(request => `require(${JSON.stringify(request)})`), | ||
`const runtime = require(${JSON.stringify(runtimeRequest)})` | ||
...staticRequests.map((request) => `require(${JSON.stringify(request)})`), | ||
`const runtime = require(${JSON.stringify(runtimeRequest)})`, | ||
], | ||
@@ -95,0 +95,0 @@ `runtime.$`, |
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
18778
Updated@stylable/core@^3.4.1