mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
build: update dependency tar to v7
This commit is contained in:
parent
4d466bfa6a
commit
ea2075ab1a
@ -111,7 +111,6 @@
|
||||
"@types/resolve": "^1.17.1",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@types/shelljs": "^0.8.11",
|
||||
"@types/tar": "^6.1.2",
|
||||
"@types/watchpack": "^2.4.4",
|
||||
"@types/yargs": "^17.0.20",
|
||||
"@types/yargs-parser": "^21.0.0",
|
||||
@ -197,7 +196,7 @@
|
||||
"source-map-loader": "5.0.0",
|
||||
"source-map-support": "0.5.21",
|
||||
"symbol-observable": "4.0.0",
|
||||
"tar": "^6.1.6",
|
||||
"tar": "^7.0.0",
|
||||
"terser": "5.36.0",
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-node": "^10.9.1",
|
||||
|
@ -10,7 +10,6 @@ ts_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@npm//@types/semver",
|
||||
"@npm//@types/tar",
|
||||
"@npm//ansi-colors",
|
||||
"@npm//fast-glob",
|
||||
"@npm//npm",
|
||||
|
@ -6,9 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import { normalize } from 'path';
|
||||
import { Parse } from 'tar';
|
||||
import { createReadStream } from 'node:fs';
|
||||
import { normalize } from 'node:path';
|
||||
import { Parser } from 'tar';
|
||||
|
||||
/**
|
||||
* Extract and return the contents of a single file out of a tar file.
|
||||
@ -17,20 +17,21 @@ import { Parse } from 'tar';
|
||||
* @param filePath the path of the file to extract
|
||||
* @returns the Buffer of file or an error on fs/tar error or file not found
|
||||
*/
|
||||
export async function extractFile(tarball: string, filePath: string): Promise<Buffer> {
|
||||
export function extractFile(tarball: string, filePath: string): Promise<Buffer> {
|
||||
const normalizedFilePath = normalize(filePath);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.createReadStream(tarball)
|
||||
createReadStream(tarball)
|
||||
.pipe(
|
||||
new Parse({
|
||||
new Parser({
|
||||
strict: true,
|
||||
filter: (p) => normalize(p) === normalize(filePath),
|
||||
// TODO: @types/tar 'entry' does not have ReadEntry.on
|
||||
onentry: (entry: any) => {
|
||||
filter: (p) => normalize(p) === normalizedFilePath,
|
||||
onReadEntry: (entry) => {
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
entry.on('data', (chunk: any) => chunks!.push(chunk));
|
||||
entry.on('data', (chunk) => chunks.push(chunk));
|
||||
entry.on('error', reject);
|
||||
entry.on('finish', () => resolve(Buffer.concat(chunks!)));
|
||||
entry.on('finish', () => resolve(Buffer.concat(chunks)));
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
@ -370,16 +370,7 @@ async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
|
||||
);
|
||||
|
||||
const pkgJsons = await Promise.all(
|
||||
pkgs
|
||||
.map((pkg) => realpathSync(pkg))
|
||||
.map(async (pkg) => {
|
||||
try {
|
||||
return await extractFile(pkg, './package/package.json');
|
||||
} catch (e) {
|
||||
// TODO(bazel): currently the bazel npm packaging does not contain the standard npm ./package directory
|
||||
return await extractFile(pkg, './package.json');
|
||||
}
|
||||
}),
|
||||
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, './package.json')),
|
||||
);
|
||||
|
||||
return pkgs.reduce(
|
||||
|
24
yarn.lock
24
yarn.lock
@ -686,7 +686,6 @@ __metadata:
|
||||
"@types/resolve": "npm:^1.17.1"
|
||||
"@types/semver": "npm:^7.3.12"
|
||||
"@types/shelljs": "npm:^0.8.11"
|
||||
"@types/tar": "npm:^6.1.2"
|
||||
"@types/watchpack": "npm:^2.4.4"
|
||||
"@types/yargs": "npm:^17.0.20"
|
||||
"@types/yargs-parser": "npm:^21.0.0"
|
||||
@ -772,7 +771,7 @@ __metadata:
|
||||
source-map-loader: "npm:5.0.0"
|
||||
source-map-support: "npm:0.5.21"
|
||||
symbol-observable: "npm:4.0.0"
|
||||
tar: "npm:^6.1.6"
|
||||
tar: "npm:^7.0.0"
|
||||
terser: "npm:5.36.0"
|
||||
tree-kill: "npm:1.2.2"
|
||||
ts-node: "npm:^10.9.1"
|
||||
@ -5835,16 +5834,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/tar@npm:^6.1.2":
|
||||
version: 6.1.13
|
||||
resolution: "@types/tar@npm:6.1.13"
|
||||
dependencies:
|
||||
"@types/node": "npm:*"
|
||||
minipass: "npm:^4.0.0"
|
||||
checksum: 10c0/98cc72d444fa622049e86e457a64d859c6effd7c7518d36e7b40b4ab1e7aa9e2412cc868cbef396650485dae07d50d98f662e8a53bb45f4a70eb6c61f80a63c7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/tmp@npm:^0.2.1":
|
||||
version: 0.2.6
|
||||
resolution: "@types/tmp@npm:0.2.6"
|
||||
@ -13945,13 +13934,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"minipass@npm:^4.0.0":
|
||||
version: 4.2.8
|
||||
resolution: "minipass@npm:4.2.8"
|
||||
checksum: 10c0/4ea76b030d97079f4429d6e8a8affd90baf1b6a1898977c8ccce4701c5a2ba2792e033abc6709373f25c2c4d4d95440d9d5e9464b46b7b76ca44d2ce26d939ce
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"minipass@npm:^5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "minipass@npm:5.0.0"
|
||||
@ -17898,7 +17880,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tar@npm:^6.1.11, tar@npm:^6.1.6, tar@npm:^6.2.1":
|
||||
"tar@npm:^6.1.11, tar@npm:^6.2.1":
|
||||
version: 6.2.1
|
||||
resolution: "tar@npm:6.2.1"
|
||||
dependencies:
|
||||
@ -17912,7 +17894,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tar@npm:^7.4.3":
|
||||
"tar@npm:^7.0.0, tar@npm:^7.4.3":
|
||||
version: 7.4.3
|
||||
resolution: "tar@npm:7.4.3"
|
||||
dependencies:
|
||||
|
Loading…
x
Reference in New Issue
Block a user