css-module-builder
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
19
index.js
@@ -13,4 +13,3 @@ 'use strict'; | ||
defineLocals: { value: defineLocals }, | ||
get: { value: getLocal }, | ||
id: { get: getId }, | ||
get: { value: strictGetLocal }, | ||
__is_css_module__: { value: true } | ||
@@ -20,3 +19,3 @@ }; | ||
exports.initialize = function initialize(moduleId, css) { | ||
var module = []; | ||
var module = [[ moduleId, css, null ]]; | ||
@@ -29,4 +28,2 @@ Object.defineProperties(module, CSSModuleStaticProperties); | ||
module.push([ moduleId, css, null ]); | ||
return module; | ||
@@ -37,3 +34,3 @@ }; | ||
var nonCSSModuleImportId = 0; | ||
function normalizeRequire(parentModule, requiredModule) { | ||
function normalizeImport(parentModule, requiredModule) { | ||
var css, id; | ||
@@ -46,3 +43,3 @@ | ||
if (typeof requiredModule.toCssString === 'function') { | ||
id = parentModule.id + '/import__' + nonCSSModuleImportId++; | ||
id = getId(parentModule) + '/import__' + nonCSSModuleImportId++; | ||
css = requiredModule.toCssString(); | ||
@@ -105,3 +102,3 @@ | ||
function importModule(cssModule) { | ||
forEach.call(normalizeRequire(this, cssModule), function (subModule) { | ||
forEach.call(normalizeImport(this, cssModule), function (subModule) { | ||
var id = subModule[0]; | ||
@@ -127,3 +124,3 @@ | ||
function getLocal(local) { | ||
function strictGetLocal(local) { | ||
if (this.locals[local] === undefined) { | ||
@@ -136,4 +133,4 @@ throw new Error(stringify(local) + ' is not defined in ' + stringify(this.locals, null, 2)); | ||
function getId() { | ||
return this[0][0]; | ||
function getId(module) { | ||
return module[0][0]; | ||
} |
{ | ||
"name": "css-module-builder", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3360
99