@angular-devkit/build-optimizer
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "@angular-devkit/build-optimizer", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Angular Build Optimizer", | ||
@@ -13,3 +13,2 @@ "main": "src/index.js", | ||
"loader-utils": "^1.1.0", | ||
"magic-string": "^0.19.1", | ||
"source-map": "^0.5.6", | ||
@@ -16,0 +15,0 @@ "typescript": "^2.3.3" |
@@ -23,3 +23,3 @@ # Angular Build Optimizer | ||
``` | ||
```typescript | ||
// input | ||
@@ -38,3 +38,3 @@ var Clazz = (function () { function Clazz() { } return Clazz; }()); | ||
``` | ||
```typescript | ||
// input | ||
@@ -61,3 +61,3 @@ import { Injectable, Input } from '@angular/core'; | ||
``` | ||
```typescript | ||
// input | ||
@@ -79,3 +79,3 @@ var Clazz = (function () { function Clazz() { } return Clazz; }()); | ||
``` | ||
```typescript | ||
// input | ||
@@ -101,3 +101,3 @@ var __extends = (this && this.__extends) || function (d, b) { | ||
``` | ||
```typescript | ||
import { buildOptimizer } from '@angular-devkit/build-optimizer'; | ||
@@ -109,3 +109,3 @@ | ||
Available options: | ||
``` | ||
```typescript | ||
export interface BuildOptimizerOptions { | ||
@@ -123,3 +123,3 @@ content?: string; | ||
``` | ||
```typescript | ||
const PurifyPlugin = require('@angular-devkit/build-optimizer').PurifyPlugin; | ||
@@ -148,3 +148,3 @@ | ||
``` | ||
```bash | ||
build-optimizer input.js | ||
@@ -151,0 +151,0 @@ build-optimizer input.js output.js |
@@ -1,3 +0,2 @@ | ||
/// <reference types="source-map" /> | ||
import { RawSourceMap } from 'source-map'; | ||
import { TransformJavascriptOutput } from '../helpers/transform-javascript'; | ||
export interface BuildOptimizerOptions { | ||
@@ -10,5 +9,2 @@ content?: string; | ||
} | ||
export declare function buildOptimizer(options: BuildOptimizerOptions): { | ||
content: string; | ||
sourceMap: RawSourceMap | null; | ||
}; | ||
export declare function buildOptimizer(options: BuildOptimizerOptions): TransformJavascriptOutput; |
@@ -11,3 +11,2 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const MagicString = require('magic-string'); | ||
const transform_javascript_1 = require("../helpers/transform-javascript"); | ||
@@ -21,10 +20,10 @@ const class_fold_1 = require("../transforms/class-fold"); | ||
const hasTsHelpers = /var (__extends|__decorate|__metadata|__param) = /; | ||
const isAngularPackage = /(\\|\/)node_modules(\\|\/)@angular(\\|\/)/; | ||
function buildOptimizer(options) { | ||
options.emitSourceMap = !!options.emitSourceMap; | ||
const { inputFilePath, emitSourceMap, outputFilePath, strict } = options; | ||
const { inputFilePath } = options; | ||
let { content } = options; | ||
if (!inputFilePath && !content) { | ||
if (!inputFilePath && content === undefined) { | ||
throw new Error('Either filePath or content must be specified in options.'); | ||
} | ||
if (!content) { | ||
if (content === undefined) { | ||
content = fs_1.readFileSync(inputFilePath, 'UTF-8'); | ||
@@ -37,42 +36,17 @@ } | ||
} | ||
if (hasDecorators.test(content) || hasCtorParameters.test(content)) { | ||
if (inputFilePath && isAngularPackage.test(inputFilePath)) { | ||
// Order matters, getPrefixFunctionsTransformer needs to be called before | ||
// getFoldFileTransformer. | ||
getTransforms.push(...[ | ||
prefix_functions_1.getPrefixFunctionsTransformer, | ||
scrub_file_1.getScrubFileTransformer, | ||
class_fold_1.getFoldFileTransformer, | ||
]); | ||
getTransforms.push( | ||
// getPrefixFunctionsTransformer is rather dangerous. | ||
// It will mark both `require()` calls and `console.log(stuff)` as pure. | ||
// We only apply it to @angular/* packages, since we know they are safe. | ||
prefix_functions_1.getPrefixFunctionsTransformer, scrub_file_1.getScrubFileTransformer, class_fold_1.getFoldFileTransformer); | ||
} | ||
if (getTransforms.length > 0) { | ||
// Only transform if there are transforms to apply. | ||
return transform_javascript_1.transformJavascript({ | ||
content, | ||
getTransforms, | ||
emitSourceMap, | ||
inputFilePath, | ||
outputFilePath, | ||
strict, | ||
}); | ||
else if (hasDecorators.test(content) || hasCtorParameters.test(content)) { | ||
getTransforms.push(scrub_file_1.getScrubFileTransformer, class_fold_1.getFoldFileTransformer); | ||
} | ||
else if (emitSourceMap) { | ||
// Emit a sourcemap with no changes. | ||
const ms = new MagicString(content); | ||
return { | ||
content, | ||
sourceMap: ms.generateMap({ | ||
source: inputFilePath, | ||
file: outputFilePath ? `${outputFilePath}.map` : null, | ||
includeContent: true, | ||
}), | ||
}; | ||
} | ||
else { | ||
return { | ||
content, | ||
sourceMap: null, | ||
}; | ||
} | ||
return transform_javascript_1.transformJavascript(Object.assign({}, options, { getTransforms, content })); | ||
} | ||
exports.buildOptimizer = buildOptimizer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQtb3B0aW1pemVyLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9oYW5zbC9Tb3VyY2VzL2RldmtpdC8iLCJzb3VyY2VzIjpbInBhY2thZ2VzL2FuZ3VsYXJfZGV2a2l0L2J1aWxkX29wdGltaXplci9zcmMvYnVpbGQtb3B0aW1pemVyL2J1aWxkLW9wdGltaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7R0FNRztBQUNILDJCQUFrQztBQUVsQyxNQUFNLFdBQVcsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBQUM7QUFFNUMsMEVBQXNFO0FBQ3RFLHlEQUFrRTtBQUNsRSw2REFBdUU7QUFDdkUscUVBQStFO0FBQy9FLHlEQUFtRTtBQUduRSxNQUFNLGFBQWEsR0FBRyxZQUFZLENBQUM7QUFDbkMsTUFBTSxpQkFBaUIsR0FBRyxnQkFBZ0IsQ0FBQztBQUMzQyxNQUFNLFlBQVksR0FBRyxrREFBa0QsQ0FBQztBQVV4RSx3QkFBK0IsT0FBOEI7SUFHM0QsT0FBTyxDQUFDLGFBQWEsR0FBRyxDQUFDLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQztJQUNoRCxNQUFNLEVBQUUsYUFBYSxFQUFFLGFBQWEsRUFBRS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tYXR0ZXJzLCBnZXRQcmVmaXhGdW5jdGlvbnNUcmFuc2Zvcm1lciBuZWVkcyB0byBiZSBjYWxsZWQgYmVmb3JlXG4gICAgLy8gZ2V0Rm9sZEZpbGVUcmFuc2Zvcm1lci5cbiAgICBnZXRUcmFuc2Zvcm1zLnB1c2goXG4gICAgICAvLyBnZXRQcmVmaXhGdW5jdGlvbnNUcmFuc2Zvcm1lciBpcyByYXRoZXIgZGFuZ2Vyb3VzLlxuICAgICAgLy8gSXQgd2lsbCBtYXJrIGJvdGggYHJlcXVpcmUoKWAgY2FsbHMgYW5kIGBjb25zb2xlLmxvZyhzdHVmZilgIGFzIHB1cmUuXG4gICAgICAvLyBXZSBvbmx5IGFwcGx5IGl0IHRvIEBhbmd1bGFyLyogcGFja2FnZXMsIHNpbmNlIHdlIGtub3cgdGhleSBhcmUgc2FmZS5cbiAgICAgIGdldFByZWZpeEZ1bmN0aW9uc1RyYW5zZm9ybWVyLFxuICAgICAgZ2V0U2NydWJGaWxlVHJhbnNmb3JtZXIsXG4gICAgICBnZXRGb2xkRmlsZVRyYW5zZm9ybWVyLFxuICAgICk7XG4gIH0gZWxzZSBpZiAoaGFzRGVjb3JhdG9ycy50ZXN0KGNvbnRlbnQpIHx8IGhhc0N0b3JQYXJhbWV0ZXJzLnRlc3QoY29udGVudCkpIHtcbiAgICBnZXRUcmFuc2Zvcm1zLnB1c2goXG4gICAgICBnZXRTY3J1YkZpbGVUcmFuc2Zvcm1lcixcbiAgICAgIGdldEZvbGRGaWxlVHJhbnNmb3JtZXIsXG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiB0cmFuc2Zvcm1KYXZhc2NyaXB0KHsgLi4ub3B0aW9ucywgZ2V0VHJhbnNmb3JtcywgY29udGVudCB9KTtcbn1cbiJdfQ== |
@@ -28,4 +28,9 @@ #!/usr/bin/env node | ||
}); | ||
fs_1.writeFileSync(path_1.join(currentDir, outputFile), boOutput.content); | ||
fs_1.writeFileSync(path_1.join(currentDir, `${out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XG53cml0ZUZpbGVTeW5jKGpvaW4oY3VycmVudERpciwgYCR7b3V0cHV0RmlsZX0ubWFwYCksIEpTT04uc3RyaW5naWZ5KGJvT3V0cHV0LnNvdXJjZU1hcCkpO1xuIl19 | ||
if (boOutput.emitSkipped) { | ||
console.log('Nothing to emit.'); | ||
} | ||
else { | ||
fs_1.writeFileSync(path_1.join(currentDir, outputFile), boOutput.content); | ||
fs_1.writeFileSync(path_1.join(currentDir, `${outputFile}.map`), JSON.stringify(boOutput.sourceMap)); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9oYW5zbC9Tb3VyY2VzL2RldmtpdC8iLCJzb3VyY2VzIjpbInBhY2thZ2VzL2FuZ3VsYXJfZGV2a2l0L2J1aWxkX29wdGltaXplci9zcmMvYnVpbGQtb3B0aW1pemVyL2NsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFRQSwyQkFBbUM7QUFDbkMsK0JBQTRCO0FBQzVCLHVEQUFtRDtBQUduRCxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxDQUFDLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN2RCxNQUFNLElBQUksS0FBSyxDQUFDOzs7OztHQUtmLENBQUMsQ0FBQztBQUNMLENBQUM7QUFFRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFakMsTUFBTSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNsQyxNQUFNLFlBQVksR0FBRyxXQUFXLENBQUM7QUFFakMsRUFBRSxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFlBQVks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bmNvbnN0IG91dHB1dEZpbGUgPSBwcm9jZXNzLmFyZ3ZbM10gfHwgaW5wdXRGaWxlLnJlcGxhY2UodHNPckpzUmVnRXhwLCAoc3ViU3RyKSA9PiBgLmJvJHtzdWJTdHJ9YCk7XG5cbmNvbnN0IGJvT3V0cHV0ID0gYnVpbGRPcHRpbWl6ZXIoe1xuICBpbnB1dEZpbGVQYXRoOiBqb2luKGN1cnJlbnREaXIsIGlucHV0RmlsZSksXG4gIG91dHB1dEZpbGVQYXRoOiBqb2luKGN1cnJlbnREaXIsIG91dHB1dEZpbGUpLFxuICBlbWl0U291cmNlTWFwOiB0cnVlLFxufSk7XG5cbmlmIChib091dHB1dC5lbWl0U2tpcHBlZCkge1xuICBjb25zb2xlLmxvZygnTm90aGluZyB0byBlbWl0LicpO1xufSBlbHNlIHtcbiAgd3JpdGVGaWxlU3luYyhqb2luKGN1cnJlbnREaXIsIG91dHB1dEZpbGUpLCBib091dHB1dC5jb250ZW50KTtcbiAgd3JpdGVGaWxlU3luYyhqb2luKGN1cnJlbnREaXIsIGAke291dHB1dEZpbGV9Lm1hcGApLCBKU09OLnN0cmluZ2lmeShib091dHB1dC5zb3VyY2VNYXApKTtcbn1cbiJdfQ== |
@@ -1,2 +0,1 @@ | ||
/// <reference types="source-map" /> | ||
/** | ||
@@ -3,0 +2,0 @@ * @license |
@@ -16,3 +16,16 @@ "use strict"; | ||
const options = loaderUtils.getOptions(this) || {}; | ||
const boOutput = build_optimizer_1.buildOptimizer({ content, emitSourceMap: options.sourceMap }); | ||
const boOutput = build_optimizer_1.buildOptimizer({ | ||
content, | ||
inputFilePath: this.resourcePath, | ||
// Add a name to the build optimizer output. | ||
// Without a name the sourcemaps cannot be properly chained. | ||
outputFilePath: this.resourcePath + '.build-optimizer.js', | ||
emitSourceMap: options.sourceMap, | ||
}); | ||
if (boOutput.emitSkipped || boOutput.content === null) { | ||
// Webpack typings for previousSourceMap are wrong, they are JSON objects and not strings. | ||
// tslint:disable-next-line:no-any | ||
this.callback(null, content, previousSourceMap); | ||
return; | ||
} | ||
const intermediateSourceMap = boOutput.sourceMap; | ||
@@ -24,11 +37,9 @@ let newContent = boOutput.content; | ||
newContent = newContent.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, ''); | ||
if (!previousSourceMap) { | ||
// If we're emitting sourcemaps but there is no previous one, then we're the first loader. | ||
newSourceMap = JSON.stringify(intermediateSourceMap); | ||
} | ||
else { | ||
// If there's a previous sourcemap, we're an intermediate loader and we have to chain them. | ||
if (previousSourceMap) { | ||
// If there's a previous sourcemap, we have to chain them. | ||
// See https://github.com/mozilla/source-map/issues/216#issuecomment-150839869 for a simple | ||
// source map chaining example. | ||
// Use http://sokra.github.io/source-map-visualization/ to validate sourcemaps make sense. | ||
// Fill in the intermediate sourcemap source as the previous sourcemap file. | ||
intermediateSourceMap.sources = [previousSourceMap.file]; | ||
intermediateSourceMap.file = previousSourceMap.file; | ||
// Chain the sourcemaps. | ||
@@ -38,8 +49,14 @@ const consumer = new source_map_1.SourceMapConsumer(intermediateSourceMap); | ||
generator.applySourceMap(new source_map_1.SourceMapConsumer(previousSourceMap)); | ||
newSourceMap = JSON.stringify(generator.toJSON()); | ||
newSourceMap = generator.toJSON(); | ||
} | ||
else { | ||
// Otherwise just return our generated sourcemap. | ||
newSourceMap = intermediateSourceMap; | ||
} | ||
} | ||
// Webpack typings for previousSourceMap are wrong, they are JSON objects and not strings. | ||
// tslint:disable-next-line:no-any | ||
this.callback(null, newContent, newSourceMap); | ||
} | ||
exports.default = buildOptimizerLoader; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2VicGFjay1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9idWlsZC1vcHRpbWl6ZXIvd2VicGF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XcgU291cmNlTWFwQ29uc3VtZXIoaW50ZXJtZWRpYXRlU291cmNlTWFwKTtcbiAgICAgIGNvbnN0IGdlbmVyYXRvciA9IFNvdXJjZU1hcEdlbmVyYXRvci5mcm9tU291cmNlTWFwKGNvbnN1bWVyKTtcbiAgICAgIGdlbmVyYXRvci5hcHBseVNvdXJjZU1hcChuZXcgU291cmNlTWFwQ29uc3VtZXIocHJldmlvdXNTb3VyY2VNYXApKTtcbiAgICAgIG5ld1NvdXJjZU1hcCA9IGdlbmVyYXRvci50b0pTT04oKTtcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gT3RoZXJ3aXNlIGp1c3QgcmV0dXJuIG91ciBnZW5lcmF0ZWQgc291cmNlbWFwLlxuICAgICAgbmV3U291cmNlTWFwID0gaW50ZXJtZWRpYXRlU291cmNlTWFwO1xuICAgIH1cbiAgfVxuXG4gIC8vIFdlYnBhY2sgdHlwaW5ncyBmb3IgcHJldmlvdXNTb3VyY2VNYXAgYXJlIHdyb25nLCB0aGV5IGFyZSBKU09OIG9iamVjdHMgYW5kIG5vdCBzdHJpbmdzLlxuICAvLyB0c2xpbnQ6ZGlzYWJsZS1uZXh0LWxpbmU6bm8tYW55XG4gIHRoaXMuY2FsbGJhY2sobnVsbCwgbmV3Q29udGVudCwgbmV3U291cmNlTWFwIGFzIGFueSk7XG59XG4iXX0= |
@@ -0,1 +1,2 @@ | ||
import { RawSourceMap } from 'source-map'; | ||
import * as ts from 'typescript'; | ||
@@ -10,5 +11,7 @@ export interface TransformJavascriptOptions { | ||
} | ||
export declare const transformJavascript: (options: TransformJavascriptOptions) => { | ||
content: string; | ||
sourceMap: any; | ||
}; | ||
export interface TransformJavascriptOutput { | ||
content: string | null; | ||
sourceMap: RawSourceMap | null; | ||
emitSkipped: boolean; | ||
} | ||
export declare function transformJavascript(options: TransformJavascriptOptions): TransformJavascriptOutput; |
@@ -13,7 +13,12 @@ "use strict"; | ||
const ts = require("typescript"); | ||
const MagicString = require('magic-string'); | ||
exports.transformJavascript = (options) => { | ||
options.emitSourceMap = !!options.emitSourceMap; | ||
options.strict = !!options.strict; | ||
const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict } = options; | ||
function transformJavascript(options) { | ||
const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict, } = options; | ||
// Bail if there's no transform to do. | ||
if (getTransforms.length === 0) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
// Print error diagnostics. | ||
@@ -86,8 +91,5 @@ const checkDiagnostics = (diagnostics) => { | ||
return { | ||
content, | ||
sourceMap: !emitSourceMap ? null : new MagicString(content).generateMap({ | ||
source: inputFilePath, | ||
file: outputFilePath ? `${outputFilePath}.map` : null, | ||
includeContent: true, | ||
}), | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
@@ -103,3 +105,3 @@ } | ||
if (outputFilePath) { | ||
sourceMap.file = path_1.basename(outputFilePath); | ||
sourceMap.file = outputFilePath; | ||
transformedContent = transformedContent.replace(urlRegExp, `//# sourceMappingURL=${sourceMap.file}.map\n`); | ||
@@ -123,4 +125,6 @@ if (inputFilePath) { | ||
sourceMap, | ||
emitSkipped: false, | ||
}; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWphdmFzY3JpcHQuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9oZWxwZXJzL3RyYW5zZm9ybS1qYXZhc2NyaXB0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztHQU1HO0FBQ0gsMkJBQWtDO0FBQ2xDLCtCQUErQztBQUUvQyxpQ0FBaUM7QUFDakMsTUFBTSxXQUFXLEdBQUc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ICAgICAgdHJhbnNmb3JtZWRDb250ZW50ID0gdHJhbnNmb3JtZWRDb250ZW50LnJlcGxhY2UodXJsUmVnRXhwLFxuICAgICAgICBgLy8jIHNvdXJjZU1hcHBpbmdVUkw9JHtzb3VyY2VNYXAuZmlsZX0ubWFwXFxuYCk7XG4gICAgICBpZiAoaW5wdXRGaWxlUGF0aCkge1xuICAgICAgICBzb3VyY2VNYXAuc291cmNlcyA9IFtpbnB1dEZpbGVQYXRoXTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgLy8gVE9ETzogZmlndXJlIG91dCBpZiB3ZSBzaG91bGQgaW5saW5lIHNvdXJjZXMgaGVyZS5cbiAgICAgIHRyYW5zZm9ybWVkQ29udGVudCA9IHRyYW5zZm9ybWVkQ29udGVudC5yZXBsYWNlKHVybFJlZ0V4cCwgJycpO1xuICAgICAgc291cmNlTWFwLmZpbGUgPSAnJztcbiAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4ge1xuICAgIGNvbnRlbnQ6IHRyYW5zZm9ybWVkQ29udGVudCxcbiAgICBzb3VyY2VNYXAsXG4gIH07XG59O1xuIl19 | ||
} | ||
exports.transformJavascript = transformJavascript; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWphdmFzY3JpcHQuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9oZWxwZXJzL3RyYW5zZm9ybS1qYXZhc2NyaXB0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztHQU1HO0FBQ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mb3JtZWRDb250ZW50LnJlcGxhY2UodXJsUmVnRXhwLFxuICAgICAgICBgLy8jIHNvdXJjZU1hcHBpbmdVUkw9JHtzb3VyY2VNYXAuZmlsZX0ubWFwXFxuYCk7XG4gICAgICBpZiAoaW5wdXRGaWxlUGF0aCkge1xuICAgICAgICBzb3VyY2VNYXAuc291cmNlcyA9IFtpbnB1dEZpbGVQYXRoXTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgLy8gVE9ETzogZmlndXJlIG91dCBpZiB3ZSBzaG91bGQgaW5saW5lIHNvdXJjZXMgaGVyZS5cbiAgICAgIHRyYW5zZm9ybWVkQ29udGVudCA9IHRyYW5zZm9ybWVkQ29udGVudC5yZXBsYWNlKHVybFJlZ0V4cCwgJycpO1xuICAgICAgc291cmNlTWFwLmZpbGUgPSAnJztcbiAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4ge1xuICAgIGNvbnRlbnQ6IHRyYW5zZm9ybWVkQ29udGVudCxcbiAgICBzb3VyY2VNYXAsXG4gICAgZW1pdFNraXBwZWQ6IGZhbHNlLFxuICB9O1xufVxuIl19 |
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
154969
3
1098
- Removedmagic-string@^0.19.1
- Removedmagic-string@0.19.1(transitive)
- Removedvlq@0.2.3(transitive)