ng-packagr 20.1.0-next.0 → 20.1.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/package.json +2 -2
- package/src/lib/utils/cache.js +3 -5
- package/src/lib/utils/cache.js.map +1 -1
- package/src/lib/utils/fs.d.ts +3 -8
- package/src/lib/utils/fs.js +14 -47
- package/src/lib/utils/fs.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-packagr",
|
|
3
|
-
"version": "20.1.0
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "Compile and package Angular libraries in Angular Package Format (APF)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apf",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"rollup": "^4.24.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@angular/compiler-cli": "^20.0.0 || ^20.
|
|
61
|
+
"@angular/compiler-cli": "^20.0.0 || ^20.1.0-next.0 || ^20.2.0-next.0",
|
|
62
62
|
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
|
63
63
|
"tslib": "^2.3.0",
|
|
64
64
|
"typescript": ">=5.8 <5.9"
|
package/src/lib/utils/cache.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.saveCacheEntry = saveCacheEntry;
|
|
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
|
7
7
|
const promises_1 = require("node:fs/promises");
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
|
+
const log_1 = require("./log");
|
|
9
10
|
let ngPackagrVersion;
|
|
10
11
|
try {
|
|
11
12
|
ngPackagrVersion = require('../../package.json').version;
|
|
@@ -43,11 +44,8 @@ async function readCacheEntry(cachePath, key) {
|
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
catch (err) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
throw err;
|
|
47
|
+
(0, log_1.debug)(`[readCacheError]: ${err}`);
|
|
48
|
+
return undefined;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
async function saveCacheEntry(cachePath, key, content) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../src/lib/utils/cache.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../src/lib/utils/cache.ts"],"names":[],"mappings":";;AAeA,kCAEC;AAYD,wCAqBC;AAED,wCASC;AA7DD,6CAAyC;AACzC,+CAA8D;AAC9D,yCAAiC;AACjC,+BAA8B;AAE9B,IAAI,gBAAoC,CAAC;AACzC,IAAI,CAAC;IACH,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAAC,MAAM,CAAC;IACP,WAAW;IACX,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAEjD,KAAK,UAAU,WAAW,CAAC,GAAG,gBAA0B;IAC7D,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxG,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,SAAiB;IACnD,IAAI,CAAC;QACH,MAAM,IAAA,gBAAK,EAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;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CAAC,CAAC,CAAC;IAEjH,OAAO,IAAA,oBAAS,EAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { debug } from './log';\n\nlet ngPackagrVersion: string | undefined;\ntry {\n ngPackagrVersion = require('../../package.json').version;\n} catch {\n // dev path\n ngPackagrVersion = require('../../../package.json').version;\n}\n\nconst BIGINT_STRING_VALUE_REGEXP = /^%BigInt\\((\\d+)\\)$/;\n\nexport async function generateKey(...valuesToConsider: string[]): Promise<string> {\n return createHash('sha256').update(ngPackagrVersion).update(valuesToConsider.join(':')).digest('hex');\n}\n\nasync function ensureCacheDirExists(cachePath: string): Promise<void> {\n try {\n await mkdir(cachePath, { recursive: true });\n } catch (err) {\n if (err.code !== 'EEXIST') {\n throw err;\n }\n }\n}\n\nexport async function readCacheEntry(cachePath: string, key: string): Promise<any> {\n const filePath = join(cachePath, key);\n\n try {\n const data = await readFile(filePath, 'utf8');\n\n return JSON.parse(data, (_key, value) => {\n if (typeof value === 'string' && value[0] === '%') {\n const numPart = value.match(BIGINT_STRING_VALUE_REGEXP);\n if (numPart && isFinite(numPart[1] as any)) {\n return BigInt(numPart[1]);\n }\n }\n\n return value;\n });\n } catch (err) {\n debug(`[readCacheError]: ${err}`);\n\n return undefined;\n }\n}\n\nexport async function saveCacheEntry(cachePath: string, key: string, content: any): Promise<void> {\n const filePath = join(cachePath, key);\n\n // Ensure the cache directory exists\n await ensureCacheDirExists(cachePath);\n\n const data = JSON.stringify(content, (_key, value) => (typeof value === 'bigint' ? `%BigInt(${value})` : value));\n\n return writeFile(filePath, data, 'utf8');\n}\n"]}
|
package/src/lib/utils/fs.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
export declare
|
|
4
|
-
export declare const access: typeof fs.promises.access;
|
|
5
|
-
export declare const mkdir: typeof fs.promises.mkdir;
|
|
6
|
-
export declare const stat: typeof fs.promises.stat;
|
|
7
|
-
export declare const rmdir: typeof fs.promises.rm;
|
|
8
|
-
export declare function exists(path: fs.PathLike): Promise<boolean>;
|
|
1
|
+
import { PathLike } from 'node:fs';
|
|
2
|
+
export { readFile, writeFile, access, mkdir, stat, rm as rmdir } from 'node:fs/promises';
|
|
3
|
+
export declare function exists(path: PathLike): Promise<boolean>;
|
|
9
4
|
export declare function copyFile(src: string, dest: string): Promise<void>;
|
package/src/lib/utils/fs.js
CHANGED
|
@@ -1,65 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.rmdir = exports.stat = exports.mkdir = exports.access = exports.writeFile = exports.readFile = void 0;
|
|
37
4
|
exports.exists = exists;
|
|
38
5
|
exports.copyFile = copyFile;
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
exports
|
|
44
|
-
exports
|
|
45
|
-
exports
|
|
46
|
-
exports
|
|
47
|
-
exports
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
var promises_2 = require("node:fs/promises");
|
|
10
|
+
Object.defineProperty(exports, "readFile", { enumerable: true, get: function () { return promises_2.readFile; } });
|
|
11
|
+
Object.defineProperty(exports, "writeFile", { enumerable: true, get: function () { return promises_2.writeFile; } });
|
|
12
|
+
Object.defineProperty(exports, "access", { enumerable: true, get: function () { return promises_2.access; } });
|
|
13
|
+
Object.defineProperty(exports, "mkdir", { enumerable: true, get: function () { return promises_2.mkdir; } });
|
|
14
|
+
Object.defineProperty(exports, "stat", { enumerable: true, get: function () { return promises_2.stat; } });
|
|
15
|
+
Object.defineProperty(exports, "rmdir", { enumerable: true, get: function () { return promises_2.rm; } });
|
|
48
16
|
async function exists(path) {
|
|
49
17
|
try {
|
|
50
|
-
await (0,
|
|
18
|
+
await (0, promises_1.access)(path, node_fs_1.constants.F_OK);
|
|
51
19
|
return true;
|
|
52
20
|
}
|
|
53
21
|
catch {
|
|
54
22
|
return false;
|
|
55
23
|
}
|
|
56
24
|
}
|
|
57
|
-
const cpFile = (0, util_1.promisify)(fs.copyFile);
|
|
58
25
|
async function copyFile(src, dest) {
|
|
59
|
-
const dir = (0,
|
|
26
|
+
const dir = (0, node_path_1.dirname)(dest);
|
|
60
27
|
if (!(await exists(dir))) {
|
|
61
|
-
await (0,
|
|
28
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
62
29
|
}
|
|
63
|
-
await
|
|
30
|
+
await (0, promises_1.copyFile)(src, dest, node_fs_1.constants.COPYFILE_FICLONE);
|
|
64
31
|
}
|
|
65
32
|
//# sourceMappingURL=fs.js.map
|
package/src/lib/utils/fs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../../src/lib/utils/fs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../../src/lib/utils/fs.ts"],"names":[],"mappings":";;;AAMA,wBAQC;AAED,4BAOC;AAvBD,qCAA8C;AAC9C,+CAAqE;AACrE,yCAAoC;AAEpC,6CAAyF;AAAhF,oGAAA,QAAQ,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,gGAAA,IAAI,OAAA;AAAE,iGAAA,EAAE,OAAS;AAEvD,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,IAAI,CAAC;QACH,MAAM,IAAA,iBAAM,EAAC,IAAI,EAAE,mBAAS,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,IAAY;IACtD,MAAM,GAAG,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACzB,MAAM,IAAA,gBAAK,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,IAAA,mBAAM,EAAC,GAAG,EAAE,IAAI,EAAE,mBAAS,CAAC,gBAAgB,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { PathLike, constants } from 'node:fs';\nimport { access, copyFile as cpFile, mkdir } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nexport { readFile, writeFile, access, mkdir, stat, rm as rmdir } from 'node:fs/promises';\n\nexport async function exists(path: PathLike): Promise<boolean> {\n try {\n await access(path, constants.F_OK);\n\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function copyFile(src: string, dest: string): Promise<void> {\n const dir = dirname(dest);\n if (!(await exists(dir))) {\n await mkdir(dir, { recursive: true });\n }\n\n await cpFile(src, dest, constants.COPYFILE_FICLONE);\n}\n"]}
|