scss-bundle
Advanced tools
Comparing version 0.0.0-canary.a99866c to 0.0.0-canary.cae5b9e
@@ -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 @@ }); |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
export {}; |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "scss-bundle", | ||
"version": "0.0.0-canary.a99866c", | ||
"version": "0.0.0-canary.cae5b9e", | ||
"description": "Bundling SCSS files to one bundled file.", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
"dist", | ||
"**/*.md", | ||
"docs", | ||
"*.js", | ||
@@ -29,3 +29,3 @@ "!*.config.js" | ||
"bin": { | ||
"scss-bundle": "./dist/cli/main.js" | ||
"scss-bundle": "dist/cli/main.js" | ||
}, | ||
@@ -49,3 +49,3 @@ "author": "ReactWay <dev@reactway.com> (https://github.com/reactway)", | ||
"@types/archy": "^0.0.31", | ||
"@types/debug": "^4.1.4", | ||
"@types/debug": "^4.1.5", | ||
"@types/fs-extra": "^8.0.0", | ||
@@ -58,3 +58,3 @@ "@types/glob": "^7.1.1", | ||
"chokidar": "^3.0.2", | ||
"commander": "^2.20.0", | ||
"commander": "^3.0.0", | ||
"fs-extra": "^8.1.0", | ||
@@ -66,3 +66,4 @@ "globs": "^0.1.4", | ||
"pretty-bytes": "^5.3.0", | ||
"sass": "^1.22.9" | ||
"sass": "^1.22.9", | ||
"tslib": "^1.10.0" | ||
}, | ||
@@ -69,0 +70,0 @@ "jest": { |
@@ -7,4 +7,7 @@ # scss-bundle | ||
[![NPM version](https://img.shields.io/npm/v/scss-bundle/canary.svg?logo=npm)](https://www.npmjs.com/package/scss-bundle/v/canary) | ||
[![Total downloads](https://img.shields.io/npm/dt/scss-bundle.svg)](https://www.npmjs.com/package/scss-bundle) | ||
[![Build Status](https://img.shields.io/azure-devops/build/reactway/reactway/13/master.svg?logo=azuredevops)](https://dev.azure.com/reactway/ReactWay/_build/latest?definitionId=13&branchName=master) | ||
[![Code coverage](https://img.shields.io/azure-devops/coverage/reactway/reactway/13/master.svg)](https://dev.azure.com/reactway/ReactWay/_build/latest?definitionId=13&branchName=master) | ||
[![Dependencies](https://img.shields.io/david/reactway/tiny-emitter.svg)](https://david-dm.org/reactway/scss-bundle) | ||
@@ -11,0 +14,0 @@ [![Dev dependencies](https://img.shields.io/david/dev/reactway/tiny-emitter.svg)](https://david-dm.org/reactway/scss-bundle?type=dev) |
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
960
186
55276
18
45
+ Addedtslib@^1.10.0
+ Addedcommander@3.0.2(transitive)
+ Addedtslib@1.14.1(transitive)
- Removedcommander@2.20.3(transitive)
Updated@types/debug@^4.1.5
Updatedcommander@^3.0.0