ng-packagr 10.1.0 → 10.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/ng-package/entry-point/init-tsconfig.transform.js +2 -2
- package/lib/ng-package/entry-point/init-tsconfig.transform.js.map +1 -1
- package/lib/styles/stylesheet-processor.js +5 -5
- package/lib/styles/stylesheet-processor.js.map +1 -1
- package/lib/ts/tsconfig.js +1 -0
- package/lib/ts/tsconfig.js.map +1 -1
- package/lib/utils/color.d.ts +3 -0
- package/lib/utils/color.js +14 -0
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/log.js +9 -9
- package/lib/utils/log.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [10.1.1](https://github.com/ng-packagr/ng-packagr/compare/v10.1.0...v10.1.1) (2020-09-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add basePath as sourceRoot ([681fb1c](https://github.com/ng-packagr/ng-packagr/commit/681fb1c36b68efb3078dc3d846776e9e749ebf44))
|
|
11
|
+
* replace execFile with execFileSync to fix a potential malicious cmd injection ([bda0fff](https://github.com/ng-packagr/ng-packagr/commit/bda0fff3443301f252930a73fdc8fb9502de596d))
|
|
12
|
+
|
|
5
13
|
## [10.1.0](https://github.com/ng-packagr/ng-packagr/compare/v10.0.4...v10.1.0) (2020-08-27)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.initTsConfigTransformFactory = void 0;
|
|
13
|
-
const
|
|
13
|
+
const color_1 = require("../../utils/color");
|
|
14
14
|
const transform_1 = require("../../graph/transform");
|
|
15
15
|
const nodes_1 = require("../nodes");
|
|
16
16
|
const tsconfig_1 = require("../../ts/tsconfig");
|
|
@@ -24,7 +24,7 @@ exports.initTsConfigTransformFactory = (defaultTsConfig) => transform_1.transfor
|
|
|
24
24
|
'It is not recommended to publish Ivy libraries to NPM repositories.\n' +
|
|
25
25
|
'Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility\n' +
|
|
26
26
|
'******************************************************************************';
|
|
27
|
-
log_1.msg(
|
|
27
|
+
log_1.msg(color_1.colors.yellow(ivyMsg));
|
|
28
28
|
}
|
|
29
29
|
return graph;
|
|
30
30
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA
|
|
1
|
+
{"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAA2C;AAC3C,qDAAwE;AACxE,oCAAwD;AACxD,gDAAuD;AACvD,yCAAsC;AAEzB,QAAA,4BAA4B,GAAG,CAAC,eAAoC,EAAa,EAAE,CAC9F,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjC,2CAA2C;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAqB,CAAC;IACnE,6BAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAEjD,IAAI,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE;QACrC,MAAM,MAAM,GACV,kFAAkF;YAClF,uEAAuE;YACvE,qFAAqF;YACrF,gFAAgF,CAAC;QAEnF,SAAG,CAAC,cAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import { ParsedConfiguration } from '@angular/compiler-cli';\nimport { colors } from '../../utils/color';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { initializeTsConfig } from '../../ts/tsconfig';\nimport { msg } from '../../utils/log';\n\nexport const initTsConfigTransformFactory = (defaultTsConfig: ParsedConfiguration): Transform =>\n transformFromPromise(async graph => {\n // Initialize tsconfig for each entry point\n const entryPoints = graph.filter(isEntryPoint) as EntryPointNode[];\n initializeTsConfig(defaultTsConfig, entryPoints);\n\n if (defaultTsConfig.options.enableIvy) {\n const ivyMsg =\n '******************************************************************************\\n' +\n 'It is not recommended to publish Ivy libraries to NPM repositories.\\n' +\n 'Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility\\n' +\n '******************************************************************************';\n\n msg(colors.yellow(ivyMsg));\n }\n\n return graph;\n });\n"]}
|
|
@@ -49,7 +49,7 @@ class StylesheetProcessor {
|
|
|
49
49
|
to: filePath.replace(path.extname(filePath), '.css'),
|
|
50
50
|
});
|
|
51
51
|
// Log warnings from postcss
|
|
52
|
-
result.warnings().forEach(
|
|
52
|
+
result.warnings().forEach(msg => log.warn(msg.toString()));
|
|
53
53
|
return result.css;
|
|
54
54
|
}
|
|
55
55
|
renderPreProcessor(filePath, content) {
|
|
@@ -69,11 +69,11 @@ class StylesheetProcessor {
|
|
|
69
69
|
.css.toString();
|
|
70
70
|
case '.less':
|
|
71
71
|
// this is the only way I found to make LESS sync
|
|
72
|
-
|
|
72
|
+
const args = [filePath, '--js'];
|
|
73
73
|
if (this.styleIncludePaths.length) {
|
|
74
|
-
|
|
74
|
+
args.push(`--include-path=${this.styleIncludePaths.join(':')}`);
|
|
75
75
|
}
|
|
76
|
-
return child_process_1.
|
|
76
|
+
return child_process_1.execFileSync(require.resolve('less/bin/lessc'), args).toString();
|
|
77
77
|
case '.styl':
|
|
78
78
|
case '.stylus':
|
|
79
79
|
return (stylus(content)
|
|
@@ -109,7 +109,7 @@ class StylesheetProcessor {
|
|
|
109
109
|
const cssNanoPlugins = preset.plugins
|
|
110
110
|
// replicate the `initializePlugin` behavior from https://github.com/cssnano/cssnano/blob/a566cc5/packages/cssnano/src/index.js#L8
|
|
111
111
|
.map(([creator, pluginConfig]) => creator(pluginConfig))
|
|
112
|
-
.filter(
|
|
112
|
+
.filter(plugin => !asyncPlugins.includes(plugin.postcssPlugin));
|
|
113
113
|
postCssPlugins.push(...cssNanoPlugins);
|
|
114
114
|
return postcss(postCssPlugins);
|
|
115
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAAoC;AACpC,iDAA6C;AAE7C,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,+DAA+D;AAC/D,iCAAiC;AAEjC,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACf,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB;AAED;;;;;;;;GAQG;AACH,IAAI,YAA6B,CAAC;AAClC,IAAI;IACF,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,6CAA6C;CACnF;AAAC,WAAM;IACN,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,MAAa,mBAAmB;IAG9B,YAAqB,QAAgB,EAAW,MAAe,EAAW,iBAA4B;QAAjF,aAAQ,GAAR,QAAQ,CAAQ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CAAC,CAAC;YACnC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;SAClD;QAED,6DAA6D;QAC7D,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAExE,MAAM,MAAM,GAAG,oBAAoB,CAAC;YAClC,IAAI,EAAE,KAAK;YACX,oDAAoD;YACpD,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,CAAC,cAAc,CAAC,CAAC;QACtC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO;YACnC,kIAAkI;aACjI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;aACvD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAElE,cAAc,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AApGD,kDAoGC","sourcesContent":["import * as path from 'path';\nimport * as log from '../utils/log';\nimport { execFileSync } from 'child_process';\n\n// CSS Tools\nimport * as autoprefixer from 'autoprefixer';\nimport * as browserslist from 'browserslist';\nimport * as nodeSassTildeImporter from 'node-sass-tilde-importer';\nimport * as postcss from 'postcss';\nimport * as postcssUrl from 'postcss-url';\nimport * as cssnanoPresetDefault from 'cssnano-preset-default';\nimport * as stylus from 'stylus';\n\nexport enum CssUrl {\n inline = 'inline',\n none = 'none',\n}\n\n/*\n * Please be aware of the few differences in behaviour https://github.com/sass/dart-sass/blob/master/README.md#behavioral-differences-from-ruby-sass\n * By default `npm install` will install sass.\n * To use node-sass you need to use:\n * Npm:\n * `npm install node-sass --save-dev`\n * Yarn:\n * `yarn add node-sass --dev`\n */\nlet sassComplier: any | undefined;\ntry {\n sassComplier = require('node-sass'); // Check if node-sass is explicitly included.\n} catch {\n sassComplier = require('sass');\n}\n\nexport class StylesheetProcessor {\n private postCssProcessor: postcss.Processor;\n\n constructor(readonly basePath: string, readonly cssUrl?: CssUrl, readonly styleIncludePaths?: string[]) {\n this.postCssProcessor = this.createPostCssProcessor(basePath, cssUrl);\n }\n\n process(filePath: string, content: string) {\n // Render pre-processor language (sass, styl, less)\n const renderedCss: string = this.renderPreProcessor(filePath, content);\n\n // Render postcss (autoprefixing and friends)\n const result = this.postCssProcessor.process(renderedCss, {\n from: filePath,\n to: filePath.replace(path.extname(filePath), '.css'),\n });\n\n // Log warnings from postcss\n result.warnings().forEach(msg => log.warn(msg.toString()));\n\n return result.css;\n }\n\n private renderPreProcessor(filePath: string, content: string): string {\n const ext = path.extname(filePath);\n\n log.debug(`rendering ${ext} from ${filePath}`);\n\n switch (ext) {\n case '.sass':\n case '.scss':\n return sassComplier\n .renderSync({\n file: filePath,\n data: content,\n indentedSyntax: '.sass' === ext,\n importer: nodeSassTildeImporter,\n includePaths: this.styleIncludePaths,\n })\n .css.toString();\n\n case '.less':\n // this is the only way I found to make LESS sync\n const args = [filePath, '--js'];\n if (this.styleIncludePaths.length) {\n args.push(`--include-path=${this.styleIncludePaths.join(':')}`);\n }\n\n return execFileSync(require.resolve('less/bin/lessc'), args).toString();\n\n case '.styl':\n case '.stylus':\n return (\n stylus(content)\n // add paths for resolve\n .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])\n // add support for resolving plugins from node_modules\n .set('filename', filePath)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver(undefined))\n .render()\n );\n\n case '.css':\n default:\n return content;\n }\n }\n\n private createPostCssProcessor(basePath: string, cssUrl?: CssUrl): postcss.Processor {\n log.debug(`determine browserslist for ${basePath}`);\n const overrideBrowserslist = browserslist(undefined, { path: basePath });\n\n const postCssPlugins = [];\n\n if (cssUrl !== CssUrl.none) {\n log.debug(`postcssUrl: ${cssUrl}`);\n postCssPlugins.push(postcssUrl({ url: cssUrl }));\n }\n\n // this is important to be executed post running `postcssUrl`\n postCssPlugins.push(autoprefixer({ overrideBrowserslist, grid: true }));\n\n const preset = cssnanoPresetDefault({\n svgo: false,\n // Disable calc optimizations due to several issues.\n calc: false,\n });\n\n const asyncPlugins = ['postcss-svgo'];\n const cssNanoPlugins = preset.plugins\n // replicate the `initializePlugin` behavior from https://github.com/cssnano/cssnano/blob/a566cc5/packages/cssnano/src/index.js#L8\n .map(([creator, pluginConfig]) => creator(pluginConfig))\n .filter(plugin => !asyncPlugins.includes(plugin.postcssPlugin));\n\n postCssPlugins.push(...cssNanoPlugins);\n\n return postcss(postCssPlugins);\n }\n}\n"]}
|
package/lib/ts/tsconfig.js
CHANGED
|
@@ -79,6 +79,7 @@ exports.initializeTsConfig = (defaultTsConfig, entryPoints) => {
|
|
|
79
79
|
flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,
|
|
80
80
|
basePath,
|
|
81
81
|
rootDir: basePath,
|
|
82
|
+
sourceRoot: basePath,
|
|
82
83
|
};
|
|
83
84
|
tsConfig.rootNames = [entryPoint.entryFilePath];
|
|
84
85
|
tsConfig.options = Object.assign(Object.assign({}, tsConfig.options), overrideOptions);
|
package/lib/ts/tsconfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,6BAA6B;AAC7B,iCAAiC;AAEjC,oCAAoC;AAEpC;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAiB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;KACjE;IAED,8BAA8B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,EAAE,gBAAgB,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;QACjE,MAAM,UAAU,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAEnF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;YACrC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;SAC/C;aAAM;YACL,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;SACzD;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzBD,oEAyBC","sourcesContent":["import * as ng from '@angular/compiler-cli';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport * as log from '../utils/log';\n\n/**\n * Reads the default TypeScript configuration.\n */\nexport function readDefaultTsConfig(fileName?: string): ng.ParsedConfiguration {\n if (!fileName) {\n fileName = path.resolve(__dirname, 'conf', 'tsconfig.ngc.json');\n }\n\n // these options are mandatory\n const extraOptions: ng.CompilerOptions = {\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n target: ts.ScriptTarget.ES2015,\n experimentalDecorators: true,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler to options\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const config = ng.readConfiguration(fileName, extraOptions);\n const options = config.options;\n\n // todo: alanagius4 - the below shouldn't be needed but it seems that setting it only in create-emit-callback.ts\n // is not working correctly\n const transformDecorators = !options.enableIvy && options.annotationsAs !== 'decorators';\n if ((options.annotateForClosureCompiler || options.annotationsAs === 'static fields') && transformDecorators) {\n // This is needed as a workaround for https://github.com/angular/tsickle/issues/635\n // Otherwise tsickle might emit references to non imported values\n // as TypeScript elided the import.\n options.emitDecoratorMetadata = true;\n }\n\n return config;\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nexport function createDefaultTsConfig(values?: ng.ParsedConfiguration | string): ng.ParsedConfiguration {\n if (!values) {\n return readDefaultTsConfig();\n } else if (typeof values === 'string') {\n return readDefaultTsConfig(values);\n } else {\n return values;\n }\n}\n\n/**\n * Initializes TypeScript Compiler options and Angular Compiler options by overriding the\n * default config with entry point-specific values.\n */\nexport const initializeTsConfig = (defaultTsConfig: ng.ParsedConfiguration, entryPoints: EntryPointNode[]) => {\n if (defaultTsConfig.errors.length > 0) {\n throw ng.formatDiagnostics(defaultTsConfig.errors);\n }\n\n entryPoints.forEach(currentEntryPoint => {\n const { entryPoint } = currentEntryPoint.data;\n log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);\n const basePath = path.dirname(entryPoint.entryFilePath);\n\n // Resolve defaults from DI token and create a deep copy of the defaults\n let tsConfig: ng.ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfig));\n\n const overrideOptions: ng.CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: basePath,\n };\n\n tsConfig.rootNames = [entryPoint.entryFilePath];\n tsConfig.options = { ...tsConfig.options, ...overrideOptions };\n currentEntryPoint.data.tsConfig = tsConfig;\n });\n};\n\n/**\n * Set the paths for entrypoint dependencies.\n *\n * This doesn't mutate the object.\n *\n * @param parsedTsConfig - A parsed tsconfig\n * @param entryPoints - A list of entryPoints\n * @param pointToSource Point the path mapping to either the source code or emitted declarations.\n * Typically for analysis one should point to the source files while for a compilation once should use the emitted declarations\n */\nexport function setDependenciesTsConfigPaths(\n parsedTsConfig: ng.ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): ng.ParsedConfiguration {\n const tsConfig = JSON.parse(JSON.stringify(parsedTsConfig));\n\n // Add paths mappings for dependencies\n if (!tsConfig.options.paths) {\n tsConfig.options.paths = {};\n }\n\n for (let dep of entryPoints) {\n const { entryPoint } = dep.data;\n const { moduleId, destinationFiles, entryFilePath } = entryPoint;\n const mappedPath = [pointToSource ? entryFilePath : destinationFiles.declarations];\n\n if (!tsConfig.options.paths[moduleId]) {\n tsConfig.options.paths[moduleId] = mappedPath;\n } else {\n tsConfig.options.paths[moduleId].unshift(...mappedPath);\n }\n }\n\n return tsConfig;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
const ansiColors = require("ansi-colors");
|
|
5
|
+
const tty_1 = require("tty");
|
|
6
|
+
// Typings do not contain the function call (added in Node.js v9.9.0)
|
|
7
|
+
const supportsColor = process.stdout instanceof tty_1.WriteStream &&
|
|
8
|
+
process.stdout.getColorDepth() > 1;
|
|
9
|
+
// Create a separate instance to prevent unintended global changes to the color configuration
|
|
10
|
+
// Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44
|
|
11
|
+
const colors = ansiColors.create();
|
|
12
|
+
exports.colors = colors;
|
|
13
|
+
colors.enabled = supportsColor;
|
|
14
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../src/lib/utils/color.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,6BAAkC;AAIlC,qEAAqE;AACrE,MAAM,aAAa,GACjB,OAAO,CAAC,MAAM,YAAY,iBAAW;IACnC,OAAO,CAAC,MAAkD,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAEnF,6FAA6F;AAC7F,mGAAmG;AACnG,MAAM,MAAM,GAAI,UAAwD,CAAC,MAAM,EAAE,CAAC;AAGzE,wBAAM;AAFf,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC","sourcesContent":["import * as ansiColors from 'ansi-colors';\nimport { WriteStream } from 'tty';\n\ntype AnsiColors = typeof ansiColors;\n\n// Typings do not contain the function call (added in Node.js v9.9.0)\nconst supportsColor =\n process.stdout instanceof WriteStream &&\n ((process.stdout as unknown) as { getColorDepth(): number }).getColorDepth() > 1;\n\n// Create a separate instance to prevent unintended global changes to the color configuration\n// Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44\nconst colors = (ansiColors as AnsiColors & { create: () => AnsiColors }).create();\ncolors.enabled = supportsColor;\n\nexport { colors };\n"]}
|
package/lib/utils/log.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.debug = exports.msg = exports.info = exports.success = exports.warn = exports.error = void 0;
|
|
4
|
-
const
|
|
4
|
+
const color_1 = require("./color");
|
|
5
5
|
exports.error = (err) => {
|
|
6
6
|
if (err instanceof Error) {
|
|
7
|
-
console.error(
|
|
7
|
+
console.error(color_1.colors.red('ERROR: ' + err.message));
|
|
8
8
|
if (process.env.DEBUG) {
|
|
9
|
-
console.error(
|
|
9
|
+
console.error(color_1.colors.red(err.stack) + '\n');
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
|
-
console.error(
|
|
13
|
+
console.error(color_1.colors.red(err));
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
exports.warn = (msg) => {
|
|
17
|
-
console.warn(
|
|
17
|
+
console.warn(color_1.colors.yellow('WARNING: ' + msg));
|
|
18
18
|
};
|
|
19
19
|
exports.success = (msg) => {
|
|
20
|
-
console.log(
|
|
20
|
+
console.log(color_1.colors.green(msg));
|
|
21
21
|
};
|
|
22
22
|
exports.info = (msg) => {
|
|
23
|
-
console.log(
|
|
23
|
+
console.log(color_1.colors.blue(msg));
|
|
24
24
|
};
|
|
25
25
|
exports.msg = (msg) => {
|
|
26
|
-
console.log(
|
|
26
|
+
console.log(color_1.colors.white(msg));
|
|
27
27
|
};
|
|
28
28
|
exports.debug = (msg) => {
|
|
29
29
|
if (process.env.DEBUG) {
|
|
30
|
-
console.log(
|
|
30
|
+
console.log(color_1.colors.inverse.cyan(`[debug] ${msg}`));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=log.js.map
|
package/lib/utils/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/utils/log.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/utils/log.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAEpB,QAAA,KAAK,GAAG,CAAC,GAAmB,EAAE,EAAE;IAC3C,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;YACrB,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;SAC7C;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KAChC;AACH,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,IAAI,CAAC,cAAM,CAAC,MAAM,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAEW,QAAA,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE;IACjC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAEW,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;IACnC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;KACpD;AACH,CAAC,CAAC","sourcesContent":["import { colors } from './color';\n\nexport const error = (err: string | Error) => {\n if (err instanceof Error) {\n console.error(colors.red('ERROR: ' + err.message));\n\n if (process.env.DEBUG) {\n console.error(colors.red(err.stack) + '\\n');\n }\n } else {\n console.error(colors.red(err));\n }\n};\n\nexport const warn = (msg: string) => {\n console.warn(colors.yellow('WARNING: ' + msg));\n};\n\nexport const success = (msg: string) => {\n console.log(colors.green(msg));\n};\n\nexport const info = (msg: string) => {\n console.log(colors.blue(msg));\n};\n\nexport const msg = (msg: string) => {\n console.log(colors.white(msg));\n};\n\nexport const debug = (msg: string) => {\n if (process.env.DEBUG) {\n console.log(colors.inverse.cyan(`[debug] ${msg}`));\n }\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-packagr",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "Compile and package a TypeScript library to Angular Package Format",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@rollup/plugin-json": "^4.0.0",
|
|
32
32
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
33
33
|
"ajv": "^6.12.3",
|
|
34
|
+
"ansi-colors": "^4.1.1",
|
|
34
35
|
"autoprefixer": "^9.6.5",
|
|
35
36
|
"browserslist": "^4.7.0",
|
|
36
|
-
"chalk": "^4.0.0",
|
|
37
37
|
"chokidar": "^3.2.1",
|
|
38
38
|
"commander": "^6.0.0",
|
|
39
39
|
"cssnano-preset-default": "^4.0.7",
|