ng-packagr 1.5.1 → 1.7.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 CHANGED
@@ -2,6 +2,53 @@
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="1.7.0"></a>
6
+ # [1.7.0](https://github.com/dherges/ng-packagr/compare/v1.6.0...v1.7.0) (2018-02-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * back-port language level support for library authors in v1 ([#581](https://github.com/dherges/ng-packagr/issues/581)) ([800f615](https://github.com/dherges/ng-packagr/commit/800f615))
12
+
13
+
14
+
15
+ <a name="1.6.0"></a>
16
+ # [1.6.0](https://github.com/dherges/ng-packagr/compare/v1.5.2...v1.6.0) (2017-11-14)
17
+
18
+ This release rolls back premature Angular v5 support in `v1.6.0-rc.0`.
19
+ It is recommended to use this version of ng-packagr for building Angular v4 libraries,
20
+ as `typescript` in `2.3.x` and `@angular/tsc-wrapped` in `4.4.x` are used.
21
+
22
+ Libraries generated with this version of ng-packagr will ship with AoT metadata in version 3,
23
+ which is intended for Angular v4.
24
+
25
+ ### Bug Fixes
26
+
27
+ * update rollup to version ^0.51.0 ([#260](https://github.com/dherges/ng-packagr/issues/260)) ([0fe359e](https://github.com/dherges/ng-packagr/commit/0fe359e))
28
+
29
+
30
+ ### Features
31
+
32
+ * add tsx/jsx support ([#228](https://github.com/dherges/ng-packagr/issues/228)) ([a8eefb9](https://github.com/dherges/ng-packagr/commit/a8eefb9))
33
+
34
+
35
+
36
+ <a name="1.5.2"></a>
37
+ ## [1.5.2](https://github.com/dherges/ng-packagr/compare/v1.5.1...v1.5.2) (2017-11-14)
38
+
39
+ This release reverts a regression introduced in `v1.5.1`.
40
+ See pull request [#268](https://github.com/dherges/ng-packagr/issues/268).
41
+
42
+ Previously, a user of ng-packagr could install an incompatible typescript version for ng-packagr.
43
+ Prevent inadvertent typescript installs by depending on a user's typescript isntallation (peerDependencies).
44
+ This should be (is a) non-breaking change as any Angular project requires typescript as devDependency.
45
+
46
+ ### Bug Fixes
47
+
48
+ * depend on user's typescript ([8f5bb9c](https://github.com/dherges/ng-packagr/commit/8f5bb9c))
49
+
50
+
51
+
5
52
  <a name="1.5.1"></a>
6
53
  ## [1.5.1](https://github.com/dherges/ng-packagr/compare/v1.5.0...v1.5.1) (2017-11-10)
7
54
 
package/README.md CHANGED
@@ -115,17 +115,17 @@ All you have to do is create a `package.json` file and put it where you want a s
115
115
  One way this can be done is by mimicking the folder structure of the following example which has a testing entry point in addition to its main entry point.
116
116
 
117
117
  ```
118
- my_package
118
+ my_package
119
119
  ├── src
120
- | └── *.ts
121
- ├── public_api.ts
122
- ├── ng-package.json
120
+ | └── *.ts
121
+ ├── public_api.ts
122
+ ├── ng-package.json
123
123
  ├── package.json
124
- ├── testing
124
+ ├── testing
125
125
  ├── src
126
- | └── *.ts
127
- ├── public_api.ts
128
- └── package.json
126
+ | └── *.ts
127
+ ├── public_api.ts
128
+ └── package.json
129
129
  ```
130
130
 
131
131
  The contents of the secondary `package.json` can be as simple as:
@@ -135,7 +135,7 @@ The contents of the secondary `package.json` can be as simple as:
135
135
  }
136
136
  ```
137
137
 
138
- No, that is not a typo. No name is required. No version is required.
138
+ No, that is not a typo. No name is required. No version is required.
139
139
  It's all handled for you by ng-packagr!
140
140
  When built, the primary entry is imported with `@my/library` and the secondary entry with `@my/library/testing`.
141
141
 
@@ -154,6 +154,44 @@ For example, the following would use `index.ts` as the secondary entry point:
154
154
  }
155
155
  ```
156
156
 
157
+ ##### How do I use es2016 or es2017 features in my TypeScript library?
158
+
159
+ You can change the TypeScript language level support in tsconfig by also using the `ngPackage` configuration field in your secondary package.json` and setting the `languageLevel` property in `lib`:
160
+ For example,:
161
+
162
+ ```json
163
+ {
164
+ "ngPackage": {
165
+ "lib": {
166
+ "languageLevel": [ "dom", "es2017" ]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ ##### What if I want to use React Components?
173
+
174
+ If you have React Components that you're using in your library, and want to use proper JSX/TSX syntax in order to
175
+ construct them, you can set the `jsx` flag for your library through `ng-package` like so:
176
+
177
+ ```json
178
+ {
179
+ "$schema": "../../../src/ng-package.schema.json",
180
+ "lib": {
181
+ "entryFile": "public_api.ts",
182
+ "externals": {
183
+ "react": "React",
184
+ "react-dom": "ReactDOM"
185
+ },
186
+ "jsx": "react"
187
+ }
188
+ }
189
+ ```
190
+
191
+ The `jsx` flag will accept anything that `tsconfig` accepts, more information [here](https://www.typescriptlang.org/docs/handbook/jsx.html).
192
+
193
+ Note: Don't forget to include `react` and `react-dom` in your `externals` so that you're not bundling those dependencies.
194
+
157
195
 
158
196
  ## Further documentation
159
197
 
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,oDAA6E;AAE7E,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE5E,0BAA0B,MAAc;IACtC,MAAM,CAAC,MAAM,IAAI,oBAAoB,CAAC;AACxC,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,MAAM,CACL,sBAAsB,EACtB,2DAA2D,EAC3D,gBAAgB,EAChB,oBAAoB,CAAC;KACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,YAAY,GAAQ,OAAO,CAAC;AAElC,4BAAe,CAAC,YAAqC,CAAC;KACnD,KAAK,CAAC,CAAC,GAAG,KAAK,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 { createNgPackage, NgPackagrCliArguments } from './../lib/ng-packagr';\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(\n '-p, --project <path>',\n 'Path to the \\'ng-package.json\\' or \\'package.json\\' file.',\n parseProjectPath,\n DEFAULT_PROJECT_PATH)\n .parse(process.argv);\n\nconst cliArguments: any = program;\n\ncreateNgPackage(cliArguments as NgPackagrCliArguments)\n .catch((err) => process.exit(111));\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AACrC,6BAA6B;AAC7B,oDAA6E;AAE7E,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE5E,0BAA0B,MAAc;IACtC,MAAM,CAAC,MAAM,IAAI,oBAAoB,CAAC;AACxC,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,MAAM,CACL,sBAAsB,EACtB,2DAA2D,EAC3D,gBAAgB,EAChB,oBAAoB,CAAC;KACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,YAAY,GAAQ,OAAO,CAAC;AAElC,4BAAe,CAAC,YAAqC,CAAC;KACnD,KAAK,CAAC,CAAC,GAAG,EAAE,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 { createNgPackage, NgPackagrCliArguments } from './../lib/ng-packagr';\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(\n '-p, --project <path>',\n 'Path to the \\'ng-package.json\\' or \\'package.json\\' file.',\n parseProjectPath,\n DEFAULT_PROJECT_PATH)\n .parse(process.argv);\n\nconst cliArguments: any = program;\n\ncreateNgPackage(cliArguments as NgPackagrCliArguments)\n .catch((err) => process.exit(111));\n"]}
@@ -24,6 +24,8 @@ export declare class NgPackageData {
24
24
  readonly destinationPath: string;
25
25
  readonly buildDirectory: string;
26
26
  readonly libExternals: any;
27
+ readonly jsxConfig?: string;
28
+ readonly languageLevel: string[];
27
29
  constructor(
28
30
  /**
29
31
  * Source path of the root package (equivalent to the `src` field configured in the root ng-package.json).
@@ -39,6 +39,8 @@ class NgPackageData {
39
39
  this.libExternals = ngPackageConfig.lib.externals;
40
40
  this.flatModuleFileName = ngPackageConfig.lib.flatModuleFile;
41
41
  this.entryFile = ngPackageConfig.lib.entryFile;
42
+ this.jsxConfig = ngPackageConfig.lib.jsx;
43
+ this.languageLevel = ngPackageConfig.lib.languageLevel;
42
44
  }
43
45
  if (!this.libExternals) {
44
46
  this.libExternals = {};
@@ -49,6 +51,9 @@ class NgPackageData {
49
51
  if (!this.entryFile) {
50
52
  this.entryFile = 'public_api.ts';
51
53
  }
54
+ if (!this.languageLevel) {
55
+ this.languageLevel = ['dom', 'es2015'];
56
+ }
52
57
  // Each entry point gets it's own unique build directory based upon the package name.
53
58
  const packageBuildFolderName = this.fullPackageName.replace(exports.SCOPE_NAME_SEPARATOR, '-');
54
59
  this.buildDirectory = path_1.path.resolve(this.rootSourcePath, exports.DEFAULT_BUILD_FOLDER, packageBuildFolderName);
@@ -1 +1 @@
1
- {"version":3,"file":"ng-package-data.js","sourceRoot":"","sources":["../../../src/lib/model/ng-package-data.ts"],"names":[],"mappings":";;AACA,uCAAoC;AAEvB,QAAA,YAAY,GAAG,GAAG,CAAC;AACnB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,oBAAoB,GAAG,eAAe,CAAC;AAEpD;IAWE;QACE;;WAEG;QACa,cAAsB,EACtC,eAAuB;QACvB;;WAEG;QACa,mBAA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C;YAC7D,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;QACjD,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACzB,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,kBAAkB,GAAG,WAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAChE,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACnC,CAAC;QAED,qFAAqF;QACrF,MAAM,sBAAsB,GAAW,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,4BAAoB,EAAE,GAAG,CAAC,CAAC;QAC/F,IAAI,CAAC,cAAc,GAAG,WAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,4BAAoB,EAAE,sBAAsB,CAAC,CAAC;IACxG,CAAC;CACF;AAhED,sCAgEC","sourcesContent":["import { NgPackageConfig } from '../../ng-package.schema';\nimport { path } from '../util/path';\n\nexport const SCOPE_PREFIX = '@';\nexport const SCOPE_NAME_SEPARATOR = '/';\nexport const DEFAULT_BUILD_FOLDER = '.ng_pkg_build';\n\nexport class NgPackageData {\n public readonly pathOffsetFromSourceRoot: string;\n public readonly fullPackageName: string;\n public readonly packageNameWithoutScope: string;\n public readonly scope?: string;\n public readonly flatModuleFileName: string;\n public readonly entryFile: string;\n public readonly destinationPath: string;\n public readonly buildDirectory: string;\n public readonly libExternals: any;\n\n constructor(\n /**\n * Source path of the root package (equivalent to the `src` field configured in the root ng-package.json).\n */\n public readonly rootSourcePath: string,\n rootPackageName: string,\n /**\n * Destination path of the root package (equivalent to the `dest` field configured in the root ng-package.json).\n */\n public readonly rootDestinationPath: string,\n /**\n * Source path of the current package (equivalent to a sub folder of the `src` field configured in the root ng-package.json).\n */\n public readonly sourcePath: string,\n ngPackageConfig: NgPackageConfig\n ) {\n this.pathOffsetFromSourceRoot = this.sourcePath.substring(rootSourcePath.length);\n // destination path of secondary modules is not configurable - this is to meet the Angular package format.\n this.destinationPath = rootDestinationPath + this.pathOffsetFromSourceRoot;\n this.fullPackageName = path.ensureUnixPath(rootPackageName + this.pathOffsetFromSourceRoot);\n\n if (this.fullPackageName.startsWith(SCOPE_PREFIX)) {\n const firstSeparatorIndex: number = this.fullPackageName.indexOf(SCOPE_NAME_SEPARATOR);\n if (firstSeparatorIndex > -1) { // if there is no scope name separator\n this.scope = this.fullPackageName.substring(0, firstSeparatorIndex);\n this.packageNameWithoutScope = this.fullPackageName.substring(firstSeparatorIndex + 1);\n }\n }\n\n if (!this.packageNameWithoutScope) { // no scope was detected\n this.packageNameWithoutScope = this.fullPackageName;\n }\n\n if (ngPackageConfig.lib) {\n this.libExternals = ngPackageConfig.lib.externals;\n this.flatModuleFileName = ngPackageConfig.lib.flatModuleFile;\n this.entryFile = ngPackageConfig.lib.entryFile;\n }\n\n if (!this.libExternals) {\n this.libExternals = {};\n }\n if (!this.flatModuleFileName) {\n this.flatModuleFileName = path.basename(this.fullPackageName);\n }\n if (!this.entryFile) {\n this.entryFile = 'public_api.ts';\n }\n\n // Each entry point gets it's own unique build directory based upon the package name.\n const packageBuildFolderName: string = this.fullPackageName.replace(SCOPE_NAME_SEPARATOR, '-');\n this.buildDirectory = path.resolve(this.rootSourcePath, DEFAULT_BUILD_FOLDER, packageBuildFolderName);\n }\n}\n\n"]}
1
+ {"version":3,"file":"ng-package-data.js","sourceRoot":"","sources":["../../../src/lib/model/ng-package-data.ts"],"names":[],"mappings":";;AACA,uCAAoC;AAEvB,QAAA,YAAY,GAAG,GAAG,CAAC;AACnB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,oBAAoB,GAAG,eAAe,CAAC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S,CAAC;YAClD,IAAI,CAAC,kBAAkB,GAAG,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC;YAC7D,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;YAC/C,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;YACzC,IAAI,CAAC,aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC;QACzD,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACzB,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,kBAAkB,GAAG,WAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAChE,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACnC,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,aAAa,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC;QAED,qFAAqF;QACrF,MAAM,sBAAsB,GAAW,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,4BAAoB,EAAE,GAAG,CAAC,CAAC;QAC/F,IAAI,CAAC,cAAc,GAAG,WAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,4BAAoB,EAAE,sBAAsB,CAAC,CAAC;IACxG,CAAC;CACF;AAvED,sCAuEC","sourcesContent":["import { NgPackageConfig } from '../../ng-package.schema';\nimport { path } from '../util/path';\n\nexport const SCOPE_PREFIX = '@';\nexport const SCOPE_NAME_SEPARATOR = '/';\nexport const DEFAULT_BUILD_FOLDER = '.ng_pkg_build';\n\nexport class NgPackageData {\n public readonly pathOffsetFromSourceRoot: string;\n public readonly fullPackageName: string;\n public readonly packageNameWithoutScope: string;\n public readonly scope?: string;\n public readonly flatModuleFileName: string;\n public readonly entryFile: string;\n public readonly destinationPath: string;\n public readonly buildDirectory: string;\n public readonly libExternals: any;\n public readonly jsxConfig?: string;\n public readonly languageLevel: string[];\n\n constructor(\n /**\n * Source path of the root package (equivalent to the `src` field configured in the root ng-package.json).\n */\n public readonly rootSourcePath: string,\n rootPackageName: string,\n /**\n * Destination path of the root package (equivalent to the `dest` field configured in the root ng-package.json).\n */\n public readonly rootDestinationPath: string,\n /**\n * Source path of the current package (equivalent to a sub folder of the `src` field configured in the root ng-package.json).\n */\n public readonly sourcePath: string,\n ngPackageConfig: NgPackageConfig\n ) {\n this.pathOffsetFromSourceRoot = this.sourcePath.substring(rootSourcePath.length);\n // destination path of secondary modules is not configurable - this is to meet the Angular package format.\n this.destinationPath = rootDestinationPath + this.pathOffsetFromSourceRoot;\n this.fullPackageName = path.ensureUnixPath(rootPackageName + this.pathOffsetFromSourceRoot);\n\n if (this.fullPackageName.startsWith(SCOPE_PREFIX)) {\n const firstSeparatorIndex: number = this.fullPackageName.indexOf(SCOPE_NAME_SEPARATOR);\n if (firstSeparatorIndex > -1) { // if there is no scope name separator\n this.scope = this.fullPackageName.substring(0, firstSeparatorIndex);\n this.packageNameWithoutScope = this.fullPackageName.substring(firstSeparatorIndex + 1);\n }\n }\n\n if (!this.packageNameWithoutScope) { // no scope was detected\n this.packageNameWithoutScope = this.fullPackageName;\n }\n\n if (ngPackageConfig.lib) {\n this.libExternals = ngPackageConfig.lib.externals;\n this.flatModuleFileName = ngPackageConfig.lib.flatModuleFile;\n this.entryFile = ngPackageConfig.lib.entryFile;\n this.jsxConfig = ngPackageConfig.lib.jsx;\n this.languageLevel = ngPackageConfig.lib.languageLevel;\n }\n\n if (!this.libExternals) {\n this.libExternals = {};\n }\n if (!this.flatModuleFileName) {\n this.flatModuleFileName = path.basename(this.fullPackageName);\n }\n if (!this.entryFile) {\n this.entryFile = 'public_api.ts';\n }\n if (!this.languageLevel) {\n this.languageLevel = ['dom', 'es2015'];\n }\n\n // Each entry point gets it's own unique build directory based upon the package name.\n const packageBuildFolderName: string = this.fullPackageName.replace(SCOPE_NAME_SEPARATOR, '-');\n this.buildDirectory = path.resolve(this.rootSourcePath, DEFAULT_BUILD_FOLDER, packageBuildFolderName);\n }\n}\n\n"]}
@@ -33,7 +33,7 @@ const stylus = require("stylus");
33
33
  exports.processAssets = (src, dest) => {
34
34
  return new Promise((resolve, reject) => {
35
35
  log_1.debug(`processAssets ${src} to ${dest}`);
36
- vfs.src([`${src}/**/*.ts`, '!node_modules/**/*', '!${dest}/**/*'])
36
+ vfs.src([`${src}/**/*.ts`, `${src}/**/*.tsx`, `${src}/**/*.jsx`, '!node_modules/**/*', '!${dest}/**/*'])
37
37
  .pipe(inlineNg2Template({
38
38
  base: `${src}`,
39
39
  useRelativePaths: true,
@@ -1 +1 @@
1
- {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../src/lib/steps/assets.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,gCAAgC;AAChC,6BAA6B;AAC7B,qCAA0C;AAC1C,uCAAoC;AAEpC,gDAAgD;AAChD,8DAA8D;AAE9D,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,mCAAmC;AACnC,kCAAkC;AAClC,6BAA6B;AAC7B,iCAAiC;AAGjC;;;;;;;;GAQG;AACU,QAAA,aAAa,GAAG,CAAC,GAAW,EAAE,IAAY;IAErD,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM;QACjC,WAAK,CAAC,iBAAiB,GAAG,OAAO,IAAI,EAAE,CAAC,CAAC;QAEzC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,UAAU,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;aAC/D,IAAI,CAAC,iBAAiB,CAAC;YAC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AAO,CAAC,IAAI,CAAC;aACb,OAAO,CAAC,GAAG,CAAC;aAEZ,OAAO,CAAC,cAAc,CAAC;aACvB,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC;aAEzB,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC;aACxB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;aAChC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG;YACf,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACV,CAAC,CAAA","sourcesContent":["import * as vfs from 'vinyl-fs';\nimport * as path from 'path';\nimport { debug, warn } from '../util/log';\nimport { readFile } from 'fs-extra';\n\n// Angular Inliner for Templates and Stylesheets\nimport * as inlineNg2Template from 'gulp-inline-ng2-template';\n\n// CSS Tools\nimport * as autoprefixer from 'autoprefixer';\nimport * as browserslist from 'browserslist';\nimport * as postcss from 'postcss';\nimport * as sass from 'node-sass';\nimport * as less from 'less';\nimport * as stylus from 'stylus';\n\n\n/**\n * Process Angular components assets (HTML and Stylesheets).\n *\n * Inlines 'templateUrl' and 'styleUrl', compiles .scss to .css, and write .ts files to\n * destination directory.\n *\n * @param src Source folder\n * @param dest Destination folder\n */\nexport const processAssets = (src: string, dest: string): Promise<any> => {\n\n return new Promise((resolve, reject) => {\n debug(`processAssets ${src} to ${dest}`);\n\n vfs.src([`${src}/**/*.ts`, '!node_modules/**/*', '!${dest}/**/*'])\n .pipe(inlineNg2Template({\n base: `${src}`,\n useRelativePaths: true,\n styleProcessor: async (path, ext, file, cb) => {\n\n debug(`render stylesheet ${path}`);\n const renderPickTask: Promise<string> = pickRenderer(path, file, src);\n\n debug(`postcss with autoprefixer for ${path}`);\n const browsers = browserslist(undefined, { path });\n\n try {\n const css: string = await renderPickTask;\n const result: postcss.Result = await postcss([ autoprefixer({ browsers }) ])\n .process(css, { from: path, to: path.replace(ext, '.css') });\n result.warnings().forEach((msg) => {\n warn(msg.toString());\n });\n\n cb(undefined, result.css);\n } catch (err) {\n cb(err || new Error(`Cannot inline stylesheet ${path}`));\n }\n }\n }))\n .on('error', reject)\n .pipe(vfs.dest(`${dest}`))\n .on('end', resolve);\n });\n\n}\n\n\nconst sassImporter = (url: string): any => {\n if (url[0] === '~') {\n url = path.resolve('node_modules', url.substr(1));\n }\n\n return { file: url };\n}\n\n\nasync function pickRenderer(\n filePath: string,\n file: string,\n srcPath: string): Promise<string> {\n\n switch (path.extname(filePath)) {\n\n case '.scss':\n case '.sass':\n debug(`rendering sass for ${filePath}`);\n return await renderSass({ file: filePath, importer: sassImporter });\n\n case '.less':\n debug(`rendering less for ${filePath}`);\n return await renderLess({ filename: filePath });\n\n case '.styl':\n case '.stylus':\n debug(`rendering styl for ${filePath}`);\n return await renderStylus({ filename: filePath, root: srcPath });\n\n case '.css':\n default:\n return file;\n }\n\n}\n\n\nconst renderSass = (sassOpts: any): Promise<string> => {\n\n return new Promise((resolve, reject) => {\n\n sass.render(sassOpts, (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result.css.toString());\n }\n });\n });\n}\n\nconst renderLess = (lessOpts: any): Promise<string> => {\n\n return readFile(lessOpts.filename)\n .then(buffer => buffer.toString())\n .then((lessData: string) => new Promise<string>((resolve, reject) => {\n less.render(lessData || '', lessOpts, (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result.css.toString());\n }\n })\n }));\n}\n\n/**\n * filename - absolute path to file\n * root - root folder of project (where ng-package.json is located)\n */\nconst renderStylus = ({ filename, root }): Promise<string> => {\n return readFile(filename)\n .then(buffer => buffer.toString())\n .then((stylusData: string) => new Promise<string>((resolve, reject) => {\n stylus(stylusData)\n // add paths for resolve\n .include(root)\n .include('.')\n // add support for resolving plugins from node_modules\n .include('node_modules')\n .set('filename', filename)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver())\n .render((err, css) => {\n if (err) {\n reject(err);\n } else {\n resolve(css);\n }\n });\n }));\n}\n"]}
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../src/lib/steps/assets.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,gCAAgC;AAChC,6BAA6B;AAC7B,qCAA0C;AAC1C,uCAAoC;AAEpC,gDAAgD;AAChD,8DAA8D;AAE9D,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,mCAAmC;AACnC,kCAAkC;AAClC,6BAA6B;AAC7B,iCAAiC;AAGjC;;;;;;;;GAQG;AACU,QAAA,aAAa,GAAG,CAAC,GAAW,EAAE,IAAY,EAAgB,EAAE;IAEvE,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,WAAK,CAAC,iBAAiB,GAAG,OAAO,IAAI,EAAE,CAAC,CAAC;QAEzC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,UAAU,EAAE,GAAG,GAAG,WAAW,EAAE,GAAG,GAAG,WAAW,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;aACrG,IAAI,CAAC,iBAAiB,CAAC;YACtB,IAAI,EAAE,GAAG,GAAG,EAAE;YACd,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,CAAO,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;gBAE5C,WAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;gBACnC,MAAM,cAAc,GAAoB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;gBAEtE,WAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;gBAC/C,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC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,EAAE,CAAC;aAChC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACnB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACV,CAAC,CAAA","sourcesContent":["import * as vfs from 'vinyl-fs';\nimport * as path from 'path';\nimport { debug, warn } from '../util/log';\nimport { readFile } from 'fs-extra';\n\n// Angular Inliner for Templates and Stylesheets\nimport * as inlineNg2Template from 'gulp-inline-ng2-template';\n\n// CSS Tools\nimport * as autoprefixer from 'autoprefixer';\nimport * as browserslist from 'browserslist';\nimport * as postcss from 'postcss';\nimport * as sass from 'node-sass';\nimport * as less from 'less';\nimport * as stylus from 'stylus';\n\n\n/**\n * Process Angular components assets (HTML and Stylesheets).\n *\n * Inlines 'templateUrl' and 'styleUrl', compiles .scss to .css, and write .ts files to\n * destination directory.\n *\n * @param src Source folder\n * @param dest Destination folder\n */\nexport const processAssets = (src: string, dest: string): Promise<any> => {\n\n return new Promise((resolve, reject) => {\n debug(`processAssets ${src} to ${dest}`);\n\n vfs.src([`${src}/**/*.ts`, `${src}/**/*.tsx`, `${src}/**/*.jsx`, '!node_modules/**/*', '!${dest}/**/*'])\n .pipe(inlineNg2Template({\n base: `${src}`,\n useRelativePaths: true,\n styleProcessor: async (path, ext, file, cb) => {\n\n debug(`render stylesheet ${path}`);\n const renderPickTask: Promise<string> = pickRenderer(path, file, src);\n\n debug(`postcss with autoprefixer for ${path}`);\n const browsers = browserslist(undefined, { path });\n\n try {\n const css: string = await renderPickTask;\n const result: postcss.Result = await postcss([ autoprefixer({ browsers }) ])\n .process(css, { from: path, to: path.replace(ext, '.css') });\n result.warnings().forEach((msg) => {\n warn(msg.toString());\n });\n\n cb(undefined, result.css);\n } catch (err) {\n cb(err || new Error(`Cannot inline stylesheet ${path}`));\n }\n }\n }))\n .on('error', reject)\n .pipe(vfs.dest(`${dest}`))\n .on('end', resolve);\n });\n\n}\n\n\nconst sassImporter = (url: string): any => {\n if (url[0] === '~') {\n url = path.resolve('node_modules', url.substr(1));\n }\n\n return { file: url };\n}\n\n\nasync function pickRenderer(\n filePath: string,\n file: string,\n srcPath: string): Promise<string> {\n\n switch (path.extname(filePath)) {\n\n case '.scss':\n case '.sass':\n debug(`rendering sass for ${filePath}`);\n return await renderSass({ file: filePath, importer: sassImporter });\n\n case '.less':\n debug(`rendering less for ${filePath}`);\n return await renderLess({ filename: filePath });\n\n case '.styl':\n case '.stylus':\n debug(`rendering styl for ${filePath}`);\n return await renderStylus({ filename: filePath, root: srcPath });\n\n case '.css':\n default:\n return file;\n }\n\n}\n\n\nconst renderSass = (sassOpts: any): Promise<string> => {\n\n return new Promise((resolve, reject) => {\n\n sass.render(sassOpts, (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result.css.toString());\n }\n });\n });\n}\n\nconst renderLess = (lessOpts: any): Promise<string> => {\n\n return readFile(lessOpts.filename)\n .then(buffer => buffer.toString())\n .then((lessData: string) => new Promise<string>((resolve, reject) => {\n less.render(lessData || '', lessOpts, (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result.css.toString());\n }\n })\n }));\n}\n\n/**\n * filename - absolute path to file\n * root - root folder of project (where ng-package.json is located)\n */\nconst renderStylus = ({ filename, root }): Promise<string> => {\n return readFile(filename)\n .then(buffer => buffer.toString())\n .then((stylusData: string) => new Promise<string>((resolve, reject) => {\n stylus(stylusData)\n // add paths for resolve\n .include(root)\n .include('.')\n // add support for resolving plugins from node_modules\n .include('node_modules')\n .set('filename', filename)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver())\n .render((err, css) => {\n if (err) {\n reject(err);\n } else {\n resolve(css);\n }\n });\n }));\n}\n"]}
package/lib/steps/ngc.js CHANGED
@@ -21,6 +21,13 @@ function prepareTsConfig(ngPkg, outFile) {
21
21
  compilerOptions.flatModuleId = ngPkg.fullPackageName;
22
22
  compilerOptions.flatModuleOutFile = `${ngPkg.flatModuleFileName}.js`;
23
23
  tsConfig['files'] = [ngPkg.entryFile];
24
+ if (ngPkg.jsxConfig) {
25
+ log_1.debug('prepareTsConfig: Applying jsx flag to tsconfig ' + ngPkg.jsxConfig);
26
+ tsConfig['compilerOptions']['jsx'] = ngPkg.jsxConfig;
27
+ }
28
+ if (ngPkg.languageLevel) {
29
+ tsConfig.compilerOptions.lib = ngPkg.languageLevel;
30
+ }
24
31
  yield fs_extra_1.writeJson(outFile, tsConfig);
25
32
  });
26
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngc.js","sourceRoot":"","sources":["../../../src/lib/steps/ngc.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,sDAA2E;AAE3E,uCAA+C;AAC/C,qCAAoC;AAGpC,yBAA+B,KAAoB,EAAE,OAAe;;QAClE,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;QACxF,WAAK,CAAC,6CAA6C,GAAG,YAAY,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAQ,MAAM,mBAAQ,CAAC,YAAY,CAAC,CAAC;QAEnD,MAAM,eAAe,GAA2B,QAAQ,CAAC,sBAAsB,CAAC;QAChF,eAAe,CAAC,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC;QACrD,eAAe,CAAC,iBAAiB,GAAG,GAAG,KAAK,CAAC,kBAAkB,KAAK,CAAC;QAErE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAE,KAAK,CAAC,SAAS,CAAE,CAAC;QAExC,MAAM,oBAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;CAAA;AAGD;;;;;GAKG;AACH,aAA0B,KAAoB,EAAE,QAAgB;;QAC9D,MAAM,YAAY,GAAW,GAAG,QAAQ,oBAAoB,CAAC;QAC7D,WAAK,CAAC,OAAO,YAAY,iBAAiB,QAAQ,KAAK,CAAC,CAAC;QAEzD,MAAM,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3C,MAAM,kBAAG,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEtC,WAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,YAAY,CAAC,CAAC;QAE9C,MAAM,CAAC,GAAG,QAAQ,IAAI,QAAQ,CAAC,eAAe,CAAC,MAAM,IAAI,QAAQ,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,CAAC;IAC/G,CAAC;CAAA;AAXD,kBAWC","sourcesContent":["import * as path from 'path';\nimport { main as tsc, AngularCompilerOptions } from '@angular/tsc-wrapped';\nimport { NgPackageData } from '../model/ng-package-data';\nimport { readJson, writeJson } from 'fs-extra';\nimport { debug } from '../util/log';\n\n\nasync function prepareTsConfig(ngPkg: NgPackageData, outFile: string): Promise<void> {\n const tsConfigPath: string = path.resolve(__dirname, '..', 'conf', 'tsconfig.ngc.json');\n debug('prepareTsConfig: Resolved tsconfig path to ' + tsConfigPath);\n\n const tsConfig: any = await readJson(tsConfigPath);\n\n const compilerOptions: AngularCompilerOptions = tsConfig.angularCompilerOptions;\n compilerOptions.flatModuleId = ngPkg.fullPackageName;\n compilerOptions.flatModuleOutFile = `${ngPkg.flatModuleFileName}.js`;\n\n tsConfig['files'] = [ ngPkg.entryFile ];\n\n await writeJson(outFile, tsConfig);\n}\n\n\n/**\n * Compiles typescript sources with 'ngc'.\n *\n * @param ngPkg Angular package data\n * @param basePath\n */\nexport async function ngc(ngPkg: NgPackageData, basePath: string): Promise<string> {\n const tsConfigPath: string = `${basePath}/tsconfig.lib.json`;\n debug(`ngc ${tsConfigPath}, { basePath: ${basePath} })`);\n\n await prepareTsConfig(ngPkg, tsConfigPath);\n await tsc(tsConfigPath, { basePath });\n\n debug('Reading tsconfig from ' + tsConfigPath);\n const tsConfig = await readJson(tsConfigPath);\n\n return `${basePath}/${tsConfig.compilerOptions.outDir}/${tsConfig.angularCompilerOptions.flatModuleOutFile}`;\n}\n"]}
1
+ {"version":3,"file":"ngc.js","sourceRoot":"","sources":["../../../src/lib/steps/ngc.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,sDAA2E;AAE3E,uCAA+C;AAC/C,qCAAoC;AAGpC,yBAA+B,KAAoB,EAAE,OAAe;;QAClE,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;QACxF,WAAK,CAAC,6CAA6C,GAAG,YAAY,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAQ,MAAM,mBAAQ,CAAC,YAAY,CAAC,CAAC;QAEnD,MAAM,eAAe,GAA2B,QAAQ,CAAC,sBAAsB,CAAC;QAChF,eAAe,CAAC,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC;QACrD,eAAe,CAAC,iBAAiB,GAAG,GAAG,KAAK,CAAC,kBAAkB,KAAK,CAAC;QAErE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAE,KAAK,CAAC,SAAS,CAAE,CAAC;QAExC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YACpB,WAAK,CAAC,iDAAiD,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3E,QAAQ,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;QACvD,CAAC;QAED,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;YACxB,QAAQ,CAAC,eAAe,CAAC,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC;QACrD,CAAC;QAED,MAAM,oBAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;CAAA;AAGD;;;;;GAKG;AACH,aAA0B,KAAoB,EAAE,QAAgB;;QAC9D,MAAM,YAAY,GAAW,GAAG,QAAQ,oBAAoB,CAAC;QAC7D,WAAK,CAAC,OAAO,YAAY,iBAAiB,QAAQ,KAAK,CAAC,CAAC;QAEzD,MAAM,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3C,MAAM,kBAAG,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEtC,WAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,YAAY,CAAC,CAAC;QAE9C,MAAM,CAAC,GAAG,QAAQ,IAAI,QAAQ,CAAC,eAAe,CAAC,MAAM,IAAI,QAAQ,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,CAAC;IAC/G,CAAC;CAAA;AAXD,kBAWC","sourcesContent":["import * as path from 'path';\nimport { main as tsc, AngularCompilerOptions } from '@angular/tsc-wrapped';\nimport { NgPackageData } from '../model/ng-package-data';\nimport { readJson, writeJson } from 'fs-extra';\nimport { debug } from '../util/log';\n\n\nasync function prepareTsConfig(ngPkg: NgPackageData, outFile: string): Promise<void> {\n const tsConfigPath: string = path.resolve(__dirname, '..', 'conf', 'tsconfig.ngc.json');\n debug('prepareTsConfig: Resolved tsconfig path to ' + tsConfigPath);\n\n const tsConfig: any = await readJson(tsConfigPath);\n\n const compilerOptions: AngularCompilerOptions = tsConfig.angularCompilerOptions;\n compilerOptions.flatModuleId = ngPkg.fullPackageName;\n compilerOptions.flatModuleOutFile = `${ngPkg.flatModuleFileName}.js`;\n\n tsConfig['files'] = [ ngPkg.entryFile ];\n\n if (ngPkg.jsxConfig) {\n debug('prepareTsConfig: Applying jsx flag to tsconfig ' + ngPkg.jsxConfig);\n tsConfig['compilerOptions']['jsx'] = ngPkg.jsxConfig;\n }\n\n if (ngPkg.languageLevel) {\n tsConfig.compilerOptions.lib = ngPkg.languageLevel;\n }\n\n await writeJson(outFile, tsConfig);\n}\n\n\n/**\n * Compiles typescript sources with 'ngc'.\n *\n * @param ngPkg Angular package data\n * @param basePath\n */\nexport async function ngc(ngPkg: NgPackageData, basePath: string): Promise<string> {\n const tsConfigPath: string = `${basePath}/tsconfig.lib.json`;\n debug(`ngc ${tsConfigPath}, { basePath: ${basePath} })`);\n\n await prepareTsConfig(ngPkg, tsConfigPath);\n await tsc(tsConfigPath, { basePath });\n\n debug('Reading tsconfig from ' + tsConfigPath);\n const tsConfig = await readJson(tsConfigPath);\n\n return `${basePath}/${tsConfig.compilerOptions.outDir}/${tsConfig.angularCompilerOptions.flatModuleOutFile}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/lib/steps/package.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAE7B,8DAA+E;AAE/E,uCAA2C;AAC3C,uCAAsE;AACtE,mCAAwC;AACxC,mCAAmC;AAGnC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAE9C,2EAA2E;AAC3E,yBAAyB,QAAQ,EAAE,QAAQ;IACzC,EAAE,CAAC,CAAC,gBAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,sBAAsB,gBAAwB,EAAE,aAA8B;IAC5E,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAClB,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACvB,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1E,CAAC;QAED,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC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PackageData, DEFAULT_BUILD_FOLDER } from '../model/ng-package-data';\nimport { NgArtifacts } from '../model/ng-artifacts';\nimport { tryReadJson } from '../util/json';\nimport { readJson, writeJson, readdir, lstat, Stats } from 'fs-extra';\nimport { merge, isArray } from 'lodash';\nimport * as log from '../util/log';\nimport { PackageSearchResult } from '../model/package-search-result';\n\nconst PACKAGE_JSON_FILE_NAME = 'package.json';\n\n// this prevents array objects from getting merged to each other one by one\nfunction arrayMergeLogic(objValue, srcValue) {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\n// ensures paths are absolute by combining with working directory\nfunction resolvePaths(workingDirectory: string, packageConfig: NgPackageConfig): void {\n if (packageConfig) {\n if (packageConfig.dest) {\n packageConfig.dest = path.resolve(workingDirectory, packageConfig.dest);\n }\n\n if (packageConfig.src) {\n packageConfig.src = path.resolve(workingDirectory, packageConfig.src);\n }\n }\n};\n\nasync function readNgPackageFile(filePath: string): Promise<NgPackageConfig | null> {\n\n log.debug('Searching for ng-package config at ' + filePath);\n try {\n const ngPkg: NgPackageConfig = await readJson(filePath);\n log.debug('Ng-package config found at ' + filePath);\n const basePath: string = path.dirname(filePath);\n resolvePaths(basePath, ngPkg);\n return ngPkg;\n } catch (error) {\n if (error.code === 'ENOENT') {\n log.debug('ng-package config file not found');\n // if the file does not exist, that's ok\n return null;\n }\n throw error;\n }\n\n}\n\nfunction shouldExcludeFromDirectorySearch(searchDirectory: string, foldersToExclude: string[]) {\n for (const exclusionFolder of foldersToExclude) {\n if (exclusionFolder.endsWith(searchDirectory)) {\n return true;\n }\n }\n\n return false;\n}\n\nasync function getTopLevelFolderPaths(rootFolderPath: string, foldersToExclude: string[]): Promise<string[]> {\n const directoriesToSearch: string[] = [];\n const fileSystemEntries: string[] = await readdir(rootFolderPath);\n for (const fileSystemPath of fileSystemEntries) {\n const fullPath: string = path.resolve(rootFolderPath, fileSystemPath);\n const pathStats: Stats = await lstat(fullPath);\n if (pathStats.isDirectory() && !shouldExcludeFromDirectorySearch(fileSystemPath, foldersToExclude)) {\n directoriesToSearch.push(fullPath);\n }\n }\n\n return directoriesToSearch;\n}\n\nasync function findSecondaryPackagePaths(rootPackage: NgPackageData): Promise<string[]> {\n log.debug('Beginning package search from root ' + rootPackage.sourcePath);\n\n // Failing to exclude any of these folders will result in the wrong build output\n const foldersToExclude: string[] = [\n 'node_modules',\n 'dist',\n '.ng_build', // legacy build folder\n DEFAULT_BUILD_FOLDER,\n rootPackage.destinationPath\n ];\n const directoriesToSearch: string[] = await getTopLevelFolderPaths(rootPackage.sourcePath, foldersToExclude);\n const packagePaths: string[] = [];\n\n // read all directories (without recursion)\n while(directoriesToSearch.length > 0) {\n const searchDirectory: string = directoriesToSearch.pop();\n const fileSystemEntries: string[] = await readdir(searchDirectory);\n let packageFileFound = false;\n\n // file system entries might be files, or directories, or named pipes, etc.\n for (const fileSystemPath of fileSystemEntries) {\n const fullPath: string = path.resolve(searchDirectory, fileSystemPath);\n // discover the type of file system entry by using `lstat`.\n // NOTE: `lstat` is used instead of `stat` in order to prevent failures during resolution of symbolic links\n const pathStats: Stats = await lstat(fullPath);\n if (pathStats.isDirectory() && !shouldExcludeFromDirectorySearch(fileSystemPath, foldersToExclude)) {\n directoriesToSearch.push(fullPath);\n } else if (!packageFileFound && pathStats.isFile()) {\n if (fileSystemPath.endsWith(PACKAGE_JSON_FILE_NAME)) {\n packagePaths.push(fullPath);\n packageFileFound = true;\n // we can't `break` here because doing so might cause us to miss some directories\n }\n }\n }\n }\n\n log.debug('Resolved secondary package paths: ' + packagePaths.join(','))\n\n return packagePaths;\n}\n\n/**\n * Reads an Angular package definition first from the passed in file path,\n * then from the default ng-package.json file,\n * then from package.json, and merges the json into one config object.\n *\n * @param filePath path pointing to `ng-package.json` file\n */\nasync function readRootPackage(filePath: string): Promise<NgPackageData> {\n\n const cwd: string = process.cwd();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n\n const baseDirectory = path.dirname(filePath);\n\n // read custom ng-package config file\n let promiseChain: Promise<NgPackageConfig> = readNgPackageFile(filePath)\n .then((ngPkg: NgPackageConfig | null) => ngPkg || {});\n\n const defaultPath = path.join(baseDirectory, 'ng-package.json');\n if (defaultPath !== filePath) {\n // read default ng-package config file\n promiseChain = promiseChain.then(async (ngPkg: NgPackageConfig) => {\n const otherNgPkg: NgPackageConfig | null = await readNgPackageFile(defaultPath);\n // merge both ng-package config objects\n // merge will never return null\n return merge(ngPkg, otherNgPkg, arrayMergeLogic);\n });\n }\n\n const ngPkg: NgPackageConfig = await promiseChain;\n // resolve paths relative to `ng-package.json` file\n const packageConfigurationDirectory = path.resolve(baseDirectory, ngPkg.src || '.');\n\n // read 'package.json'\n log.debug('loading package.json');\n\n const pkg: any = await readJson(path.resolve(packageConfigurationDirectory, PACKAGE_JSON_FILE_NAME));\n // merge package.json ng-package config\n const finalPackageConfig = merge(ngPkg, pkg.ngPackage, arrayMergeLogic);\n // make sure we provide default values for src and dest\n finalPackageConfig.src = finalPackageConfig.src || packageConfigurationDirectory;\n finalPackageConfig.dest = finalPackageConfig.dest || path.resolve(packageConfigurationDirectory,'dist');\n\n return new NgPackageData(\n finalPackageConfig.src,\n pkg.name,\n finalPackageConfig.dest,\n finalPackageConfig.src,\n finalPackageConfig\n );\n}\n\nasync function readSecondaryPackage(rootPackage: NgPackageData, filePath: string): Promise<NgPackageData | null> {\n const baseDirectory = path.dirname(filePath);\n const ngPackageFile = path.resolve(baseDirectory, 'ng-package.json');\n const packageJsonFile = path.resolve(baseDirectory, PACKAGE_JSON_FILE_NAME);\n\n let ngPackage: NgPackageConfig | null = await readNgPackageFile(ngPackageFile);\n const packageJson: any = await tryReadJson(packageJsonFile);\n\n // if we don't detect any explicit package configurations, then ignore\n if (!ngPackage) {\n if (!packageJson || !packageJson.ngPackage) {\n log.debug(`No secondary package found in ${baseDirectory}`);\n return null;\n }\n }\n\n ngPackage = merge(ngPackage, packageJson.ngPackage, arrayMergeLogic);\n if (!ngPackage.lib) {\n ngPackage.lib = {};\n }\n\n ngPackage.lib.externals = rootPackage.libExternals;\n\n return new NgPackageData(\n rootPackage.sourcePath,\n rootPackage.fullPackageName,\n rootPackage.destinationPath,\n baseDirectory,\n ngPackage\n );\n}\n\n/**\n * Search for, and read, root and secondary packages starting from a root path.\n *\n * @param {string} rootPath The path to your root folder which contains a package.json file\n * @returns {Promise<PackageSearchResult>}\n */\nexport async function discoverPackages(rootPath: string): Promise<PackageSearchResult> {\n\n // the root package gets read a bit differently than secondary packages because it must guarantee full paths\n const rootPackage: NgPackageData = await readRootPackage(rootPath);\n\n // With the metadata from the root package, we can proceed to read secondary packages in sub folders\n // This assumes that all secondary packages exist in sub paths of the root path.\n // Without such an assumption, automatic secondary package discovery would not be feasible.\n // Specifically, the function is looking for `ng-package.json` or `package.json` files.\n const secondaryPackagePaths: string[] = await findSecondaryPackagePaths(rootPackage);\n\n const secondaryPackagePromises: Promise<NgPackageData>[] = secondaryPackagePaths\n .map(secondaryPackagePath => readSecondaryPackage(rootPackage, secondaryPackagePath));\n\n const secondaryPackagesFromPaths: (NgPackageData | null)[] = await Promise.all(secondaryPackagePromises);\n\n // The packages that are null should be excluded because they were not explicitly meant to be secondary entries\n const secondaryPackages: NgPackageData[] = secondaryPackagesFromPaths.filter(x => !!x);\n\n return {\n rootPackage,\n secondaryPackages\n };\n}\n\n\n/**\n * Creates a `package.json` file by reading one from the `src` folder, adding additional\n * properties, and writing to `dest` folder\n *\n * @param ngPkg Angular package data\n * @param packageArtifacts Package artifacts to merge into package.json\n */\nexport async function writePackage(ngPkg: NgPackageData, packageArtifacts: NgArtifacts): Promise<void> {\n\n log.debug('writePackage');\n const packageJson: any = await readJson(path.resolve(ngPkg.sourcePath, PACKAGE_JSON_FILE_NAME));\n // set additional properties\n for(const fieldName in packageArtifacts) {\n packageJson[fieldName] = packageArtifacts[fieldName];\n }\n\n packageJson.name = ngPkg.fullPackageName;\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n\n await writeJson(path.resolve(ngPkg.destinationPath, PACKAGE_JSON_FILE_NAME), packageJson);\n}\n"]}
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/lib/steps/package.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAE7B,8DAA+E;AAE/E,uCAA2C;AAC3C,uCAAsE;AACtE,mCAAwC;AACxC,mCAAmC;AAGnC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAE9C,2EAA2E;AAC3E,yBAAyB,QAAQ,EAAE,QAAQ;IACzC,EAAE,CAAC,CAAC,gBAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,sBAAsB,gBAAwB,EAAE,aAA8B;IAC5E,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAClB,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACvB,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1E,CAAC;QAED,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YACtB,aAAa,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAAA,CAAC;AAEF,2BAAiC,QAAgB;;QAE/C,GAAG,CAAC,KAAK,CAAC,qCAAqC,GAAG,QAAQ,CAAC,CAAC;QAC5D,IAAI,CAAC;YACH,MAAM,KAAK,GAAoB,MAAM,mBAAQ,CAAC,QAAQ,CAAC,CAAC;YACxD,GAAG,CAAC,KAAK,CAAC,6BAA6B,GAAG,QAAQ,CAAC,CAAC;YACpD,MAAM,QAAQ,GAAW,IAA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AC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvF,MAAM,CAAC;YACL,WAAW;YACX,iBAAiB;SAClB,CAAC;IACJ,CAAC;CAAA;AAvBD,4CAuBC;AAGD;;;;;;GAMG;AACH,sBAAmC,KAAoB,EAAE,gBAA6B;;QAEpF,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC1B,MAAM,WAAW,GAAQ,MAAM,mBAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAChG,4BAA4B;QAC5B,GAAG,CAAA,CAAC,MAAM,SAAS,IAAI,gBAAgB,CAAC,CAAC,CAAC;YACxC,WAAW,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC;QAED,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC;QAEzC,mCAAmC;QACnC,wDAAwD;QACxD,OAAO,WAAW,CAAC,SAAS,CAAC;QAE7B,MAAM,oBAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,sBAAsB,CAAC,EAAE,WAAW,CAAC,CAAC;IAC5F,CAAC;CAAA;AAhBD,oCAgBC","sourcesContent":["import * as path from 'path';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { NgPackageData, DEFAULT_BUILD_FOLDER } from '../model/ng-package-data';\nimport { NgArtifacts } from '../model/ng-artifacts';\nimport { tryReadJson } from '../util/json';\nimport { readJson, writeJson, readdir, lstat, Stats } from 'fs-extra';\nimport { merge, isArray } from 'lodash';\nimport * as log from '../util/log';\nimport { PackageSearchResult } from '../model/package-search-result';\n\nconst PACKAGE_JSON_FILE_NAME = 'package.json';\n\n// this prevents array objects from getting merged to each other one by one\nfunction arrayMergeLogic(objValue, srcValue) {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\n// ensures paths are absolute by combining with working directory\nfunction resolvePaths(workingDirectory: string, packageConfig: NgPackageConfig): void {\n if (packageConfig) {\n if (packageConfig.dest) {\n packageConfig.dest = path.resolve(workingDirectory, packageConfig.dest);\n }\n\n if (packageConfig.src) {\n packageConfig.src = path.resolve(workingDirectory, packageConfig.src);\n }\n }\n};\n\nasync function readNgPackageFile(filePath: string): Promise<NgPackageConfig | null> {\n\n log.debug('Searching for ng-package config at ' + filePath);\n try {\n const ngPkg: NgPackageConfig = await readJson(filePath);\n log.debug('Ng-package config found at ' + filePath);\n const basePath: string = path.dirname(filePath);\n resolvePaths(basePath, ngPkg);\n return ngPkg;\n } catch (error) {\n if (error.code === 'ENOENT') {\n log.debug('ng-package config file not found');\n // if the file does not exist, that's ok\n return null;\n }\n throw error;\n }\n\n}\n\nfunction shouldExcludeFromDirectorySearch(searchDirectory: string, foldersToExclude: string[]) {\n for (const exclusionFolder of foldersToExclude) {\n if (exclusionFolder.endsWith(searchDirectory)) {\n return true;\n }\n }\n\n return false;\n}\n\nasync function getTopLevelFolderPaths(rootFolderPath: string, foldersToExclude: string[]): Promise<string[]> {\n const directoriesToSearch: string[] = [];\n const fileSystemEntries: string[] = await readdir(rootFolderPath);\n for (const fileSystemPath of fileSystemEntries) {\n const fullPath: string = path.resolve(rootFolderPath, fileSystemPath);\n const pathStats: Stats = await lstat(fullPath);\n if (pathStats.isDirectory() && !shouldExcludeFromDirectorySearch(fileSystemPath, foldersToExclude)) {\n directoriesToSearch.push(fullPath);\n }\n }\n\n return directoriesToSearch;\n}\n\nasync function findSecondaryPackagePaths(rootPackage: NgPackageData): Promise<string[]> {\n log.debug('Beginning package search from root ' + rootPackage.sourcePath);\n\n // Failing to exclude any of these folders will result in the wrong build output\n const foldersToExclude: string[] = [\n 'node_modules',\n 'dist',\n '.ng_build', // legacy build folder\n DEFAULT_BUILD_FOLDER,\n rootPackage.destinationPath\n ];\n const directoriesToSearch: string[] = await getTopLevelFolderPaths(rootPackage.sourcePath, foldersToExclude);\n const packagePaths: string[] = [];\n\n // read all directories (without recursion)\n while(directoriesToSearch.length > 0) {\n const searchDirectory: string = directoriesToSearch.pop();\n const fileSystemEntries: string[] = await readdir(searchDirectory);\n let packageFileFound = false;\n\n // file system entries might be files, or directories, or named pipes, etc.\n for (const fileSystemPath of fileSystemEntries) {\n const fullPath: string = path.resolve(searchDirectory, fileSystemPath);\n // discover the type of file system entry by using `lstat`.\n // NOTE: `lstat` is used instead of `stat` in order to prevent failures during resolution of symbolic links\n const pathStats: Stats = await lstat(fullPath);\n if (pathStats.isDirectory() && !shouldExcludeFromDirectorySearch(fileSystemPath, foldersToExclude)) {\n directoriesToSearch.push(fullPath);\n } else if (!packageFileFound && pathStats.isFile()) {\n if (fileSystemPath.endsWith(PACKAGE_JSON_FILE_NAME)) {\n packagePaths.push(fullPath);\n packageFileFound = true;\n // we can't `break` here because doing so might cause us to miss some directories\n }\n }\n }\n }\n\n log.debug('Resolved secondary package paths: ' + packagePaths.join(','))\n\n return packagePaths;\n}\n\n/**\n * Reads an Angular package definition first from the passed in file path,\n * then from the default ng-package.json file,\n * then from package.json, and merges the json into one config object.\n *\n * @param filePath path pointing to `ng-package.json` file\n */\nasync function readRootPackage(filePath: string): Promise<NgPackageData> {\n\n const cwd: string = process.cwd();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n\n const baseDirectory = path.dirname(filePath);\n\n // read custom ng-package config file\n let promiseChain: Promise<NgPackageConfig> = readNgPackageFile(filePath)\n .then((ngPkg: NgPackageConfig | null) => ngPkg || {});\n\n const defaultPath = path.join(baseDirectory, 'ng-package.json');\n if (defaultPath !== filePath) {\n // read default ng-package config file\n promiseChain = promiseChain.then(async (ngPkg: NgPackageConfig) => {\n const otherNgPkg: NgPackageConfig | null = await readNgPackageFile(defaultPath);\n // merge both ng-package config objects\n // merge will never return null\n return merge(ngPkg, otherNgPkg, arrayMergeLogic);\n });\n }\n\n const ngPkg: NgPackageConfig = await promiseChain;\n // resolve paths relative to `ng-package.json` file\n const packageConfigurationDirectory = path.resolve(baseDirectory, ngPkg.src || '.');\n\n // read 'package.json'\n log.debug('loading package.json');\n\n const pkg: any = await readJson(path.resolve(packageConfigurationDirectory, PACKAGE_JSON_FILE_NAME));\n // merge package.json ng-package config\n const finalPackageConfig = merge(ngPkg, pkg.ngPackage, arrayMergeLogic);\n // make sure we provide default values for src and dest\n finalPackageConfig.src = finalPackageConfig.src || packageConfigurationDirectory;\n finalPackageConfig.dest = finalPackageConfig.dest || path.resolve(packageConfigurationDirectory,'dist');\n\n return new NgPackageData(\n finalPackageConfig.src,\n pkg.name,\n finalPackageConfig.dest,\n finalPackageConfig.src,\n finalPackageConfig\n );\n}\n\nasync function readSecondaryPackage(rootPackage: NgPackageData, filePath: string): Promise<NgPackageData | null> {\n const baseDirectory = path.dirname(filePath);\n const ngPackageFile = path.resolve(baseDirectory, 'ng-package.json');\n const packageJsonFile = path.resolve(baseDirectory, PACKAGE_JSON_FILE_NAME);\n\n let ngPackage: NgPackageConfig | null = await readNgPackageFile(ngPackageFile);\n const packageJson: any = await tryReadJson(packageJsonFile);\n\n // if we don't detect any explicit package configurations, then ignore\n if (!ngPackage) {\n if (!packageJson || !packageJson.ngPackage) {\n log.debug(`No secondary package found in ${baseDirectory}`);\n return null;\n }\n }\n\n ngPackage = merge(ngPackage, packageJson.ngPackage, arrayMergeLogic);\n if (!ngPackage.lib) {\n ngPackage.lib = {};\n }\n\n ngPackage.lib.externals = rootPackage.libExternals;\n\n return new NgPackageData(\n rootPackage.sourcePath,\n rootPackage.fullPackageName,\n rootPackage.destinationPath,\n baseDirectory,\n ngPackage\n );\n}\n\n/**\n * Search for, and read, root and secondary packages starting from a root path.\n *\n * @param {string} rootPath The path to your root folder which contains a package.json file\n * @returns {Promise<PackageSearchResult>}\n */\nexport async function discoverPackages(rootPath: string): Promise<PackageSearchResult> {\n\n // the root package gets read a bit differently than secondary packages because it must guarantee full paths\n const rootPackage: NgPackageData = await readRootPackage(rootPath);\n\n // With the metadata from the root package, we can proceed to read secondary packages in sub folders\n // This assumes that all secondary packages exist in sub paths of the root path.\n // Without such an assumption, automatic secondary package discovery would not be feasible.\n // Specifically, the function is looking for `ng-package.json` or `package.json` files.\n const secondaryPackagePaths: string[] = await findSecondaryPackagePaths(rootPackage);\n\n const secondaryPackagePromises: Promise<NgPackageData>[] = secondaryPackagePaths\n .map(secondaryPackagePath => readSecondaryPackage(rootPackage, secondaryPackagePath));\n\n const secondaryPackagesFromPaths: (NgPackageData | null)[] = await Promise.all(secondaryPackagePromises);\n\n // The packages that are null should be excluded because they were not explicitly meant to be secondary entries\n const secondaryPackages: NgPackageData[] = secondaryPackagesFromPaths.filter(x => !!x);\n\n return {\n rootPackage,\n secondaryPackages\n };\n}\n\n\n/**\n * Creates a `package.json` file by reading one from the `src` folder, adding additional\n * properties, and writing to `dest` folder\n *\n * @param ngPkg Angular package data\n * @param packageArtifacts Package artifacts to merge into package.json\n */\nexport async function writePackage(ngPkg: NgPackageData, packageArtifacts: NgArtifacts): Promise<void> {\n\n log.debug('writePackage');\n const packageJson: any = await readJson(path.resolve(ngPkg.sourcePath, PACKAGE_JSON_FILE_NAME));\n // set additional properties\n for(const fieldName in packageArtifacts) {\n packageJson[fieldName] = packageArtifacts[fieldName];\n }\n\n packageJson.name = ngPkg.fullPackageName;\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n\n await writeJson(path.resolve(ngPkg.destinationPath, PACKAGE_JSON_FILE_NAME), packageJson);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/steps/rollup.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mCAAoC;AACpC,0DAA0D;AAC1D,mDAAmD;AACnD,qCAAoC;AACpC,2DAAwD;AAUxD;;;;GAIG;AACH,gBAA6B,IAAmB;;QAE9C,MAAM,OAAO,qBAER,+BAAc,EAEd,IAAI,CAAC,SAAS,CAClB,CAAC;QAEF,IAAI,aAAa,GAAG;YAClB,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBAC3C,QAAQ,EAAE;aACX;YACD,MAAM,EAAE,CAAC,OAAO;gBACd,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC,CAAC;oBACzC,MAAM,CAAC;gBACT,CAAC;gBAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;SACF,CAAC;QAEF,MAAM,YAAY,GAAG;YACnB,4FAA4F;YAC5F,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,IAAI;SAChB,CAAC;QAEF,WAAK,CAAC,UAAU,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAQ,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;CAAA;AAzCD,wBAyCC","sourcesContent":["import * as __rollup from 'rollup';\nimport * as nodeResolve from 'rollup-plugin-node-resolve';\nimport * as commonJs from 'rollup-plugin-commonjs';\nimport { debug } from '../util/log';\nimport { ROLLUP_GLOBALS } from '../conf/rollup.globals';\n\nexport interface RollupOptions {\n moduleName: string,\n entry: string,\n format: string,\n dest: string,\n externals: Object,\n}\n\n/**\n * Runs rollup over the given entry file, bundling it up.\n *\n * @param opts\n */\nexport async function rollup(opts: RollupOptions): Promise<void> {\n\n const globals = {\n // default externals for '@angular/*' and 'rxjs'\n ...ROLLUP_GLOBALS,\n // external symbols passed from the user's ng-package.json\n ...opts.externals,\n };\n\n let bundleOptions = {\n context: 'this',\n external: Object.keys(globals),\n input: opts.entry,\n plugins: [\n nodeResolve({ jsnext: true, module: true }),\n commonJs(),\n ],\n onwarn: (warning) => {\n if (warning.code === 'THIS_IS_UNDEFINED') {\n return;\n }\n\n console.warn(warning.message);\n }\n };\n\n const writeOptions = {\n // Keep the moduleId empty because we don't want to force developers to a specific moduleId.\n moduleId: '',\n name: `${opts.moduleName}`,\n file: opts.dest,\n format: opts.format,\n banner: '',\n globals: globals,\n sourcemap: true\n };\n\n debug(`rollup ${opts.entry} to ${opts.dest} (${opts.format})`);\n\n const bundle: any = await __rollup.rollup(bundleOptions);\n await bundle.write(writeOptions);\n}\n"]}
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/steps/rollup.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mCAAoC;AACpC,0DAA0D;AAC1D,mDAAmD;AACnD,qCAAoC;AACpC,2DAAwD;AAUxD;;;;GAIG;AACH,gBAA6B,IAAmB;;QAE9C,MAAM,OAAO,qBAER,+BAAc,EAEd,IAAI,CAAC,SAAS,CAClB,CAAC;QAEF,IAAI,aAAa,GAAG;YAClB,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE;gBACP,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBAC3C,QAAQ,EAAE;aACX;YACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;gBAClB,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC,CAAC;oBACzC,MAAM,CAAC;gBACT,CAAC;gBAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;SACF,CAAC;QAEF,MAAM,YAAY,GAAG;YACnB,4FAA4F;YAC5F,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,IAAI;SAChB,CAAC;QAEF,WAAK,CAAC,UAAU,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAQ,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;CAAA;AAzCD,wBAyCC","sourcesContent":["import * as __rollup from 'rollup';\nimport * as nodeResolve from 'rollup-plugin-node-resolve';\nimport * as commonJs from 'rollup-plugin-commonjs';\nimport { debug } from '../util/log';\nimport { ROLLUP_GLOBALS } from '../conf/rollup.globals';\n\nexport interface RollupOptions {\n moduleName: string,\n entry: string,\n format: string,\n dest: string,\n externals: Object,\n}\n\n/**\n * Runs rollup over the given entry file, bundling it up.\n *\n * @param opts\n */\nexport async function rollup(opts: RollupOptions): Promise<void> {\n\n const globals = {\n // default externals for '@angular/*' and 'rxjs'\n ...ROLLUP_GLOBALS,\n // external symbols passed from the user's ng-package.json\n ...opts.externals,\n };\n\n let bundleOptions = {\n context: 'this',\n external: Object.keys(globals),\n input: opts.entry,\n plugins: [\n nodeResolve({ jsnext: true, module: true }),\n commonJs(),\n ],\n onwarn: (warning) => {\n if (warning.code === 'THIS_IS_UNDEFINED') {\n return;\n }\n\n console.warn(warning.message);\n }\n };\n\n const writeOptions = {\n // Keep the moduleId empty because we don't want to force developers to a specific moduleId.\n moduleId: '',\n name: `${opts.moduleName}`,\n file: opts.dest,\n format: opts.format,\n banner: '',\n globals: globals,\n sourcemap: true\n };\n\n debug(`rollup ${opts.entry} to ${opts.dest} (${opts.format})`);\n\n const bundle: any = await __rollup.rollup(bundleOptions);\n await bundle.write(writeOptions);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sorcery.js","sourceRoot":"","sources":["../../../src/lib/steps/sorcery.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mCAAmC;AAEnC,yCAAiD;AACjD,qCAAoC;AAEpC;;;;;GAKG;AACH,wBAAqC,UAAkB;;QACrD,WAAK,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAQ;YAChB,MAAM,EAAE,KAAK;YACb,cAAc,EAAE,IAAI;SACrB,CAAC;QAEF,gGAAgG;QAChG,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,UAAU,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAdD,wCAcC;AAED;;;;GAIG;AACH,+BAA4C,KAAoB;;QAC9D,MAAM,YAAY,GAAW,KAAK,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1D,MAAM,sBAAe,CAAC,GAAG,KAAK,CAAC,cAAc,cAAc,EAAE,CAAC,SAAc;YAC1E,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO;iBAClC,GAAG,CAAC,CAAC,IAAY,KAAa,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;YACtE,MAAM,CAAC,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAPD,sDAOC","sourcesContent":["import * as sorcery from 'sorcery';\nimport { NgPackageData } from './../model/ng-package-data';\nimport { modifyJsonFiles } from './../util/json';\nimport { debug } from '../util/log';\n\n/**\n * Re-maps the source `.map` file for the given `sourceFile`. This keeps source maps intact over\n * a series of transpilations!\n *\n * @param sourceFile Source file\n */\nexport async function remapSourceMap(sourceFile: string): Promise<void> {\n debug(`re-mapping sources for ${sourceFile}`);\n const opts: any = {\n inline: false,\n includeContent: true,\n };\n\n // Once sorcery loads the chain of sourcemaps, the new sourcemap will be written asynchronously.\n const chain = await sorcery.load(sourceFile);\n if (!chain) {\n throw new Error('Failed to load sourceMap chain for ' + sourceFile);\n }\n\n await chain.write(opts);\n}\n\n/**\n * Relocates the source `.map` file's relative root file paths to the module's name.\n *\n * @param ngPkg Angular package data\n */\nexport async function relocateSourceMapRoot(ngPkg: NgPackageData): Promise<void> {\n const replaceValue: string = `~/${ngPkg.fullPackageName}`;\n await modifyJsonFiles(`${ngPkg.buildDirectory}/**/*.js.map`, (sourceMap: any): any => {\n sourceMap.sources = sourceMap.sources\n .map((path: string): string => path.replace('../ts', replaceValue));\n return sourceMap;\n });\n}\n"]}
1
+ {"version":3,"file":"sorcery.js","sourceRoot":"","sources":["../../../src/lib/steps/sorcery.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mCAAmC;AAEnC,yCAAiD;AACjD,qCAAoC;AAEpC;;;;;GAKG;AACH,wBAAqC,UAAkB;;QACrD,WAAK,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAQ;YAChB,MAAM,EAAE,KAAK;YACb,cAAc,EAAE,IAAI;SACrB,CAAC;QAEF,gGAAgG;QAChG,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,UAAU,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAdD,wCAcC;AAED;;;;GAIG;AACH,+BAA4C,KAAoB;;QAC9D,MAAM,YAAY,GAAW,KAAK,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1D,MAAM,sBAAe,CAAC,GAAG,KAAK,CAAC,cAAc,cAAc,EAAE,CAAC,SAAc,EAAO,EAAE;YACnF,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO;iBAClC,GAAG,CAAC,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;YACtE,MAAM,CAAC,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAPD,sDAOC","sourcesContent":["import * as sorcery from 'sorcery';\nimport { NgPackageData } from './../model/ng-package-data';\nimport { modifyJsonFiles } from './../util/json';\nimport { debug } from '../util/log';\n\n/**\n * Re-maps the source `.map` file for the given `sourceFile`. This keeps source maps intact over\n * a series of transpilations!\n *\n * @param sourceFile Source file\n */\nexport async function remapSourceMap(sourceFile: string): Promise<void> {\n debug(`re-mapping sources for ${sourceFile}`);\n const opts: any = {\n inline: false,\n includeContent: true,\n };\n\n // Once sorcery loads the chain of sourcemaps, the new sourcemap will be written asynchronously.\n const chain = await sorcery.load(sourceFile);\n if (!chain) {\n throw new Error('Failed to load sourceMap chain for ' + sourceFile);\n }\n\n await chain.write(opts);\n}\n\n/**\n * Relocates the source `.map` file's relative root file paths to the module's name.\n *\n * @param ngPkg Angular package data\n */\nexport async function relocateSourceMapRoot(ngPkg: NgPackageData): Promise<void> {\n const replaceValue: string = `~/${ngPkg.fullPackageName}`;\n await modifyJsonFiles(`${ngPkg.buildDirectory}/**/*.js.map`, (sourceMap: any): any => {\n sourceMap.sources = sourceMap.sources\n .map((path: string): string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CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;CAAA;AAxBD,4CAwBC;AAAA,CAAC;AAGF,MAAM,MAAM,GAAG,oCAAoC,CAAC;AACpD,MAAM,aAAa,GAAG,CAAC,WAAmB;IAExC,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,MAAM,CAAC,WAAW,CAAC;IACrB,CAAC;AAEH,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport {\n ScriptTarget,\n ModuleKind,\n TranspileOutput,\n transpileModule,\n CompilerOptions\n} from 'typescript';\nimport { readFile, writeFile } from 'fs-extra';\nimport { debug } from '../util/log';\n\n/**\n * Downlevels a .js file from ES2015 to ES5. Internally, uses `tsc`.\n *\n * @param inputFile\n * @param outputFile\n */\nexport async function downlevelWithTsc(inputFile: string, outputFile: string): Promise<void> {\n debug(`tsc ${inputFile} to ${outputFile}`);\n const inputBuffer: Buffer = await readFile(inputFile);\n const input: string = inputBuffer.toString();\n const compilerOptions: CompilerOptions = {\n target: ScriptTarget.ES5,\n module: ModuleKind.ES2015,\n allowJs: true,\n sourceMap: true\n };\n const transpiled: TranspileOutput = transpileModule(trimSourceMap(input.toString()), {\n fileName: path.basename(outputFile),\n moduleName: path.basename(outputFile, '.js'),\n compilerOptions\n });\n\n const sourceMap = JSON.parse(transpiled.sourceMapText);\n sourceMap['file'] = path.basename(outputFile);\n sourceMap['sources'] = [path.basename(inputFile)];\n\n await Promise.all([\n writeFile(outputFile, transpiled.outputText),\n writeFile(`${outputFile}.map`, JSON.stringify(sourceMap))\n ]);\n};\n\n\nconst REGEXP = /\\/\\/# sourceMappingURL=.*\\.js\\.map/;\nconst trimSourceMap = (fileContent: string): string => {\n\n if (fileContent.match(REGEXP)) {\n return fileContent.replace(/\\/\\/# sourceMappingURL=.*\\.js\\.map/, '');\n } else {\n return fileContent;\n }\n\n};\n"]}
1
+ {"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../src/lib/steps/tsc.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,2CAMoB;AACpB,uCAA+C;AAC/C,qCAAoC;AAEpC;;;;;GAKG;AACH,0BAAuC,SAAiB,EAAE,UAAkB;;QAC1E,WAAK,CAAC,OAAO,SAAS,OAAO,UAAU,EAAE,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAW,MAAM,mBAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,KAAK,GAAW,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC7C,MAAM,eAAe,GAAoB;YACvC,MAAM,EAAE,yBAAY,CAAC,GAAG;YACxB,MAAM,EAAE,uBAAU,CAAC,MAAM;YACzB,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI;SAChB,CAAC;QACF,MAAM,UAAU,GAAoB,4BAAe,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE;YACnF,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YACnC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;YAC5C,eAAe;SAChB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QACvD,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9C,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,oBAAS,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC;YAC5C,oBAAS,CAAC,GAAG,UAAU,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;CAAA;AAxBD,4CAwBC;AAAA,CAAC;AAGF,MAAM,MAAM,GAAG,oCAAoC,CAAC;AACpD,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAU,EAAE;IAEpD,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,MAAM,CAAC,WAAW,CAAC;IACrB,CAAC;AAEH,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport {\n ScriptTarget,\n ModuleKind,\n TranspileOutput,\n transpileModule,\n CompilerOptions\n} from 'typescript';\nimport { readFile, writeFile } from 'fs-extra';\nimport { debug } from '../util/log';\n\n/**\n * Downlevels a .js file from ES2015 to ES5. Internally, uses `tsc`.\n *\n * @param inputFile\n * @param outputFile\n */\nexport async function downlevelWithTsc(inputFile: string, outputFile: string): Promise<void> {\n debug(`tsc ${inputFile} to ${outputFile}`);\n const inputBuffer: Buffer = await readFile(inputFile);\n const input: string = inputBuffer.toString();\n const compilerOptions: CompilerOptions = {\n target: ScriptTarget.ES5,\n module: ModuleKind.ES2015,\n allowJs: true,\n sourceMap: true\n };\n const transpiled: TranspileOutput = transpileModule(trimSourceMap(input.toString()), {\n fileName: path.basename(outputFile),\n moduleName: path.basename(outputFile, '.js'),\n compilerOptions\n });\n\n const sourceMap = JSON.parse(transpiled.sourceMapText);\n sourceMap['file'] = path.basename(outputFile);\n sourceMap['sources'] = [path.basename(inputFile)];\n\n await Promise.all([\n writeFile(outputFile, transpiled.outputText),\n writeFile(`${outputFile}.map`, JSON.stringify(sourceMap))\n ]);\n};\n\n\nconst REGEXP = /\\/\\/# sourceMappingURL=.*\\.js\\.map/;\nconst trimSourceMap = (fileContent: string): string => {\n\n if (fileContent.match(REGEXP)) {\n return fileContent.replace(/\\/\\/# sourceMappingURL=.*\\.js\\.map/, '');\n } else {\n return fileContent;\n }\n\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/lib/util/copy.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,+BAA8B;AAC9B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEd,QAAA,SAAS,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,OAAa;IAChE,WAAK,CAAC,iBAAiB,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,qBAAS,CAAO,CAAC,eAAe;QACrC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACZ,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QAChD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC","sourcesContent":["import { promisify } from './promisify';\nimport { debug } from './log';\nconst cpx = require('cpx');\n\nexport const copyFiles = (src: string, dest: string, options?: any): Promise<void> => {\n debug('copyFiles from ' + src + ' to ' + dest);\n return promisify<void>((resolveOrReject) => {\n if (options) {\n cpx.copy(src, dest, options, resolveOrReject);\n } else {\n cpx.copy(src, dest, resolveOrReject);\n }\n });\n\n};\n"]}
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/lib/util/copy.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,+BAA8B;AAC9B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEd,QAAA,SAAS,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,OAAa,EAAiB,EAAE;IACnF,WAAK,CAAC,iBAAiB,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,qBAAS,CAAO,CAAC,eAAe,EAAE,EAAE;QACzC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACZ,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QAChD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC","sourcesContent":["import { promisify } from './promisify';\nimport { debug } from './log';\nconst cpx = require('cpx');\n\nexport const copyFiles = (src: string, dest: string, options?: any): Promise<void> => {\n debug('copyFiles from ' + src + ' to ' + dest);\n return promisify<void>((resolveOrReject) => {\n if (options) {\n cpx.copy(src, dest, options, resolveOrReject);\n } else {\n cpx.copy(src, dest, resolveOrReject);\n }\n });\n\n};\n"]}
package/lib/util/json.js CHANGED
@@ -45,7 +45,7 @@ function tryReadJson(filePath) {
45
45
  }
46
46
  catch (e) {
47
47
  // this means the file was empty or not json, which is fine
48
- return yield Promise.resolve({});
48
+ return Promise.resolve({});
49
49
  }
50
50
  });
51
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/lib/util/json.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,uCAA+C;AAC/C,2CAAwC;AACxC,+BAA8B;AAE9B;;;;;;GAMG;AACH,yBAAsC,WAAmB,EAAE,QAA+B;;QAExF,WAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,MAAM,SAAS,GAAa,MAAM,qBAAS,CAAW,CAAC,eAAe;YACpE,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CACf,SAAS,CAAC,GAAG,CAAC,CAAO,QAAgB;YACnC,MAAM,WAAW,GAAQ,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;YACvC,MAAM,oBAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC,CAAA,CACF,CAAC,CAAC;IACL,CAAC;CAAA;AAdD,0CAcC;AAED;;;;GAIG;AACH,qBAAkC,QAAgB;;QAChD,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,mBAAQ,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACX,2DAA2D;YAC3D,MAAM,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CAAA;AAPD,kCAOC","sourcesContent":["import * as glob from 'glob';\nimport { readJson, writeJson } from 'fs-extra';\nimport { promisify } from './promisify';\nimport { debug } from './log';\n\n/**\n * Modifies a set of JSON files by invoking `modifyFn`\n *\n * @param globPattern A glob pattern matching several files. Example: '**\\/*.js.map'\n * @param modifyFn A callback function that takes a JSON-parsed input and should return an output\n * that will be JSON-stringified\n */\nexport async function modifyJsonFiles(globPattern: string, modifyFn: (jsonObj: any) => any): Promise<void> {\n\n debug('modifyJsonFiles');\n const fileNames: string[] = await promisify<string[]>((resolveOrReject) => {\n glob(globPattern, resolveOrReject);\n });\n\n await Promise.all(\n fileNames.map(async (fileName: string): Promise<void> => {\n const fileContent: any = await tryReadJson(fileName);\n const modified = modifyFn(fileContent);\n await writeJson(fileName, modified);\n }\n ));\n}\n\n/**\n * Read json and don't throw if json parsing fails.\n *\n * @param filePath Path to the file which is parsed.\n */\nexport async function tryReadJson(filePath: string): Promise<any> {\n try {\n return await readJson(filePath);\n } catch (e) {\n // this means the file was empty or not json, which is fine\n return await Promise.resolve({});\n }\n}\n"]}
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/lib/util/json.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,uCAA+C;AAC/C,2CAAwC;AACxC,+BAA8B;AAE9B;;;;;;GAMG;AACH,yBAAsC,WAAmB,EAAE,QAA+B;;QAExF,WAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,MAAM,SAAS,GAAa,MAAM,qBAAS,CAAW,CAAC,eAAe,EAAE,EAAE;YACxE,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CACf,SAAS,CAAC,GAAG,CAAC,CAAO,QAAgB,EAAiB,EAAE;YACtD,MAAM,WAAW,GAAQ,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;YACvC,MAAM,oBAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC,CAAA,CACF,CAAC,CAAC;IACL,CAAC;CAAA;AAdD,0CAcC;AAED;;;;GAIG;AACH,qBAAkC,QAAgB;;QAChD,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,mBAAQ,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACX,2DAA2D;YAC3D,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;CAAA;AAPD,kCAOC","sourcesContent":["import * as glob from 'glob';\nimport { readJson, writeJson } from 'fs-extra';\nimport { promisify } from './promisify';\nimport { debug } from './log';\n\n/**\n * Modifies a set of JSON files by invoking `modifyFn`\n *\n * @param globPattern A glob pattern matching several files. Example: '**\\/*.js.map'\n * @param modifyFn A callback function that takes a JSON-parsed input and should return an output\n * that will be JSON-stringified\n */\nexport async function modifyJsonFiles(globPattern: string, modifyFn: (jsonObj: any) => any): Promise<void> {\n\n debug('modifyJsonFiles');\n const fileNames: string[] = await promisify<string[]>((resolveOrReject) => {\n glob(globPattern, resolveOrReject);\n });\n\n await Promise.all(\n fileNames.map(async (fileName: string): Promise<void> => {\n const fileContent: any = await tryReadJson(fileName);\n const modified = modifyFn(fileContent);\n await writeJson(fileName, modified);\n }\n ));\n}\n\n/**\n * Read json and don't throw if json parsing fails.\n *\n * @param filePath Path to the file which is parsed.\n */\nexport async function tryReadJson(filePath: string): Promise<any> {\n try {\n return await readJson(filePath);\n } catch (e) {\n // this means the file was empty or not json, which is fine\n return Promise.resolve({});\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/util/log.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,KAAK,GAAG,CAAC,GAAmB;IAEvC,EAAE,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AAEH,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,CAAC,GAAW;IAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAA;AAEY,QAAA,OAAO,GAAG,CAAC,GAAW;IACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,CAAC,GAAW;IAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAA;AAEY,QAAA,KAAK,GAAG,CAAC,GAAW;IAE/B,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;AAEH,CAAC,CAAA","sourcesContent":["const chalk = require('chalk');\n\nexport const error = (err: string | Error) => {\n\n if (err instanceof Error) {\n console.log('\\n' + chalk.red('BUILD ERROR'));\n console.log(chalk.red(err.message));\n console.log(chalk.red(err.stack) + '\\n');\n } else {\n console.log(chalk.red(err));\n }\n\n}\n\nexport const warn = (msg: string) => {\n console.log(chalk.yellow(msg));\n}\n\nexport const success = (msg: string) => {\n console.log(chalk.green(msg));\n}\n\nexport const info = (msg: string) => {\n console.log(chalk.blue(msg));\n}\n\nexport const debug = (msg: string) => {\n\n if (process.env.DEBUG) {\n console.log(chalk.inverse.cyan(`[debug] ${msg}`));\n }\n\n}\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/util/log.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,KAAK,GAAG,CAAC,GAAmB,EAAE,EAAE;IAE3C,EAAE,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AAEH,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAA;AAEY,QAAA,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAA;AAEY,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;IAEnC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;AAEH,CAAC,CAAA","sourcesContent":["const chalk = require('chalk');\n\nexport const error = (err: string | Error) => {\n\n if (err instanceof Error) {\n console.log('\\n' + chalk.red('BUILD ERROR'));\n console.log(chalk.red(err.message));\n console.log(chalk.red(err.stack) + '\\n');\n } else {\n console.log(chalk.red(err));\n }\n\n}\n\nexport const warn = (msg: string) => {\n console.log(chalk.yellow(msg));\n}\n\nexport const success = (msg: string) => {\n console.log(chalk.green(msg));\n}\n\nexport const info = (msg: string) => {\n console.log(chalk.blue(msg));\n}\n\nexport const debug = (msg: string) => {\n\n if (process.env.DEBUG) {\n console.log(chalk.inverse.cyan(`[debug] ${msg}`));\n }\n\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/lib/util/path.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAEjC,4EAA4E;AAC/D,QAAA,IAAI,qBACZ,QAAQ,IACX,cAAc,EAAE,CAAC,IAAa;QAC5B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACV,MAAM,CAAC,IAAI,CAAC;QACd,CAAC;QAED,2FAA2F;QAC3F,iEAAiE;QACjE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC,IACD","sourcesContent":["import * as nodePath from 'path';\n\n// by exporting this way, we can add custom functions and still be type safe\nexport const path = {\n ...nodePath,\n ensureUnixPath: (path?: string): string | null => {\n if (!path) {\n return null;\n }\n\n // we use a regex instead of the character literal due to a bug in some versions of node.js\n // the path separator needs to be preceded by an escape character\n const regex = new RegExp('\\\\' + nodePath.win32.sep, 'g');\n return path.replace(regex, nodePath.posix.sep);\n }\n};\n"]}
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/lib/util/path.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAEjC,4EAA4E;AAC/D,QAAA,IAAI,qBACZ,QAAQ,IACX,cAAc,EAAE,CAAC,IAAa,EAAiB,EAAE;QAC/C,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACV,MAAM,CAAC,IAAI,CAAC;QACd,CAAC;QAED,2FAA2F;QAC3F,iEAAiE;QACjE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC,IACD","sourcesContent":["import * as nodePath from 'path';\n\n// by exporting this way, we can add custom functions and still be type safe\nexport const path = {\n ...nodePath,\n ensureUnixPath: (path?: string): string | null => {\n if (!path) {\n return null;\n }\n\n // we use a regex instead of the character literal due to a bug in some versions of node.js\n // the path separator needs to be preceded by an escape character\n const regex = new RegExp('\\\\' + nodePath.win32.sep, 'g');\n return path.replace(regex, nodePath.posix.sep);\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../../src/lib/util/promisify.ts"],"names":[],"mappings":";;AAGA,mBAA6B,QAAuD;IAClF,MAAM,CAAC,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,QAAQ,CAAC,CAAC,CAAC,GAAU,EAAE,KAAS;YAC9B,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,8BAUC","sourcesContent":["\nexport type PromiseCallback<T> = (err: Error, value?: T) => void;\n\nexport function promisify<T>(resolver: (resolveOrReject: PromiseCallback<T>) => void): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n resolver(((err: Error, value?: T): void => {\n if (err) {\n reject(err);\n } else {\n resolve(value);\n }\n }))\n });\n}\n"]}
1
+ {"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../../src/lib/util/promisify.ts"],"names":[],"mappings":";;AAGA,mBAA6B,QAAuD;IAClF,MAAM,CAAC,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,QAAQ,CAAC,CAAC,CAAC,GAAU,EAAE,KAAS,EAAQ,EAAE;YACxC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,8BAUC","sourcesContent":["\nexport type PromiseCallback<T> = (err: Error, value?: T) => void;\n\nexport function promisify<T>(resolver: (resolveOrReject: PromiseCallback<T>) => void): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n resolver(((err: Error, value?: T): void => {\n if (err) {\n reject(err);\n } else {\n resolve(value);\n }\n }))\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rimraf.js","sourceRoot":"","sources":["../../../src/lib/util/rimraf.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B,2CAAwC;AACxC,+BAA8B;AAEjB,QAAA,MAAM,GAAG,CAAC,CAAM,EAAE,IAAU;IACvC,WAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAErB,MAAM,CAAC,qBAAS,CAAO,CAAC,eAAe;QACrC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACT,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QAC/B,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC","sourcesContent":["const rm = require('rimraf');\nimport { promisify } from './promisify';\nimport { debug } from './log';\n\nexport const rimraf = (f: any, opts?: any) => {\n debug(`rimraf ${f}`);\n\n return promisify<void>((resolveOrReject) => {\n if (opts) {\n rm(f, opts, resolveOrReject);\n } else {\n rm(f, resolveOrReject);\n }\n });\n\n};\n"]}
1
+ {"version":3,"file":"rimraf.js","sourceRoot":"","sources":["../../../src/lib/util/rimraf.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B,2CAAwC;AACxC,+BAA8B;AAEjB,QAAA,MAAM,GAAG,CAAC,CAAM,EAAE,IAAU,EAAE,EAAE;IAC3C,WAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAErB,MAAM,CAAC,qBAAS,CAAO,CAAC,eAAe,EAAE,EAAE;QACzC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACT,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QAC/B,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC","sourcesContent":["const rm = require('rimraf');\nimport { promisify } from './promisify';\nimport { debug } from './log';\n\nexport const rimraf = (f: any, opts?: any) => {\n debug(`rimraf ${f}`);\n\n return promisify<void>((resolveOrReject) => {\n if (opts) {\n rm(f, opts, resolveOrReject);\n } else {\n rm(f, resolveOrReject);\n }\n });\n\n};\n"]}
@@ -38,6 +38,14 @@ export interface NgPackageConfig {
38
38
  externals?: {
39
39
  [k: string]: any;
40
40
  };
41
+ /**
42
+ * A property to indicate whether your library is going to be bundling jsx/tsx files. This passes through to tsconfig - see https://www.typescriptlang.org/docs/handbook/jsx.html
43
+ */
44
+ jsx?: ("preserve" | "react" | "react-native");
45
+ /**
46
+ * Set typescript language level, i.e. tsconfig.lib. This will enable accessing typescript features available in es2016, es2017, etc.
47
+ */
48
+ languageLevel?: string[];
41
49
  [k: string]: any;
42
50
  };
43
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ng-package.schema.js","sourceRoot":"","sources":["../src/ng-package.schema.ts"],"names":[],"mappings":";AAAA;;;;EAIE","sourcesContent":["/**\n* This file was automatically generated by json-schema-to-typescript.\n* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,\n* and run json-schema-to-typescript to regenerate this file.\n*/\n\n/**\n * JSON Schema for `ng-package.json` description file\n */\nexport interface NgPackageConfig {\n $schema?: string;\n /**\n * The source folder of an Angular library. This is the folder where a `package.json` is located and defaults to cwd.\n */\n src?: string;\n /**\n * The destination folder to output build artifacts and distributables of an Angular library (default: `dist`).\n */\n dest?: string;\n /**\n * Internal working directory of ng-packagr where intermediate build files are stored (default: `.ng_pkg_build`).\n */\n workingDirectory?: string;\n /**\n * Description of the library that is being built.\n */\n lib?: {\n /**\n * Entry file to the public API of the library (default: `src/public_api.ts`).\n */\n entryFile?: string;\n /**\n * Filename of the auto-generated flat module file (if empty, defaults to the package name as given in `package.json`).\n */\n flatModuleFile?: string;\n /**\n * A symbol map of external dependencies. The purpose of this map is to correctly bundle a flat module file (with `rollup`). By default, `rxjs` and `@angular/*` dependency symbols are supported.\n */\n externals?: {\n [k: string]: any;\n };\n [k: string]: any;\n };\n}\n"]}
1
+ {"version":3,"file":"ng-package.schema.js","sourceRoot":"","sources":["../src/ng-package.schema.ts"],"names":[],"mappings":";AAAA;;;;EAIE","sourcesContent":["/**\n* This file was automatically generated by json-schema-to-typescript.\n* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,\n* and run json-schema-to-typescript to regenerate this file.\n*/\n\n/**\n * JSON Schema for `ng-package.json` description file\n */\nexport interface NgPackageConfig {\n $schema?: string;\n /**\n * The source folder of an Angular library. This is the folder where a `package.json` is located and defaults to cwd.\n */\n src?: string;\n /**\n * The destination folder to output build artifacts and distributables of an Angular library (default: `dist`).\n */\n dest?: string;\n /**\n * Internal working directory of ng-packagr where intermediate build files are stored (default: `.ng_pkg_build`).\n */\n workingDirectory?: string;\n /**\n * Description of the library that is being built.\n */\n lib?: {\n /**\n * Entry file to the public API of the library (default: `src/public_api.ts`).\n */\n entryFile?: string;\n /**\n * Filename of the auto-generated flat module file (if empty, defaults to the package name as given in `package.json`).\n */\n flatModuleFile?: string;\n /**\n * A symbol map of external dependencies. The purpose of this map is to correctly bundle a flat module file (with `rollup`). By default, `rxjs` and `@angular/*` dependency symbols are supported.\n */\n externals?: {\n [k: string]: any;\n };\n /**\n * A property to indicate whether your library is going to be bundling jsx/tsx files. This passes through to tsconfig - see https://www.typescriptlang.org/docs/handbook/jsx.html\n */\n jsx?: (\"preserve\" | \"react\" | \"react-native\");\n /**\n * Set typescript language level, i.e. tsconfig.lib. This will enable accessing typescript features available in es2016, es2017, etc.\n */\n languageLevel?: string[];\n [k: string]: any;\n };\n}\n"]}
@@ -41,6 +41,23 @@
41
41
  "description": "A symbol map of external dependencies. The purpose of this map is to correctly bundle a flat module file (with `rollup`). By default, `rxjs` and `@angular/*` dependency symbols are supported.",
42
42
  "type": "object",
43
43
  "additionalProperties": true
44
+ },
45
+ "jsx": {
46
+ "description": "A property to indicate whether your library is going to be bundling jsx/tsx files. This passes through to tsconfig - see https://www.typescriptlang.org/docs/handbook/jsx.html",
47
+ "type": "string",
48
+ "enum": ["preserve", "react", "react-native"],
49
+ "default": ""
50
+ },
51
+ "languageLevel": {
52
+ "description": "Set typescript language level, i.e. tsconfig.lib. This will enable accessing typescript features available in es2016, es2017, etc.",
53
+ "type": "array",
54
+ "items": {
55
+ "type": "string"
56
+ },
57
+ "default": [
58
+ "dom",
59
+ "es2015"
60
+ ]
44
61
  }
45
62
  }
46
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "Compile and package a TypeScript library to Angular Package Format",
5
5
  "keywords": [
6
6
  "angular",
@@ -25,6 +25,7 @@
25
25
  "ng-packagr": "./cli/main.js"
26
26
  },
27
27
  "dependencies": {
28
+ "@angular/tsc-wrapped": "^4.4.5",
28
29
  "@ngtools/json-schema": "^1.1.0",
29
30
  "autoprefixer": "^7.1.1",
30
31
  "browserslist": "^2.1.5",
@@ -39,7 +40,7 @@
39
40
  "postcss": "^6.0.2",
40
41
  "read-file": "^0.2.0",
41
42
  "rimraf": "^2.6.1",
42
- "rollup": "^0.50.0",
43
+ "rollup": "^0.51.0",
43
44
  "rollup-plugin-commonjs": "^8.2.1",
44
45
  "rollup-plugin-node-resolve": "^3.0.0",
45
46
  "sorcery": "^0.10.0",
@@ -49,7 +50,6 @@
49
50
  "vinyl-fs": "^2.4.4"
50
51
  },
51
52
  "peerDependencies": {
52
- "@angular/tsc-wrapped": "~4.4.5",
53
- "typescript": "~2.3.4"
53
+ "typescript": "^2.3.4"
54
54
  }
55
55
  }