ng-packagr 2.4.1 → 2.4.5
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 +40 -0
- package/README.md +5 -0
- package/lib/brocc/depth.js +1 -1
- package/lib/brocc/depth.js.map +1 -1
- package/lib/flatten/uglify.js +1 -0
- package/lib/flatten/uglify.js.map +1 -1
- package/lib/ng-v5/entry-point/write-package.transform.js +1 -18
- package/lib/ng-v5/entry-point/write-package.transform.js.map +1 -1
- package/lib/ng-v5/package.transform.js +2 -0
- package/lib/ng-v5/package.transform.js.map +1 -1
- package/lib/util/tar.d.ts +4 -0
- package/lib/util/tar.js +20 -0
- package/lib/util/tar.js.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
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="2.4.5"></a>
|
|
6
|
+
## [2.4.5](https://github.com/dherges/ng-packagr/compare/v2.4.4...v2.4.5) (2018-05-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* create an array large enough to hold all buckets ([#877](https://github.com/dherges/ng-packagr/issues/877)) ([f4f616d](https://github.com/dherges/ng-packagr/commit/f4f616d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="2.4.4"></a>
|
|
16
|
+
## [2.4.4](https://github.com/dherges/ng-packagr/compare/v2.4.3...v2.4.4) (2018-05-08)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* create tarball archive for the npm package ([f083602](https://github.com/dherges/ng-packagr/commit/f083602))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="2.4.3"></a>
|
|
26
|
+
## [2.4.3](https://github.com/dherges/ng-packagr/compare/v2.4.2...v2.4.3) (2018-05-08)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* generate tarball only for primary entry point (one per npm package) ([#848](https://github.com/dherges/ng-packagr/issues/848)) ([e4b31c7](https://github.com/dherges/ng-packagr/commit/e4b31c7))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<a name="2.4.2"></a>
|
|
36
|
+
## [2.4.2](https://github.com/dherges/ng-packagr/compare/v2.4.1...v2.4.2) (2018-04-08)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* update uglify-js version ([#754](https://github.com/dherges/ng-packagr/issues/754)) ([ff176b7](https://github.com/dherges/ng-packagr/commit/ff176b7)), closes [#752](https://github.com/dherges/ng-packagr/issues/752)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
5
45
|
<a name="2.4.1"></a>
|
|
6
46
|
## [2.4.1](https://github.com/dherges/ng-packagr/compare/v2.4.0...v2.4.1) (2018-03-25)
|
|
7
47
|
|
package/README.md
CHANGED
|
@@ -347,3 +347,8 @@ Create and publish Angular libs like a Pro - Juri Strumpflohner at NG-BE ([Dec 2
|
|
|
347
347
|
Packaging Angular - Jason Aden at ng-conf 2017 ([28min talk](https://youtu.be/unICbsPGFIA))
|
|
348
348
|
|
|
349
349
|
[](https://youtu.be/unICbsPGFIA)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
Create and publish Angular libs like a Pro - Juri Strumpflohner at ngVikings, this time demoing building Angular libraries with ng-packagr, with NX as well as Bazel ([March 2018, 30min talk](https://youtu.be/Tw8TCgeqotg))
|
|
353
|
+
|
|
354
|
+
[](https://youtu.be/Tw8TCgeqotg)
|
package/lib/brocc/depth.js
CHANGED
|
@@ -80,7 +80,7 @@ class DepthBuilder {
|
|
|
80
80
|
}
|
|
81
81
|
// All nodes with the same max distance from a root can be run in parallel
|
|
82
82
|
// Now we need to bucket nodes by max depth
|
|
83
|
-
const buckets = new Array(maxDepth);
|
|
83
|
+
const buckets = new Array(maxDepth + 1);
|
|
84
84
|
for (let i = 0; i < buckets.length; i++) {
|
|
85
85
|
buckets[i] = [];
|
|
86
86
|
}
|
package/lib/brocc/depth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depth.js","sourceRoot":"","sources":["../../../src/lib/brocc/depth.ts"],"names":[],"mappings":";;AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAAA;QACE,2DAA2D;QACnD,kBAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IA4EpD,CAAC;IA1EQ,GAAG,CAAC,IAAW,EAAE,eAAgC,EAAE;QACxD,qBAAqB;QACrB,YAAY,GAAG,YAAY,YAAY,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAE7E,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjC,mCAAmC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACvE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC7C,CAAC;QAED,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAA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C,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC;oBACnC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,0EAA0E;QAC1E,2CAA2C;QAC3C,MAAM,OAAO,GAAc,IAAI,KAAK,CAAU,QAAQ,GAAG,CAAC,CAAC,CAAC;QAC5D,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QAClB,CAAC;QAED,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;CACF;AA9ED,oCA8EC","sourcesContent":["export type Token = string;\nexport type Depth = number;\n\n/**\n * Groups of tokens. The index is the depth value. The array value is a group of tokens.\n */\nexport type Groups = Token[][];\n\n/**\n * DepthBuilder calculates depth values for nodes and dependencies.\n *\n * Depth represents the furthest distance (number of edges) from a node w/o dependencies.\n * A depth of zero indicates that a node has no dependency.\n * Lower depth values indicate that a node need to be built prior to nodes with a higher depth.\n * Nodes with the same depth value may be built in parallel.\n *\n * #### Example\n *\n * A simple example:\n *\n * - foo depends on bar\n * - foo depends on foobar\n * - bar depends on foobar\n *\n * Here, foobar has depth 0, bar has depth 1, and foo has depth 2.\n *\n * @link https://github.com/dherges/ng-packagr/pull/419#issuecomment-354015908\n */\nexport class DepthBuilder {\n // this serves as a tracker for dependencies between tokens\n private dependencyMap = new Map<Token, Token[]>();\n\n public add(node: Token, dependencies: Token[] | Token = []) {\n // Normalize to array\n dependencies = dependencies instanceof Array ? dependencies : [dependencies];\n\n if (this.dependencyMap.has(node)) {\n // Add to existing and de-duplicate\n const existing = this.dependencyMap.get(node);\n const deps = existing.concat(dependencies).filter((value, index, self) => {\n return self.indexOf(value) === index;\n });\n this.dependencyMap.set(node, deps);\n } else {\n this.dependencyMap.set(node, dependencies);\n }\n\n if (dependencies) {\n for (const dependency of dependencies) {\n if (!this.dependencyMap.has(dependency)) {\n this.dependencyMap.set(dependency, []);\n }\n }\n }\n }\n\n public build(): Groups {\n const allNodes = Array.from(this.dependencyMap.entries()).map(([token, dependencies]) => ({ token, dependencies }));\n // Start with root nodes and expand from there\n const nodeQueue = allNodes.filter(node => node.dependencies.length === 0);\n\n // Serves as a tracker for what nodes have been processed, and their furthest distance from a root node\n const nodeDepths = new Map<Token, Depth>();\n for (const node of nodeQueue) {\n nodeDepths.set(node.token, 0);\n }\n\n // We will use this later to reduce the frequency of dynamic memory allocations\n let maxDepth = 0;\n\n // Walk the tree to determine longest path from root for each node\n while (nodeQueue.length > 0) {\n const currentNode = nodeQueue.pop();\n const currentDepth = nodeDepths.get(currentNode.token) + 1;\n if (currentDepth > maxDepth) {\n maxDepth = currentDepth;\n }\n\n const parentNodes = allNodes.filter(node => node.dependencies.find(dep => dep === currentNode.token));\n parentNodes.forEach(parent => {\n if (!nodeDepths.has(parent.token)) {\n // Push the dependency to the queue and track its depth\n nodeQueue.push(parent);\n nodeDepths.set(parent.token, currentDepth);\n }\n\n const dependencyDepth = nodeDepths.get(parent.token);\n if (currentDepth > dependencyDepth) {\n nodeDepths.set(parent.token, currentDepth);\n }\n });\n }\n\n // All nodes with the same max distance from a root can be run in parallel\n // Now we need to bucket nodes by max depth\n const buckets: Token[][] = new Array<Token[]>(maxDepth + 1);\n for (let i = 0; i < buckets.length; i++) {\n buckets[i] = [];\n }\n\n nodeDepths.forEach((depth, node) => {\n buckets[depth].push(node);\n });\n\n return buckets;\n }\n}\n"]}
|
package/lib/flatten/uglify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AAE,eAAQ,CAAC,YAAY,CAAC;aAC5B;YACD,KAAK,EAAE;gBACL,YAAY,EAAE,IAAI;aACnB;YACD,GAAG,EAAE,IAAI;YACT,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,QAAQ,EAAE,MAAM;aACjB;SACF,CAAC,CAAC;QAEH,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACpB,GAAG,CAAC,CAAC,MAAM,cAAc,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC7C,UAAI,CAAC,cAAc,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QAED,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACjB,MAAM,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAS,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAS,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,CAAC,UAAU,CAAC;IACpB,CAAC;CAAA;AAzCD,oCAyCC","sourcesContent":["import { minify } from 'uglify-js';\nimport { writeFile, readFile } from 'fs-extra';\nimport { extname, basename } from 'path';\nimport { debug, warn } from './../util/log';\n\nexport async function minifyJsFile(inputPath: string): Promise<string> {\n debug(`minifyJsFile: ${inputPath}`);\n\n const fileExtension: string = extname(inputPath);\n const pathWithNoExtension: string = inputPath.substring(0, inputPath.length - fileExtension.length);\n\n const outputPath: string = `${pathWithNoExtension}.min${fileExtension}`;\n const sourcemapOut: string = `${outputPath}.map`;\n const [inputFileBuffer, inputSourceMapBuffer]: Buffer[] = await Promise.all([\n readFile(inputPath),\n readFile(`${inputPath}.map`)\n ]);\n\n const result = minify(inputFileBuffer.toString(), {\n sourceMap: {\n includeSources: true,\n content: JSON.parse(inputSourceMapBuffer.toString()),\n url: basename(sourcemapOut)\n },\n parse: {\n bare_returns: true\n },\n ie8: true,\n warnings: true,\n output: {\n comments: 'some'\n }\n });\n\n if (result.warnings) {\n for (const warningMessage of result.warnings) {\n warn(warningMessage);\n }\n }\n\n if (result.error) {\n throw result.error;\n }\n\n await Promise.all([writeFile(outputPath, result.code), writeFile(sourcemapOut, result.map)]);\n return outputPath;\n}\n"]}
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
const fs = require("fs-extra");
|
|
12
12
|
const path = require("path");
|
|
13
|
-
const tar = require("tar");
|
|
14
13
|
const transform_1 = require("../../brocc/transform");
|
|
15
14
|
const path_1 = require("../../util/path");
|
|
16
15
|
const copy_1 = require("../../util/copy");
|
|
@@ -37,9 +36,6 @@ exports.writePackageTransform = transform_1.transformFromPromise((graph) => __aw
|
|
|
37
36
|
// XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?
|
|
38
37
|
metadata: path_1.ensureUnixPath(`${ngEntryPoint.flatModuleFile}.metadata.json`)
|
|
39
38
|
});
|
|
40
|
-
// 7. CREATE PACKAGE .TGZ
|
|
41
|
-
log.info('Creating package .tgz');
|
|
42
|
-
_tar(`${ngEntryPoint.destinationPath}.tgz`, ngEntryPoint.destinationPath);
|
|
43
39
|
log.success(`Built ${ngEntryPoint.moduleId}`);
|
|
44
40
|
return graph;
|
|
45
41
|
}));
|
|
@@ -121,19 +117,6 @@ function copyTypingsAndMetadata(from, to) {
|
|
|
121
117
|
});
|
|
122
118
|
}
|
|
123
119
|
exports.copyTypingsAndMetadata = copyTypingsAndMetadata;
|
|
124
|
-
/**
|
|
125
|
-
* Creates a tgz file with the directory contents.
|
|
126
|
-
*/
|
|
127
|
-
function _tar(file, dir) {
|
|
128
|
-
return tar.create({
|
|
129
|
-
gzip: true,
|
|
130
|
-
strict: true,
|
|
131
|
-
portable: true,
|
|
132
|
-
cwd: dir,
|
|
133
|
-
file: file,
|
|
134
|
-
sync: true
|
|
135
|
-
}, ['.']);
|
|
136
|
-
}
|
|
137
120
|
function checkNonPeerDependencies(packageJson, property, whitelist) {
|
|
138
121
|
if (packageJson[property]) {
|
|
139
122
|
Object.keys(packageJson[property]).forEach(dep => {
|
|
@@ -141,7 +124,7 @@ function checkNonPeerDependencies(packageJson, property, whitelist) {
|
|
|
141
124
|
log.debug(`Dependency ${dep} is whitelisted in '${property}'`);
|
|
142
125
|
}
|
|
143
126
|
else {
|
|
144
|
-
log.warn(`Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to '
|
|
127
|
+
log.warn(`Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to 'peerDependencies' or remove it from '${property}'.`);
|
|
145
128
|
throw new Error(`Dependency ${dep} must be explicitly whitelisted.`);
|
|
146
129
|
}
|
|
147
130
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,2BAA2B;AAC3B,qDAAwE;AAGxE,0CAAiD;AACjD,0CAA4C;AAC5C,8CAA2C;AAC3C,sCAAsC;AACtC,oCAAkD;AAErC,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAC,CAAC;IACxD,MAAM,YAAY,GAAiB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9D,MAAM,SAAS,GAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,IAAI,CAAC;IAE7F,sCAAsC;IACtC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACjC,gBAAS,CAAC,GAAG,IAAI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D,wDAEC;AAED;;GAEG;AACH,cAAc,IAAY,EAAE,GAAW;IACrC,MAAM,CAAC,GAAG,CAAC,MAAM,CACf;QACE,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;KACX,EACD,CAAC,GAAG,CAAC,CACN,CAAC;AACJ,CAAC;AAED,kCAAkC,WAAmC,EAAE,QAAgB,EAAE,SAAmB;IAC1G,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC/C,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,uBAAuB,QAAQ,GAAG,CAAC,CAAC;YACjE,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,GAAG,CAAC,IAAI,CACN,mCAAmC,QAAQ,gDAAgD,GAAG,4CAA4C,QAAQ,IAAI,CACvJ,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,cAAc,GAAG,kCAAkC,CAAC,CAAC;YACvE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import * as fs from 'fs-extra';\nimport * as path from 'path';\nimport * as tar from 'tar';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { NgPackage } from '../../ng-package-format/package';\nimport { ensureUnixPath } from '../../util/path';\nimport { copyFiles } from '../../util/copy';\nimport { rimraf } from '../../util/rimraf';\nimport * as log from '../../util/log';\nimport { isEntryPointInProgress } from '../nodes';\n\nexport const writePackageTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress());\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackage: NgPackage = graph.find(node => node.type === 'application/ng-package').data;\n\n // 5. COPY SOURCE FILES TO DESTINATION\n log.info('Copying staged files');\n copyFiles(`${path.dirname(ngEntryPoint.entryFilePath)}/**/*.d.ts`, entryPoint.data.outDir);\n await copyJavaScriptBundles(entryPoint.data.stageDir, ngPackage.dest);\n await copyTypingsAndMetadata(entryPoint.data.outDir, ngEntryPoint.destinationPath);\n\n // 6. WRITE PACKAGE.JSON\n log.info('Writing package metadata');\n const relativeDestPath: string = path.relative(ngEntryPoint.destinationPath, ngPackage.primary.destinationPath);\n await writePackageJson(ngEntryPoint, ngPackage, {\n main: ensureUnixPath(path.join(relativeDestPath, 'bundles', ngEntryPoint.flatModuleFile + '.umd.js')),\n module: ensureUnixPath(path.join(relativeDestPath, 'esm5', ngEntryPoint.flatModuleFile + '.js')),\n es2015: ensureUnixPath(path.join(relativeDestPath, 'esm2015', ngEntryPoint.flatModuleFile + '.js')),\n typings: ensureUnixPath(`${ngEntryPoint.flatModuleFile}.d.ts`),\n // XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?\n metadata: ensureUnixPath(`${ngEntryPoint.flatModuleFile}.metadata.json`)\n });\n\n // 7. CREATE PACKAGE .TGZ\n log.info('Creating package .tgz');\n _tar(`${ngEntryPoint.destinationPath}.tgz`, ngEntryPoint.destinationPath);\n\n log.success(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n});\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the enty point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The proprties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param binaries Binary artefacts (bundle files) to merge into `package.json`\n */\nexport async function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n binaries: { [key: string]: string }\n): Promise<void> {\n log.debug('Writing package.json');\n const packageJson: any = entryPoint.packageJson;\n // set additional properties\n for (const fieldName in binaries) {\n packageJson[fieldName] = binaries[fieldName];\n }\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n if (!(packageJson.dependencies && packageJson.dependencies.tslib)) {\n const { dependencies: angularDependencies = {} } = require('@angular/compiler/package.json');\n const tsLibVersion = angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion\n };\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicated installs or version conflicts\n // in the node_modules folder of an application\n const whitelist = pkg.whitelistedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', whitelist);\n } catch (e) {\n await rimraf(entryPoint.destinationPath);\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (pkg.keepLifecycleScripts !== true) {\n log.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n log.warn(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`\n );\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n packageJson.name = entryPoint.moduleId;\n\n // `outputJson()` creates intermediate directories, if they do not exist\n // -- https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputJson.md\n await fs.outputJson(path.resolve(entryPoint.destinationPath, 'package.json'), packageJson, { spaces: 2 });\n}\n\n/**\n * Copies the JavaScript bundles from the staging directory to the npm package.\n */\nexport async function copyJavaScriptBundles(stageDir: string, destDir: string): Promise<void> {\n await copyFiles(`${stageDir}/bundles/**/*.{js,js.map}`, path.resolve(destDir, 'bundles'));\n await copyFiles(`${stageDir}/esm5/**/*.{js,js.map}`, path.resolve(destDir, 'esm5'));\n await copyFiles(`${stageDir}/esm2015/**/*.{js,js.map}`, path.resolve(destDir, 'esm2015'));\n}\n\nexport async function copyTypingsAndMetadata(from: string, to: string): Promise<void> {\n await copyFiles(`${from}/**/*.{d.ts,metadata.json}`, to);\n}\n\n/**\n * Creates a tgz file with the directory contents.\n */\nfunction _tar(file: string, dir: string) {\n return tar.create(\n {\n gzip: true,\n strict: true,\n portable: true,\n cwd: dir,\n file: file,\n sync: true\n },\n ['.']\n );\n}\n\nfunction checkNonPeerDependencies(packageJson: { [key: string]: any }, property: string, whitelist: RegExp[]) {\n if (packageJson[property]) {\n Object.keys(packageJson[property]).forEach(dep => {\n if (whitelist.find(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is whitelisted in '${property}'`);\n } else {\n log.warn(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to 'peerDepenencies' or remove it from '${property}'.`\n );\n throw new Error(`Dependency ${dep} must be explicitly whitelisted.`);\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,qDAAwE;AAGxE,0CAAiD;AACjD,0CAA4C;AAC5C,8CAA2C;AAC3C,sCAAsC;AACtC,oCAAkD;AAErC,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAC,CAAC;IACxD,MAAM,YAAY,GAAiB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9D,MAAM,SAAS,GAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAw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C,EAAE,QAAgB,EAAE,SAAmB;IAC1G,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC/C,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,uBAAuB,QAAQ,GAAG,CAAC,CAAC;YACjE,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,GAAG,CAAC,IAAI,CACN,mCAAmC,QAAQ,gDAAgD,GAAG,6CAA6C,QAAQ,IAAI,CACxJ,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,cAAc,GAAG,kCAAkC,CAAC,CAAC;YACvE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import * as fs from 'fs-extra';\nimport * as path from 'path';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { NgPackage } from '../../ng-package-format/package';\nimport { ensureUnixPath } from '../../util/path';\nimport { copyFiles } from '../../util/copy';\nimport { rimraf } from '../../util/rimraf';\nimport * as log from '../../util/log';\nimport { isEntryPointInProgress } from '../nodes';\n\nexport const writePackageTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress());\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackage: NgPackage = graph.find(node => node.type === 'application/ng-package').data;\n\n // 5. COPY SOURCE FILES TO DESTINATION\n log.info('Copying staged files');\n copyFiles(`${path.dirname(ngEntryPoint.entryFilePath)}/**/*.d.ts`, entryPoint.data.outDir);\n await copyJavaScriptBundles(entryPoint.data.stageDir, ngPackage.dest);\n await copyTypingsAndMetadata(entryPoint.data.outDir, ngEntryPoint.destinationPath);\n\n // 6. WRITE PACKAGE.JSON\n log.info('Writing package metadata');\n const relativeDestPath: string = path.relative(ngEntryPoint.destinationPath, ngPackage.primary.destinationPath);\n await writePackageJson(ngEntryPoint, ngPackage, {\n main: ensureUnixPath(path.join(relativeDestPath, 'bundles', ngEntryPoint.flatModuleFile + '.umd.js')),\n module: ensureUnixPath(path.join(relativeDestPath, 'esm5', ngEntryPoint.flatModuleFile + '.js')),\n es2015: ensureUnixPath(path.join(relativeDestPath, 'esm2015', ngEntryPoint.flatModuleFile + '.js')),\n typings: ensureUnixPath(`${ngEntryPoint.flatModuleFile}.d.ts`),\n // XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?\n metadata: ensureUnixPath(`${ngEntryPoint.flatModuleFile}.metadata.json`)\n });\n\n log.success(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n});\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the enty point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The proprties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param binaries Binary artefacts (bundle files) to merge into `package.json`\n */\nexport async function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n binaries: { [key: string]: string }\n): Promise<void> {\n log.debug('Writing package.json');\n const packageJson: any = entryPoint.packageJson;\n // set additional properties\n for (const fieldName in binaries) {\n packageJson[fieldName] = binaries[fieldName];\n }\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n if (!(packageJson.dependencies && packageJson.dependencies.tslib)) {\n const { dependencies: angularDependencies = {} } = require('@angular/compiler/package.json');\n const tsLibVersion = angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion\n };\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicated installs or version conflicts\n // in the node_modules folder of an application\n const whitelist = pkg.whitelistedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', whitelist);\n } catch (e) {\n await rimraf(entryPoint.destinationPath);\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (pkg.keepLifecycleScripts !== true) {\n log.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n log.warn(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`\n );\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n packageJson.name = entryPoint.moduleId;\n\n // `outputJson()` creates intermediate directories, if they do not exist\n // -- https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputJson.md\n await fs.outputJson(path.resolve(entryPoint.destinationPath, 'package.json'), packageJson, { spaces: 2 });\n}\n\n/**\n * Copies the JavaScript bundles from the staging directory to the npm package.\n */\nexport async function copyJavaScriptBundles(stageDir: string, destDir: string): Promise<void> {\n await copyFiles(`${stageDir}/bundles/**/*.{js,js.map}`, path.resolve(destDir, 'bundles'));\n await copyFiles(`${stageDir}/esm5/**/*.{js,js.map}`, path.resolve(destDir, 'esm5'));\n await copyFiles(`${stageDir}/esm2015/**/*.{js,js.map}`, path.resolve(destDir, 'esm2015'));\n}\n\nexport async function copyTypingsAndMetadata(from: string, to: string): Promise<void> {\n await copyFiles(`${from}/**/*.{d.ts,metadata.json}`, to);\n}\n\nfunction checkNonPeerDependencies(packageJson: { [key: string]: any }, property: string, whitelist: RegExp[]) {\n if (packageJson[property]) {\n Object.keys(packageJson[property]).forEach(dep => {\n if (whitelist.find(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is whitelisted in '${property}'`);\n } else {\n log.warn(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to 'peerDependencies' or remove it from '${property}'.`\n );\n throw new Error(`Dependency ${dep} must be explicitly whitelisted.`);\n }\n });\n }\n}\n"]}
|
|
@@ -11,6 +11,7 @@ const node_1 = require("../brocc/node");
|
|
|
11
11
|
const log = require("../util/log");
|
|
12
12
|
const copy_1 = require("../util/copy");
|
|
13
13
|
const rimraf_1 = require("../util/rimraf");
|
|
14
|
+
const tar_1 = require("../util/tar");
|
|
14
15
|
const nodes_1 = require("./nodes");
|
|
15
16
|
const discover_packages_1 = require("./discover-packages");
|
|
16
17
|
/**
|
|
@@ -82,6 +83,7 @@ const writeNpmPackage = (pkgUri) => pipe_1.pipe(operators_1.switchMap(graph => {
|
|
|
82
83
|
return fromPromise_1.fromPromise(Promise.all([
|
|
83
84
|
copy_1.copyFiles(`${ngPkg.data.src}/README.md`, ngPkg.data.dest),
|
|
84
85
|
copy_1.copyFiles(`${ngPkg.data.src}/LICENSE`, ngPkg.data.dest),
|
|
86
|
+
tar_1.createTarball(`${ngPkg.data.dest}.tgz`, ngPkg.data.dest),
|
|
85
87
|
rimraf_1.rimraf(ngPkg.data.workingDirectory)
|
|
86
88
|
])).pipe(operators_1.map(() => graph));
|
|
87
89
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.transform.js","sourceRoot":"","sources":["../../../src/lib/ng-v5/package.transform.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAE7B,mDAAgE;AAChE,6DAA0D;AAC1D,2CAAwD;AACxD,8CAAiF;AACjF,yCAAsC;AAEtC,0CAAsD;AACtD,wCAAuD;AAEvD,mCAAmC;AACnC,uCAAyC;AACzC,2CAAwC;AACxC,mCAAyF;AACzF,2DAAuD;AAEvD;;;;;;;;;;;;;;GAcG;AACU,QAAA,uBAAuB,GAAG,CACrC,OAAe,EACf,qBAAgC,EAChC,uBAAkC,EAClC,mBAA8B,EAC9B,EAAE,CAAC,CAAC,OA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nF,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,oDAAoD;IACpD,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,CACpC,OAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CACtB,eAAG,CAAC,GAAG,EAAE;QACP,uCAAuC;QACvC,MAAM,KAAK,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC;QAE1E,wCAAwC;QACxC,UAAU,CAAC,KAAK,GAAG,uBAAgB,CAAC;IACtC,CAAC,CAAC,EACF,WAAW,EACX,eAAG,CAAC,GAAG,EAAE;QACP,YAAY,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CACH,CACF,CAAC;IAEF,wCAAwC;IACxC,MAAM,CAAC,eAAY,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CACH,CAAC","sourcesContent":["import * as path from 'path';\nimport { Observable } from 'rxjs/Observable';\nimport { concat as concatStatic } from 'rxjs/observable/concat';\nimport { fromPromise } from 'rxjs/observable/fromPromise';\nimport { of as observableOf } from 'rxjs/observable/of';\nimport { concatMap, map, retry, switchMap, takeLast, tap } from 'rxjs/operators';\nimport { pipe } from 'rxjs/util/pipe';\nimport { BuildGraph } from '../brocc/build-graph';\nimport { DepthBuilder, Groups } from '../brocc/depth';\nimport { Node, STATE_IN_PROGESS } from '../brocc/node';\nimport { Transform } from '../brocc/transform';\nimport * as log from '../util/log';\nimport { copyFiles } from '../util/copy';\nimport { rimraf } from '../util/rimraf';\nimport { PackageNode, EntryPointNode, ngUrl, isEntryPoint, byEntryPoint } from './nodes';\nimport { discoverPackages } from './discover-packages';\n\n/**\n * A transformation for building an npm package:\n *\n * - discoverPackages\n * - initTsConfig\n * - analyzeTsSources (thereby extracting template and stylesheet files)\n * - for each entry point\n * - run the entryPontTransform\n * - writeNpmPackage\n *\n * @param project Project token, reference to `ng-package.json`\n * @param initTsConfigTransform Transformation initializing the tsconfig of each entry point.\n * @param analyseSourcesTransform Transformation analyzing the typescript source files of each entry point.\n * @param entryPointTransform Transformation for asset rendering and compilation of a single entry point.\n */\nexport const packageTransformFactory = (\n project: string,\n initTsConfigTransform: Transform,\n analyseSourcesTransform: Transform,\n entryPointTransform: Transform\n) => (source$: Observable<BuildGraph>): Observable<BuildGraph> => {\n const pkgUri = ngUrl(project);\n\n return source$.pipe(\n tap(() => {\n log.info(`Building Angular Package`);\n }),\n // Discover packages and entry points\n switchMap(graph => {\n const pkg = discoverPackages({ project });\n\n return fromPromise(pkg).pipe(\n map(value => {\n const ngPkg = new PackageNode(pkgUri);\n ngPkg.data = value;\n\n return graph.put(ngPkg);\n })\n );\n }),\n // Clean the primary dest folder (should clean all secondary sub-directory, as well)\n switchMap(graph => {\n const { dest, deleteDestPath } = graph.get(pkgUri).data;\n return fromPromise(deleteDestPath ? rimraf(dest) : Promise.resolve());\n }, (graph, _) => graph),\n // Add entry points to graph\n map(graph => {\n const ngPkg = graph.get(pkgUri);\n\n const entryPoints = [ngPkg.data.primary, ...ngPkg.data.secondaries].map(entryPoint => {\n // TODO: use `os-tmpdir` instead -> https://www.npmjs.com/package/os-tmpdir\n // import * as tmpdir from 'os-tempdir'; tmpdir();\n const stageDir = path.resolve(ngPkg.data.workingDirectory, entryPoint.flatModuleFile, 'stage');\n const outDir = path.resolve(ngPkg.data.workingDirectory, entryPoint.flatModuleFile, 'out');\n\n const node = new EntryPointNode(ngUrl(entryPoint.moduleId));\n node.data = { entryPoint, outDir, stageDir };\n node.state = 'dirty';\n ngPkg.dependsOn(node);\n\n return node;\n });\n\n return graph.put(entryPoints);\n }),\n // Initialize the tsconfig for each entry point\n initTsConfigTransform,\n // Analyse dependencies and external resources for each entry point\n analyseSourcesTransform,\n // Next, run through the entry point transformation (assets rendering, code compilation)\n scheduleEntryPoints(entryPointTransform),\n // Write npm package to dest folder\n writeNpmPackage(pkgUri),\n tap(graph => {\n const ngPkg = graph.get(pkgUri);\n log.success(`Built Angular Package!\n- from: ${ngPkg.data.src}\n- to: ${ngPkg.data.dest}`);\n })\n );\n};\n\nconst writeNpmPackage = (pkgUri: string): Transform =>\n pipe(\n switchMap(graph => {\n const ngPkg = graph.get(pkgUri);\n\n return fromPromise(\n Promise.all([\n copyFiles(`${ngPkg.data.src}/README.md`, ngPkg.data.dest),\n copyFiles(`${ngPkg.data.src}/LICENSE`, ngPkg.data.dest),\n rimraf(ngPkg.data.workingDirectory)\n ])\n ).pipe(map(() => graph));\n })\n );\n\nconst scheduleEntryPoints = (epTransform: Transform): Transform =>\n pipe(\n concatMap(graph => {\n // Calculate node/dependency depth and determine build order\n const depthBuilder = new DepthBuilder();\n const entryPoints = graph.filter(isEntryPoint);\n entryPoints.forEach(entryPoint => {\n const deps = entryPoint.filter(isEntryPoint).map(ep => ep.url);\n depthBuilder.add(entryPoint.url, deps);\n });\n\n // The array index is the depth.\n const groups = depthBuilder.build();\n const flattenedGroups = groups.reduce((prev, current) => prev.concat(current), []);\n let currentIndex = 0;\n\n // Build entry points with lower depth values first.\n const eps$ = flattenedGroups.map(() =>\n observableOf(graph).pipe(\n tap(() => {\n // Find current entry point in progress\n const epUrl = flattenedGroups[currentIndex];\n const entryPoint = graph.find(byEntryPoint().and(ep => ep.url === epUrl));\n\n // Mark the entry point as 'in-progress'\n entryPoint.state = STATE_IN_PROGESS;\n }),\n epTransform,\n tap(() => {\n currentIndex += 1;\n })\n )\n );\n\n // Build all entry points, then continue\n return concatStatic(...eps$).pipe(takeLast(1));\n })\n );\n"]}
|
|
1
|
+
{"version":3,"file":"package.transform.js","sourceRoot":"","sources":["../../../src/lib/ng-v5/package.transform.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAE7B,mDAAgE;AA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AAM,CAAC,oBAAY,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAC/D,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,gCAAgC;IAChC,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;IACpC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACnF,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,oDAAoD;IACpD,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,CACpC,OAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CACtB,eAAG,CAAC,GAAG,EAAE;QACP,uCAAuC;QACvC,MAAM,KAAK,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC;QAE1E,wCAAwC;QACxC,UAAU,CAAC,KAAK,GAAG,uBAAgB,CAAC;IACtC,CAAC,CAAC,EACF,WAAW,EACX,eAAG,CAAC,GAAG,EAAE;QACP,YAAY,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CACH,CACF,CAAC;IAEF,wCAAwC;IACxC,MAAM,CAAC,eAAY,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CACH,CAAC","sourcesContent":["import * as path from 'path';\nimport { Observable } from 'rxjs/Observable';\nimport { concat as concatStatic } from 'rxjs/observable/concat';\nimport { fromPromise } from 'rxjs/observable/fromPromise';\nimport { of as observableOf } from 'rxjs/observable/of';\nimport { concatMap, map, retry, switchMap, takeLast, tap } from 'rxjs/operators';\nimport { pipe } from 'rxjs/util/pipe';\nimport { BuildGraph } from '../brocc/build-graph';\nimport { DepthBuilder, Groups } from '../brocc/depth';\nimport { Node, STATE_IN_PROGESS } from '../brocc/node';\nimport { Transform } from '../brocc/transform';\nimport * as log from '../util/log';\nimport { copyFiles } from '../util/copy';\nimport { rimraf } from '../util/rimraf';\nimport { createTarball } from '../util/tar';\nimport { PackageNode, EntryPointNode, ngUrl, isEntryPoint, byEntryPoint } from './nodes';\nimport { discoverPackages } from './discover-packages';\n\n/**\n * A transformation for building an npm package:\n *\n * - discoverPackages\n * - initTsConfig\n * - analyzeTsSources (thereby extracting template and stylesheet files)\n * - for each entry point\n * - run the entryPontTransform\n * - writeNpmPackage\n *\n * @param project Project token, reference to `ng-package.json`\n * @param initTsConfigTransform Transformation initializing the tsconfig of each entry point.\n * @param analyseSourcesTransform Transformation analyzing the typescript source files of each entry point.\n * @param entryPointTransform Transformation for asset rendering and compilation of a single entry point.\n */\nexport const packageTransformFactory = (\n project: string,\n initTsConfigTransform: Transform,\n analyseSourcesTransform: Transform,\n entryPointTransform: Transform\n) => (source$: Observable<BuildGraph>): Observable<BuildGraph> => {\n const pkgUri = ngUrl(project);\n\n return source$.pipe(\n tap(() => {\n log.info(`Building Angular Package`);\n }),\n // Discover packages and entry points\n switchMap(graph => {\n const pkg = discoverPackages({ project });\n\n return fromPromise(pkg).pipe(\n map(value => {\n const ngPkg = new PackageNode(pkgUri);\n ngPkg.data = value;\n\n return graph.put(ngPkg);\n })\n );\n }),\n // Clean the primary dest folder (should clean all secondary sub-directory, as well)\n switchMap(graph => {\n const { dest, deleteDestPath } = graph.get(pkgUri).data;\n return fromPromise(deleteDestPath ? rimraf(dest) : Promise.resolve());\n }, (graph, _) => graph),\n // Add entry points to graph\n map(graph => {\n const ngPkg = graph.get(pkgUri);\n\n const entryPoints = [ngPkg.data.primary, ...ngPkg.data.secondaries].map(entryPoint => {\n // TODO: use `os-tmpdir` instead -> https://www.npmjs.com/package/os-tmpdir\n // import * as tmpdir from 'os-tempdir'; tmpdir();\n const stageDir = path.resolve(ngPkg.data.workingDirectory, entryPoint.flatModuleFile, 'stage');\n const outDir = path.resolve(ngPkg.data.workingDirectory, entryPoint.flatModuleFile, 'out');\n\n const node = new EntryPointNode(ngUrl(entryPoint.moduleId));\n node.data = { entryPoint, outDir, stageDir };\n node.state = 'dirty';\n ngPkg.dependsOn(node);\n\n return node;\n });\n\n return graph.put(entryPoints);\n }),\n // Initialize the tsconfig for each entry point\n initTsConfigTransform,\n // Analyse dependencies and external resources for each entry point\n analyseSourcesTransform,\n // Next, run through the entry point transformation (assets rendering, code compilation)\n scheduleEntryPoints(entryPointTransform),\n // Write npm package to dest folder\n writeNpmPackage(pkgUri),\n tap(graph => {\n const ngPkg = graph.get(pkgUri);\n log.success(`Built Angular Package!\n- from: ${ngPkg.data.src}\n- to: ${ngPkg.data.dest}`);\n })\n );\n};\n\nconst writeNpmPackage = (pkgUri: string): Transform =>\n pipe(\n switchMap(graph => {\n const ngPkg = graph.get(pkgUri);\n\n return fromPromise(\n Promise.all([\n copyFiles(`${ngPkg.data.src}/README.md`, ngPkg.data.dest),\n copyFiles(`${ngPkg.data.src}/LICENSE`, ngPkg.data.dest),\n createTarball(`${ngPkg.data.dest}.tgz`, ngPkg.data.dest),\n rimraf(ngPkg.data.workingDirectory)\n ])\n ).pipe(map(() => graph));\n })\n );\n\nconst scheduleEntryPoints = (epTransform: Transform): Transform =>\n pipe(\n concatMap(graph => {\n // Calculate node/dependency depth and determine build order\n const depthBuilder = new DepthBuilder();\n const entryPoints = graph.filter(isEntryPoint);\n entryPoints.forEach(entryPoint => {\n const deps = entryPoint.filter(isEntryPoint).map(ep => ep.url);\n depthBuilder.add(entryPoint.url, deps);\n });\n\n // The array index is the depth.\n const groups = depthBuilder.build();\n const flattenedGroups = groups.reduce((prev, current) => prev.concat(current), []);\n let currentIndex = 0;\n\n // Build entry points with lower depth values first.\n const eps$ = flattenedGroups.map(() =>\n observableOf(graph).pipe(\n tap(() => {\n // Find current entry point in progress\n const epUrl = flattenedGroups[currentIndex];\n const entryPoint = graph.find(byEntryPoint().and(ep => ep.url === epUrl));\n\n // Mark the entry point as 'in-progress'\n entryPoint.state = STATE_IN_PROGESS;\n }),\n epTransform,\n tap(() => {\n currentIndex += 1;\n })\n )\n );\n\n // Build all entry points, then continue\n return concatStatic(...eps$).pipe(takeLast(1));\n })\n );\n"]}
|
package/lib/util/tar.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tar = require("tar");
|
|
4
|
+
const log = require("./log");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a tgz file with the directory contents.
|
|
7
|
+
*/
|
|
8
|
+
function createTarball(file, dir) {
|
|
9
|
+
log.info('Creating tarball archive (.tgz)');
|
|
10
|
+
return tar.create({
|
|
11
|
+
gzip: true,
|
|
12
|
+
strict: true,
|
|
13
|
+
portable: true,
|
|
14
|
+
cwd: dir,
|
|
15
|
+
file: file,
|
|
16
|
+
sync: true
|
|
17
|
+
}, ['.']);
|
|
18
|
+
}
|
|
19
|
+
exports.createTarball = createTarball;
|
|
20
|
+
//# sourceMappingURL=tar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar.js","sourceRoot":"","sources":["../../../src/lib/util/tar.ts"],"names":[],"mappings":";;AAAA,2BAA2B;AAC3B,6BAA6B;AAE7B;;GAEG;AACH,uBAA8B,IAAY,EAAE,GAAW;IACrD,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAE5C,MAAM,CAAC,GAAG,CAAC,MAAM,CACf;QACE,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;KACX,EACD,CAAC,GAAG,CAAC,CACN,CAAC;AACJ,CAAC;AAdD,sCAcC","sourcesContent":["import * as tar from 'tar';\nimport * as log from './log';\n\n/**\n * Creates a tgz file with the directory contents.\n */\nexport function createTarball(file: string, dir: string) {\n log.info('Creating tarball archive (.tgz)');\n\n return tar.create(\n {\n gzip: true,\n strict: true,\n portable: true,\n cwd: dir,\n file: file,\n sync: true\n },\n ['.']\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-packagr",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.5",
|
|
4
4
|
"description": "Compile and package a TypeScript library to Angular Package Format",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"strip-bom": "^3.0.0",
|
|
55
55
|
"stylus": "^0.54.5",
|
|
56
56
|
"tar": "^4.4.1",
|
|
57
|
-
"uglify-js": "^3.
|
|
57
|
+
"uglify-js": "^3.3.20",
|
|
58
58
|
"update-notifier": "^2.3.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|