@stylable/module-utils
Advanced tools
Comparing version 2.2.1 to 2.2.2
import { StylableResults } from '@stylable/core'; | ||
export declare function generateModuleSource(stylableResult: StylableResults, moduleId: string, beforeModule: string[], renderer: string, createFunction: string, createRenderableFunction: string, css: string, depth: string, exportsArgument: string, afterModule: string, renderableOnly?: boolean): string; | ||
export declare function createModuleSource(stylableResult: StylableResults, moduleFormat: string | undefined, includeCSSInJS: boolean, moduleId?: string, renderableOnly?: boolean, depth?: string | number, staticRequests?: string[]): string; | ||
export declare function createModuleSource(stylableResult: StylableResults, moduleFormat: string | undefined, includeCSSInJS: boolean, moduleId?: string, renderableOnly?: boolean, depth?: string | number, staticRequests?: string[], runtimeRequest?: string): string; | ||
//# sourceMappingURL=module-source.d.ts.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.generateModuleSource = generateModuleSource; | ||
function createModuleSource(stylableResult, moduleFormat, includeCSSInJS, moduleId, renderableOnly, depth, staticRequests) { | ||
function createModuleSource(stylableResult, moduleFormat, includeCSSInJS, moduleId, renderableOnly, depth, staticRequests, runtimeRequest) { | ||
if (moduleFormat === void 0) { moduleFormat = 'cjs'; } | ||
@@ -21,2 +21,3 @@ if (moduleId === void 0) { moduleId = JSON.stringify(stylableResult.meta.namespace); } | ||
if (staticRequests === void 0) { staticRequests = []; } | ||
if (runtimeRequest === void 0) { runtimeRequest = '@stylable/runtime'; } | ||
// TODO: calc depth for node as well | ||
@@ -34,7 +35,7 @@ depth = typeof depth === 'number' ? depth.toString() : depth; | ||
return generateModuleSource(stylableResult, moduleId, staticRequests.map(function (request) { return "import " + JSON.stringify(request); }).concat([ | ||
"import { $, " + importKey + " } from " + JSON.stringify('@stylable/runtime') | ||
"import { $, " + importKey + " } from " + JSON.stringify(runtimeRequest) | ||
]), "$", "create", "createRenderable", includeCSSInJS ? JSON.stringify(stylableResult.meta.outputAst.toString()) : '""', depth, 'const { classes, keyframes, vars, stVars, cssStates, style, st, $depth, $id, $css }', "export { classes, keyframes, vars, stVars, cssStates, style, st, $depth, $id, $css };", renderableOnly); | ||
case 'cjs': | ||
return generateModuleSource(stylableResult, moduleId, staticRequests.map(function (request) { return "require(" + JSON.stringify(request) + ")"; }).concat([ | ||
"const runtime = require(" + JSON.stringify('@stylable/runtime') + ")" | ||
"const runtime = require(" + JSON.stringify(runtimeRequest) + ")" | ||
]), "runtime.$", "runtime.create", "runtime.createRenderable", includeCSSInJS ? JSON.stringify(stylableResult.meta.outputAst.toString()) : '""', depth, 'module.exports', '', renderableOnly); | ||
@@ -41,0 +42,0 @@ } |
{ | ||
"name": "@stylable/module-utils", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Stylable module creation utilities", | ||
@@ -27,3 +27,3 @@ "main": "cjs/index.js", | ||
"license": "BSD-3-Clause", | ||
"gitHead": "0f3682cc13ba8ba076518f8ecc21bc373a20d61e" | ||
"gitHead": "4666c8c1e3d320d678e4c78b502ce33f2dc9bb2b" | ||
} |
@@ -43,3 +43,4 @@ import { StylableResults } from '@stylable/core'; | ||
depth: string | number = '-1', | ||
staticRequests: string[] = [] | ||
staticRequests: string[] = [], | ||
runtimeRequest: string = '@stylable/runtime' | ||
) { | ||
@@ -64,3 +65,3 @@ // TODO: calc depth for node as well | ||
...staticRequests.map(request => `import ${JSON.stringify(request)}`), | ||
`import { $, ${importKey} } from ${JSON.stringify('@stylable/runtime')}` | ||
`import { $, ${importKey} } from ${JSON.stringify(runtimeRequest)}` | ||
], | ||
@@ -82,3 +83,3 @@ `$`, | ||
...staticRequests.map(request => `require(${JSON.stringify(request)})`), | ||
`const runtime = require(${JSON.stringify('@stylable/runtime')})` | ||
`const runtime = require(${JSON.stringify(runtimeRequest)})` | ||
], | ||
@@ -85,0 +86,0 @@ `runtime.$`, |
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
19046
229