@stylable/module-utils
Advanced tools
Comparing version 3.4.5 to 3.5.0
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./module-source")); | ||
__export(require("./module-factory")); | ||
__exportStar(require("./module-source"), exports); | ||
__exportStar(require("./module-factory"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -7,6 +7,5 @@ import { StylableConfig } from '@stylable/core'; | ||
renderableOnly: boolean; | ||
legacyRuntime: boolean; | ||
staticImports: string[]; | ||
} | ||
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, staticImports, }?: Partial<Options>): (source: string, path: string) => string; | ||
//# sourceMappingURL=module-factory.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stylableModuleFactory = void 0; | ||
const core_1 = require("@stylable/core"); | ||
const module_source_1 = require("./module-source"); | ||
function stylableModuleFactory(stylableOptions, { runtimePath = '@stylable/runtime', runtimeStylesheetId = 'module', injectCSS = true, renderableOnly = false, legacyRuntime, staticImports = [], } = {}) { | ||
let afterModule = ''; | ||
function stylableModuleFactory(stylableOptions, { runtimePath = '@stylable/runtime', runtimeStylesheetId = 'module', injectCSS = true, renderableOnly = false, staticImports = [], } = {}) { | ||
const stylable = core_1.Stylable.create(stylableOptions); | ||
if (legacyRuntime && runtimePath === '@stylable/runtime') { | ||
runtimePath = '@stylable/runtime/cjs/index-legacy'; | ||
afterModule += 'module.exports.default = module.exports;'; | ||
} | ||
return function stylableToModule(source, path) { | ||
@@ -18,3 +14,3 @@ const res = stylable.transform(source, path); | ||
], `runtime.$`, `runtime.create`, `runtime.createRenderable`, injectCSS ? JSON.stringify(res.meta.outputAst.toString()) : '""', '-1', // ToDo: calc depth for node as well | ||
'module.exports', afterModule, renderableOnly); | ||
'module.exports', '' /* afterModule */, renderableOnly); | ||
}; | ||
@@ -21,0 +17,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createModuleSource = exports.generateModuleSource = void 0; | ||
function generateModuleSource(stylableResult, moduleId, beforeModule, renderer, createFunction, createRenderableFunction, css, depth, exportsArgument, afterModule, renderableOnly = false) { | ||
@@ -4,0 +5,0 @@ const { exports, meta } = stylableResult; |
{ | ||
"name": "@stylable/module-utils", | ||
"version": "3.4.5", | ||
"version": "3.5.0", | ||
"description": "Stylable module creation utilities", | ||
@@ -14,3 +14,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@stylable/core": "^3.4.5" | ||
"@stylable/core": "^3.5.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "files": [ |
@@ -9,3 +9,2 @@ import { Stylable, StylableConfig } from '@stylable/core'; | ||
renderableOnly: boolean; | ||
legacyRuntime: boolean; | ||
staticImports: string[]; | ||
@@ -21,12 +20,6 @@ } | ||
renderableOnly = false, | ||
legacyRuntime, | ||
staticImports = [], | ||
}: Partial<Options> = {} | ||
) { | ||
let afterModule = ''; | ||
const stylable = Stylable.create(stylableOptions); | ||
if (legacyRuntime && runtimePath === '@stylable/runtime') { | ||
runtimePath = '@stylable/runtime/cjs/index-legacy'; | ||
afterModule += 'module.exports.default = module.exports;'; | ||
} | ||
return function stylableToModule(source: string, path: string) { | ||
@@ -47,3 +40,3 @@ const res = stylable.transform(source, path); | ||
'module.exports', | ||
afterModule, | ||
'' /* afterModule */, | ||
renderableOnly | ||
@@ -50,0 +43,0 @@ ); |
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
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
0
18570
250
Updated@stylable/core@^3.5.0