ng-packagr 4.1.1 → 4.2.0
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 +18 -0
- package/README.md +11 -11
- package/cli/main.js +4 -2
- package/cli/main.js.map +1 -1
- package/lib/commands/build.command.d.ts +2 -0
- package/lib/commands/build.command.js +1 -0
- package/lib/commands/build.command.js.map +1 -1
- package/lib/ng-v5/entry-point/resources/stylesheet-processor.js +5 -16
- package/lib/ng-v5/entry-point/resources/stylesheet-processor.js.map +1 -1
- package/lib/ts/tsconfig.js +3 -0
- package/lib/ts/tsconfig.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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
|
+
<a name="4.2.0"></a>
|
|
6
|
+
# [4.2.0](https://github.com/ng-packagr/ng-packagr/compare/v4.1.1...v4.2.0) (2018-09-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update rollup to version `^0.65.0` ([03db010](https://github.com/ng-packagr/ng-packagr/commit/03db010))
|
|
12
|
+
* update rollup to version ^0.66.0 ([3d381b0](https://github.com/ng-packagr/ng-packagr/commit/3d381b0))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add and version as peerDependencies ([97c5fec](https://github.com/ng-packagr/ng-packagr/commit/97c5fec))
|
|
18
|
+
* add `TypeScript` version 3 as a `peerDependency` ([5f0b761](https://github.com/ng-packagr/ng-packagr/commit/5f0b761))
|
|
19
|
+
* add a option to pass a custom `tsconfig` in `CLI` ([cb6a980](https://github.com/ng-packagr/ng-packagr/commit/cb6a980))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
<a name="4.1.1"></a>
|
|
6
24
|
## [4.1.1](https://github.com/dherges/ng-packagr/compare/v4.1.0...v4.1.1) (2018-08-26)
|
|
7
25
|
|
package/README.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
> Transpile your libraries to Angular Package Format
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/ng-packagr)
|
|
6
|
-
[](https://github.com/
|
|
6
|
+
[](https://github.com/ng-packagr/ng-packagr/blob/master/LICENSE)
|
|
7
7
|
[](https://conventionalcommits.org)
|
|
8
|
-
[](https://circleci.com/gh/ng-packagr/ng-packagr)
|
|
9
|
+
[](https://travis-ci.org/ng-packagr/ng-packagr)
|
|
10
10
|
|
|
11
|
-
[](https://github.com/ng-packagr/ng-packagr)
|
|
12
|
+
[](http://issuestats.com/github/ng-packagr/ng-packagr)
|
|
13
|
+
[](http://issuestats.com/github/ng-packagr/ng-packagr)
|
|
14
14
|
|
|
15
|
-
[](https://github.com/ng-packagr/ng-packagr)
|
|
16
16
|
[](https://www.npmjs.com/package/ng-packagr)
|
|
17
17
|
[](https://renovateapp.com/)
|
|
18
18
|
|
|
@@ -100,14 +100,14 @@ A great step-by-step [example of making an Angular CLI project with a library di
|
|
|
100
100
|
|
|
101
101
|
Nikolas LeBlanc wrote a tutorial on [building an Angular 4 Component Library with the Angular CLI and ng-packagr](https://medium.com/@ngl817/building-an-angular-4-component-library-with-the-angular-cli-and-ng-packagr-53b2ade0701e)
|
|
102
102
|
|
|
103
|
-
Here is a [demo repository showing ng-packagr and Angular CLI](https://github.com/
|
|
103
|
+
Here is a [demo repository showing ng-packagr and Angular CLI](https://github.com/ng-packagr/ng-packaged) in action.
|
|
104
104
|
|
|
105
|
-
What about [ng-packagr alongside Nx Workspace](https://github.com/
|
|
105
|
+
What about [ng-packagr alongside Nx Workspace](https://github.com/ng-packagr/nx-packaged)? Well, they work well together!
|
|
106
106
|
|
|
107
107
|
#### Further user questions and issue-driven documentation
|
|
108
108
|
|
|
109
109
|
We keep track of user questions in GitHub's issue tracker and try to build a documentation from it.
|
|
110
|
-
[Explore issues w/ label documentation](https://github.com/
|
|
110
|
+
[Explore issues w/ label documentation](https://github.com/ng-packagr/ng-packagr/issues?q=label%3Adocumentation%20).
|
|
111
111
|
|
|
112
112
|
#### Contributing to ng-packagr
|
|
113
113
|
|
|
@@ -134,4 +134,4 @@ Packaging Angular - Jason Aden at ng-conf 2017 ([28min talk](https://youtu.be/un
|
|
|
134
134
|
|
|
135
135
|
Create and publish Angular libs like a Pro - Juri Strumpflohner at ngVikings, this time demoing building Angular libraries with ng-packagr, with NX as well as Bazel ([March 2018, 30min talk](https://youtu.be/Tw8TCgeqotg))
|
|
136
136
|
|
|
137
|
-
[](https://youtu.be/Tw8TCgeqotg)
|
|
137
|
+
[](https://youtu.be/Tw8TCgeqotg)
|
package/cli/main.js
CHANGED
|
@@ -14,7 +14,8 @@ program
|
|
|
14
14
|
.name('ng-packagr')
|
|
15
15
|
.option('-V, --version', 'Prints version info')
|
|
16
16
|
.option('-w, --watch', 'Watch for file changes')
|
|
17
|
-
.option('-p, --project [path]', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
|
|
17
|
+
.option('-p, --project [path]', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
|
|
18
|
+
.option('-c, --config [config]', 'Path to a tsconfig file.', (value) => (value ? path.resolve(value) : undefined));
|
|
18
19
|
const dir = path.dirname(module.filename);
|
|
19
20
|
const pkg = readPkgUp.sync({ cwd: dir }).pkg;
|
|
20
21
|
updateNotifier({ pkg }).notify();
|
|
@@ -23,5 +24,6 @@ program.on('option:version', () => {
|
|
|
23
24
|
process.exit(0);
|
|
24
25
|
});
|
|
25
26
|
program.parse(process.argv);
|
|
26
|
-
|
|
27
|
+
const { config, project, watch } = program.opts();
|
|
28
|
+
public_api_1.execute(public_api_1.build, { config, project, watch: !!watch }).catch(() => process.exit(111));
|
|
27
29
|
//# sourceMappingURL=main.js.map
|
package/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AACrC,6BAA6B;AAC7B,kDAAkD;AAClD,yCAAyC;AACzC,8CAAwD;AAExD,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE5E,0BAA0B,MAAc;IACtC,OAAO,MAAM,IAAI,oBAAoB,CAAC;AACxC,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC;KAC9C,MAAM,CAAC,aAAa,EAAE,wBAAwB,CAAC;KAC/C,MAAM,CACL,sBAAsB,EACtB,uDAAuD,EACvD,gBAAgB,EAChB,oBAAoB,CACrB,CAAC;AAEJ,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;AAC7C,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEjC,OAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAChC,oBAAO,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AACrC,6BAA6B;AAC7B,kDAAkD;AAClD,yCAAyC;AACzC,8CAAwD;AAExD,MAAM,o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KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport * as program from 'commander';\nimport * as path from 'path';\nimport * as updateNotifier from 'update-notifier';\nimport * as readPkgUp from 'read-pkg-up';\nimport { execute, build, version } from '../public_api';\n\nconst DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');\n\nfunction parseProjectPath(parsed: string): string {\n return parsed || DEFAULT_PROJECT_PATH;\n}\n\nprogram\n .name('ng-packagr')\n .option('-V, --version', 'Prints version info')\n .option('-w, --watch', 'Watch for file changes')\n .option(\n '-p, --project [path]',\n \"Path to the 'ng-package.json' or 'package.json' file.\",\n parseProjectPath,\n DEFAULT_PROJECT_PATH\n )\n .option(\n '-c, --config [config]',\n 'Path to a tsconfig file.',\n (value: string | undefined) => (value ? path.resolve(value) : undefined)\n );\n\nconst dir = path.dirname(module.filename);\nconst pkg = readPkgUp.sync({ cwd: dir }).pkg;\nupdateNotifier({ pkg }).notify();\n\nprogram.on('option:version', () => {\n version(pkg);\n process.exit(0);\n});\n\nprogram.parse(process.argv);\n\nconst { config, project, watch } = program.opts();\nexecute(build, { config, project, watch: !!watch }).catch(() => process.exit(111));\n"]}
|
|
@@ -9,6 +9,8 @@ export interface CliArguments {
|
|
|
9
9
|
project: string;
|
|
10
10
|
/** Whether or not ng-packagr will watch for file changes and perform an incremental build. */
|
|
11
11
|
watch?: boolean;
|
|
12
|
+
/** Path to a tsconfig file. */
|
|
13
|
+
config?: string;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Command running an "one-off" build.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../../src/lib/commands/build.command.ts"],"names":[],"mappings":";;AACA,8CAA6C;
|
|
1
|
+
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../../src/lib/commands/build.command.ts"],"names":[],"mappings":";;AACA,8CAA6C;AAgB7C;;;;GAIG;AACU,QAAA,KAAK,GAAgC,IAAI,CAAC,EAAE,CACvD,mBAAS,EAAE;KACR,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;KACxB,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;KAClC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;KACzB,KAAK,EAAE,CAAC","sourcesContent":["import { Command } from './command';\nimport { ngPackagr } from '../ng-v5/packagr';\n\n/**\n * CLI arguments passed to `ng-packagr` executable and `build()` command.\n *\n * @stable\n */\nexport interface CliArguments {\n /** Path to the project file 'package.json', 'ng-package.json', or 'ng-package.js'. */\n project: string;\n /** Whether or not ng-packagr will watch for file changes and perform an incremental build. */\n watch?: boolean;\n /** Path to a tsconfig file. */\n config?: string;\n}\n\n/**\n * Command running an \"one-off\" build.\n *\n * @stable\n */\nexport const build: Command<CliArguments, void> = opts =>\n ngPackagr()\n .forProject(opts.project)\n .withOptions({ watch: opts.watch })\n .withTsConfig(opts.config)\n .build();\n"]}
|
|
@@ -33,30 +33,21 @@ class StylesheetProcessor {
|
|
|
33
33
|
return result.css;
|
|
34
34
|
}
|
|
35
35
|
renderPreProcessor(filePath, content) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return sass
|
|
40
|
-
.renderSync({
|
|
41
|
-
file: filePath,
|
|
42
|
-
data: content,
|
|
43
|
-
importer: nodeSassTildeImporter,
|
|
44
|
-
includePaths: this.styleIncludePaths
|
|
45
|
-
})
|
|
46
|
-
.css.toString();
|
|
36
|
+
const ext = path.extname(filePath);
|
|
37
|
+
log.debug(`rendering ${ext} from ${filePath}`);
|
|
38
|
+
switch (ext) {
|
|
47
39
|
case '.sass':
|
|
48
|
-
|
|
40
|
+
case '.scss':
|
|
49
41
|
return sass
|
|
50
42
|
.renderSync({
|
|
51
43
|
file: filePath,
|
|
52
44
|
data: content,
|
|
53
|
-
indentedSyntax:
|
|
45
|
+
indentedSyntax: '.sass' === ext,
|
|
54
46
|
importer: nodeSassTildeImporter,
|
|
55
47
|
includePaths: this.styleIncludePaths
|
|
56
48
|
})
|
|
57
49
|
.css.toString();
|
|
58
50
|
case '.less':
|
|
59
|
-
log.debug(`rendering less from ${filePath}`);
|
|
60
51
|
// this is the only way I found to make LESS sync
|
|
61
52
|
let cmd = `node node_modules/less/bin/lessc ${filePath} --less-plugin-npm-import="prefix=~"`;
|
|
62
53
|
if (this.styleIncludePaths.length) {
|
|
@@ -65,7 +56,6 @@ class StylesheetProcessor {
|
|
|
65
56
|
return child_process_1.execSync(cmd).toString();
|
|
66
57
|
case '.styl':
|
|
67
58
|
case '.stylus':
|
|
68
|
-
log.debug(`rendering styl from ${filePath}`);
|
|
69
59
|
return (stylus(content)
|
|
70
60
|
// add paths for resolve
|
|
71
61
|
.set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])
|
|
@@ -77,7 +67,6 @@ class StylesheetProcessor {
|
|
|
77
67
|
.render());
|
|
78
68
|
case '.css':
|
|
79
69
|
default:
|
|
80
|
-
log.debug(`reading css from ${filePath}`);
|
|
81
70
|
return content;
|
|
82
71
|
}
|
|
83
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/resources/stylesheet-processor.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,yCAAyC;AACzC,8DAA2D;AAC3D,iDAAyC;AAEzC,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,mDAA2C;AAC3C,kCAAkC;AAClC,iCAAiC;AAEjC;IAGE,YAAqB,QAAgB,EAAW,MAAe,EAAW,iBAA4B;QAAjF,aAAQ,GAAR,QAAQ,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAS;QAAW,sBAAiB,GAAjB,iBAAiB,CAAW;QACpG,IAA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I,EAAE,IAAI,EAAE,CAAC,EACtC,uBAAY,CAAC;YACX,KAAK,EAAE;gBACL,CAAC,EAAE;oBACD,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CACH,CAAC;QAEF,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AA/FD,kDA+FC","sourcesContent":["import * as path from 'path';\nimport * as log from '../../../util/log';\nimport { CssUrl } from '../../../ng-package-format/shared';\nimport { execSync } 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 postcssClean from './postcss-clean';\nimport * as sass from 'node-sass';\nimport * as stylus from 'stylus';\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 sass\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 let cmd = `node node_modules/less/bin/lessc ${filePath} --less-plugin-npm-import=\"prefix=~\"`;\n if (this.styleIncludePaths.length) {\n cmd = `${cmd} --include-path=${this.styleIncludePaths.join(':')}`;\n }\n\n return execSync(cmd).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 browsers = 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(\n autoprefixer({ browsers, grid: true }),\n postcssClean({\n level: {\n 2: {\n specialComments: false\n }\n }\n })\n );\n\n return postcss(postCssPlugins);\n }\n}\n"]}
|
package/lib/ts/tsconfig.js
CHANGED
|
@@ -54,6 +54,9 @@ exports.createDefaultTsConfig = createDefaultTsConfig;
|
|
|
54
54
|
* default config with entry point-specific values.
|
|
55
55
|
*/
|
|
56
56
|
exports.initializeTsConfig = (defaultTsConfig, entryPoints) => {
|
|
57
|
+
if (defaultTsConfig.errors.length > 0) {
|
|
58
|
+
throw ng.formatDiagnostics(defaultTsConfig.errors);
|
|
59
|
+
}
|
|
57
60
|
entryPoints.forEach(currentEntryPoint => {
|
|
58
61
|
const { entryPoint } = currentEntryPoint.data;
|
|
59
62
|
log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);
|
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,6B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,GAAG,QAAQ,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,sCACE,cAAsC,EACtC,WAA6B,EAC7B,aAAa,GAAG,KAAK;IAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAE5D,sCAAsC;IACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE;QAC3B,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;KAC7B;IAED,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE;QAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAChC,MAAM,EAAE,QAAQ,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,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/D;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-v5/nodes';\nimport * as log from '../util/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 emitDecoratorMetadata: true,\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 return ng.readConfiguration(fileName, extraOptions);\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 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 let jsx = tsConfig.options.jsx;\n switch (entryPoint.jsxConfig) {\n case 'preserve':\n jsx = ts.JsxEmit.Preserve;\n break;\n case 'react':\n jsx = ts.JsxEmit.React;\n break;\n case 'react-native':\n jsx = ts.JsxEmit.ReactNative;\n break;\n default:\n break;\n }\n\n const overrideOptions: ng.CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n lib: entryPoint.languageLevel ? entryPoint.languageLevel.map(lib => `lib.${lib}.d.ts`) : tsConfig.options.lib,\n declarationDir: basePath,\n sourceRoot: `ng://${entryPoint.moduleId}`,\n jsx\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) {\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].concat(mappedPath).reverse();\n }\n }\n\n return tsConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;AAAA,4CAA4C;AAC5C,6BAA6B;AAC7B,iCAAiC;AAEjC,mCAAmC;AAEnC;;GAEG;AACH,6BAAoC,QAAiB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;KACjE;IAED,8BAA8B;IAC9B,MAAM,YAAY,GAAuB;QACvC,gBAAgB,EAAE,EAAE,CAAC,oBAAoB,CAAC,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AM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAE5D,sCAAsC;IACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE;QAC3B,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;KAC7B;IAED,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE;QAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAChC,MAAM,EAAE,QAAQ,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,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/D;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-v5/nodes';\nimport * as log from '../util/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 emitDecoratorMetadata: true,\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 return ng.readConfiguration(fileName, extraOptions);\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 let jsx = tsConfig.options.jsx;\n switch (entryPoint.jsxConfig) {\n case 'preserve':\n jsx = ts.JsxEmit.Preserve;\n break;\n case 'react':\n jsx = ts.JsxEmit.React;\n break;\n case 'react-native':\n jsx = ts.JsxEmit.ReactNative;\n break;\n default:\n break;\n }\n\n const overrideOptions: ng.CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n lib: entryPoint.languageLevel ? entryPoint.languageLevel.map(lib => `lib.${lib}.d.ts`) : tsConfig.options.lib,\n declarationDir: basePath,\n sourceRoot: `ng://${entryPoint.moduleId}`,\n jsx\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) {\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].concat(mappedPath).reverse();\n }\n }\n\n return tsConfig;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-packagr",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Compile and package a TypeScript library to Angular Package Format",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"author": "David Herges <david@spektrakel.de>",
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"repository": "https://github.com/
|
|
20
|
-
"homepage": "https://github.com/
|
|
19
|
+
"repository": "https://github.com/ng-packagr/ng-packagr.git",
|
|
20
|
+
"homepage": "https://github.com/ng-packagr/ng-packagr",
|
|
21
21
|
"bugs": {
|
|
22
|
-
"url": "https://github.com/
|
|
22
|
+
"url": "https://github.com/ng-packagr/ng-packagr/issues"
|
|
23
23
|
},
|
|
24
24
|
"bin": {
|
|
25
25
|
"ng-packagr": "./cli/main.js"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"postcss-url": "^8.0.0",
|
|
46
46
|
"read-pkg-up": "^4.0.0",
|
|
47
47
|
"rimraf": "^2.6.1",
|
|
48
|
-
"rollup": "^0.
|
|
48
|
+
"rollup": "^0.66.0",
|
|
49
49
|
"rollup-plugin-commonjs": "^9.1.3",
|
|
50
50
|
"rollup-plugin-node-resolve": "^3.0.0",
|
|
51
51
|
"rollup-plugin-sourcemaps": "^0.4.2",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"update-notifier": "^2.3.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@angular/compiler": "^6.0.0",
|
|
59
|
-
"@angular/compiler-cli": "^6.0.0",
|
|
58
|
+
"@angular/compiler": "^6.0.0 || ^7.0.0-beta.0",
|
|
59
|
+
"@angular/compiler-cli": "^6.0.0 || ^7.0.0-beta.0",
|
|
60
60
|
"tsickle": ">=0.27.3",
|
|
61
61
|
"tslib": "^1.9.0",
|
|
62
|
-
"typescript": "^2.7.0"
|
|
62
|
+
"typescript": "^2.7.0 || ~3.0.1"
|
|
63
63
|
}
|
|
64
64
|
}
|