scss-bundle
Advanced tools
Comparing version 0.0.0-canary.3100315 to 0.0.0-canary.048dc82
@@ -65,6 +65,6 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var dirname, importsPromises, imports, bundleResult, shouldCheckForDedupes, currentImports, _i, imports_1, imp, contentToReplace, currentImport, impContent, bundledImport, childImports, timesUsed; | ||
var dirname, importsPromises, imports, bundleResult, shouldCheckForDedupes, currentImports, _i, imports_1, imp, contentToReplace, currentImport, impContent, _a, bundledImport, childImports, timesUsed; | ||
var _this = this; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
@@ -115,3 +115,3 @@ // Remove commented imports | ||
case 1: | ||
imports = _a.sent(); | ||
imports = _b.sent(); | ||
bundleResult = { | ||
@@ -124,5 +124,5 @@ filePath: filePath, | ||
_i = 0, imports_1 = imports; | ||
_a.label = 2; | ||
_b.label = 2; | ||
case 2: | ||
if (!(_i < imports_1.length)) return [3 /*break*/, 9]; | ||
if (!(_i < imports_1.length)) return [3 /*break*/, 11]; | ||
imp = imports_1[_i]; | ||
@@ -139,21 +139,26 @@ contentToReplace = void 0; | ||
}; | ||
return [3 /*break*/, 7]; | ||
return [3 /*break*/, 9]; | ||
case 3: | ||
if (!(this.fileRegistry[imp.fullPath] == null)) return [3 /*break*/, 6]; | ||
if (!(this.usedImports[imp.fullPath] == null)) return [3 /*break*/, 8]; | ||
// Add it to used imports | ||
this.usedImports[imp.fullPath] = 1; | ||
if (!(this.fileRegistry[imp.fullPath] == null)) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, fs_extra_1.default.readFile(imp.fullPath, "utf-8")]; | ||
case 4: | ||
impContent = _a.sent(); | ||
_a = _b.sent(); | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
_a = this.fileRegistry[imp.fullPath]; | ||
_b.label = 6; | ||
case 6: | ||
impContent = _a; | ||
return [4 /*yield*/, this._bundle(imp.fullPath, impContent, dedupeFiles, includePaths, ignoredImports)]; | ||
case 5: | ||
bundledImport = _a.sent(); | ||
case 7: | ||
bundledImport = _b.sent(); | ||
// Then add its bundled content to the registry | ||
this.fileRegistry[imp.fullPath] = bundledImport.bundledContent; | ||
// Add it to used imports, if it's not there | ||
if (this.usedImports != null && this.usedImports[imp.fullPath] == null) { | ||
this.usedImports[imp.fullPath] = 1; | ||
} | ||
// And whole BundleResult to current imports | ||
currentImport = bundledImport; | ||
return [3 /*break*/, 7]; | ||
case 6: | ||
return [3 /*break*/, 9]; | ||
case 8: | ||
// File is in the registry | ||
@@ -175,4 +180,4 @@ // Increment it's usage count | ||
}; | ||
_a.label = 7; | ||
case 7: | ||
_b.label = 9; | ||
case 9: | ||
if (imp.ignored) { | ||
@@ -209,7 +214,7 @@ if (this.usedImports[imp.fullPath] > 1) { | ||
currentImports.push(currentImport); | ||
_a.label = 8; | ||
case 8: | ||
_b.label = 10; | ||
case 10: | ||
_i++; | ||
return [3 /*break*/, 2]; | ||
case 9: | ||
case 11: | ||
// Set result properties | ||
@@ -244,9 +249,15 @@ bundleResult.bundledContent = content; | ||
case 0: | ||
_a.trys.push([0, 2, , 7]); | ||
if (this.fileRegistry[importData.fullPath]) { | ||
importData.found = true; | ||
return [2 /*return*/, importData]; | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 8]); | ||
return [4 /*yield*/, fs_extra_1.default.access(importData.fullPath)]; | ||
case 1: | ||
case 2: | ||
_a.sent(); | ||
importData.found = true; | ||
return [3 /*break*/, 7]; | ||
case 2: | ||
return [3 /*break*/, 8]; | ||
case 3: | ||
error_1 = _a.sent(); | ||
@@ -256,12 +267,12 @@ underscoredDirname = path_1.default.dirname(importData.fullPath); | ||
underscoredFilePath = path_1.default.join(underscoredDirname, "_" + underscoredBasename); | ||
_a.label = 3; | ||
case 3: | ||
_a.trys.push([3, 5, , 6]); | ||
_a.label = 4; | ||
case 4: | ||
_a.trys.push([4, 6, , 7]); | ||
return [4 /*yield*/, fs_extra_1.default.access(underscoredFilePath)]; | ||
case 4: | ||
case 5: | ||
_a.sent(); | ||
importData.fullPath = underscoredFilePath; | ||
importData.found = true; | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
return [3 /*break*/, 7]; | ||
case 6: | ||
underscoreErr_1 = _a.sent(); | ||
@@ -275,5 +286,5 @@ // If there are any includePaths | ||
} | ||
return [3 /*break*/, 6]; | ||
case 6: return [3 /*break*/, 7]; | ||
case 7: return [2 /*return*/, importData]; | ||
return [3 /*break*/, 7]; | ||
case 7: return [3 /*break*/, 8]; | ||
case 8: return [2 /*return*/, importData]; | ||
} | ||
@@ -280,0 +291,0 @@ }); |
{ | ||
"name": "scss-bundle", | ||
"version": "0.0.0-canary.3100315", | ||
"version": "0.0.0-canary.048dc82", | ||
"description": "Bundling SCSS files to one bundled file.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
55276
960