sst 2.8.4 → 2.8.6
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/cli/commands/connect.js +2 -2
- package/cli/commands/plugins/kysely.js +20 -37
- package/cli/commands/plugins/pothos.js +1 -0
- package/constructs/Api.d.ts +7 -0
- package/constructs/Api.js +2 -0
- package/constructs/NextjsSite.js +1 -1
- package/package.json +3 -3
- package/pothos.d.ts +2 -3
- package/pothos.js +3 -0
- package/runtime/handlers/dotnet.js +3 -2
- package/runtime/handlers.d.ts +1 -0
- package/runtime/workers.js +1 -0
- package/sst.mjs +29 -41
- package/support/base-site-archiver.mjs +1 -1
- package/support/rds-migrator/index.mjs +15 -15
- package/scrap.d.ts +0 -1
- package/scrap.js +0 -58
package/cli/commands/connect.js
CHANGED
|
@@ -15,7 +15,7 @@ export const connect = (program) => program.command("connect", "", (yargs) => ya
|
|
|
15
15
|
{
|
|
16
16
|
Effect: "Allow",
|
|
17
17
|
Principal: {
|
|
18
|
-
AWS: "arn:aws:iam::917397401067:
|
|
18
|
+
AWS: "arn:aws:iam::917397401067:role/*",
|
|
19
19
|
},
|
|
20
20
|
Action: "sts:AssumeRole",
|
|
21
21
|
},
|
|
@@ -33,5 +33,5 @@ export const connect = (program) => program.command("connect", "", (yargs) => ya
|
|
|
33
33
|
}));
|
|
34
34
|
const project = useProject();
|
|
35
35
|
const identity = await useSTSIdentity();
|
|
36
|
-
console.log(`http://localhost:3000/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}`);
|
|
36
|
+
console.log(`http://localhost:3000/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}®ion=${project.config.region}`);
|
|
37
37
|
});
|
|
@@ -2,7 +2,7 @@ import { Kysely } from "kysely";
|
|
|
2
2
|
import { DataApiDialect } from "kysely-data-api";
|
|
3
3
|
import { RDSData } from "@aws-sdk/client-rds-data";
|
|
4
4
|
import * as fs from "fs/promises";
|
|
5
|
-
import {
|
|
5
|
+
import { PostgresDialect, MysqlDialect, Serializer, Transformer, } from "kysely-codegen";
|
|
6
6
|
import { Context } from "../../../context/context.js";
|
|
7
7
|
import { useBus } from "../../../bus.js";
|
|
8
8
|
import { Logger } from "../../../logger.js";
|
|
@@ -15,48 +15,31 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
|
|
|
15
15
|
if (!db.types)
|
|
16
16
|
return;
|
|
17
17
|
logger("generating types for", db.migratorID);
|
|
18
|
+
const dataApi = new DataApiDialect({
|
|
19
|
+
mode: db.engine.includes("postgres") ? "postgres" : "mysql",
|
|
20
|
+
driver: {
|
|
21
|
+
secretArn: db.secretArn,
|
|
22
|
+
resourceArn: db.clusterArn,
|
|
23
|
+
database: db.defaultDatabaseName,
|
|
24
|
+
client: useAWSClient(RDSData),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
18
27
|
const k = new Kysely({
|
|
19
|
-
dialect:
|
|
20
|
-
mode: db.engine.includes("postgres") ? "postgres" : "mysql",
|
|
21
|
-
driver: {
|
|
22
|
-
secretArn: db.secretArn,
|
|
23
|
-
resourceArn: db.clusterArn,
|
|
24
|
-
database: db.defaultDatabaseName,
|
|
25
|
-
client: useAWSClient(RDSData),
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
+
dialect: dataApi,
|
|
28
29
|
});
|
|
29
|
-
const
|
|
30
|
-
logger("introspected tables");
|
|
31
|
-
const metadata = db.engine.includes("postgres")
|
|
32
|
-
? tables.map((table) => ({
|
|
33
|
-
...table,
|
|
34
|
-
columns: table.columns.map((column) => {
|
|
35
|
-
const isArray = column.dataType.startsWith("_");
|
|
36
|
-
return {
|
|
37
|
-
...column,
|
|
38
|
-
dataType: isArray ? column.dataType.slice(1) : column.dataType,
|
|
39
|
-
enumValues: null,
|
|
40
|
-
isArray,
|
|
41
|
-
};
|
|
42
|
-
}),
|
|
43
|
-
}))
|
|
44
|
-
: tables.map((table) => ({
|
|
45
|
-
...table,
|
|
46
|
-
columns: table.columns.map((column) => ({
|
|
47
|
-
...column,
|
|
48
|
-
enumValues: null,
|
|
49
|
-
})),
|
|
50
|
-
}));
|
|
51
|
-
logger("generated metadata", metadata.length);
|
|
52
|
-
const transformer = new Transformer();
|
|
53
|
-
const Dialect = db.engine.includes("postgres")
|
|
30
|
+
const dialect = db.engine.includes("postgres")
|
|
54
31
|
? new PostgresDialect()
|
|
55
32
|
: new MysqlDialect();
|
|
33
|
+
const instrospection = await dialect.introspector.introspect({
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
db: k,
|
|
36
|
+
});
|
|
37
|
+
logger("introspected tables");
|
|
38
|
+
const transformer = new Transformer();
|
|
56
39
|
const nodes = transformer.transform({
|
|
57
|
-
dialect:
|
|
40
|
+
dialect: dialect,
|
|
58
41
|
camelCase: db.types.camelCase === true,
|
|
59
|
-
metadata:
|
|
42
|
+
metadata: instrospection,
|
|
60
43
|
});
|
|
61
44
|
logger("transformed nodes", nodes.length);
|
|
62
45
|
const lastIndex = nodes.length - 1;
|
|
@@ -14,6 +14,7 @@ export const usePothosBuilder = Context.memo(() => {
|
|
|
14
14
|
try {
|
|
15
15
|
const schema = await Pothos.generate({
|
|
16
16
|
schema: route.schema,
|
|
17
|
+
internalPackages: route.internalPackages,
|
|
17
18
|
});
|
|
18
19
|
await fs.writeFile(route.output, schema);
|
|
19
20
|
// bus.publish("pothos.extracted", { file: route.output });
|
package/constructs/Api.d.ts
CHANGED
|
@@ -586,6 +586,10 @@ export interface ApiGraphQLRouteProps<AuthorizerKeys> extends ApiBaseRouteProps<
|
|
|
586
586
|
* Commands to run after generating schema. Useful for code generation steps
|
|
587
587
|
*/
|
|
588
588
|
commands?: string[];
|
|
589
|
+
/**
|
|
590
|
+
* List of packages that should be considered internal during schema generation
|
|
591
|
+
*/
|
|
592
|
+
internalPackages?: string[];
|
|
589
593
|
};
|
|
590
594
|
}
|
|
591
595
|
/**
|
|
@@ -753,6 +757,7 @@ export declare class Api<Authorizers extends Record<string, ApiAuthorizer> = Rec
|
|
|
753
757
|
stack: string;
|
|
754
758
|
} | undefined;
|
|
755
759
|
schema?: undefined;
|
|
760
|
+
internalPackages?: undefined;
|
|
756
761
|
output?: undefined;
|
|
757
762
|
commands?: undefined;
|
|
758
763
|
} | {
|
|
@@ -763,6 +768,7 @@ export declare class Api<Authorizers extends Record<string, ApiAuthorizer> = Rec
|
|
|
763
768
|
stack: string;
|
|
764
769
|
} | undefined;
|
|
765
770
|
schema: string | undefined;
|
|
771
|
+
internalPackages: string[] | undefined;
|
|
766
772
|
output: string | undefined;
|
|
767
773
|
commands: string[] | undefined;
|
|
768
774
|
} | {
|
|
@@ -770,6 +776,7 @@ export declare class Api<Authorizers extends Record<string, ApiAuthorizer> = Rec
|
|
|
770
776
|
route: string;
|
|
771
777
|
fn?: undefined;
|
|
772
778
|
schema?: undefined;
|
|
779
|
+
internalPackages?: undefined;
|
|
773
780
|
output?: undefined;
|
|
774
781
|
commands?: undefined;
|
|
775
782
|
})[];
|
package/constructs/Api.js
CHANGED
|
@@ -231,6 +231,7 @@ export class Api extends Construct {
|
|
|
231
231
|
route: key,
|
|
232
232
|
fn: getFunctionRef(data.function),
|
|
233
233
|
schema: data.schema,
|
|
234
|
+
internalPackages: data.internalPackages,
|
|
234
235
|
output: data.output,
|
|
235
236
|
commands: data.commands,
|
|
236
237
|
};
|
|
@@ -591,6 +592,7 @@ export class Api extends Construct {
|
|
|
591
592
|
output: routeProps.pothos?.output,
|
|
592
593
|
schema: routeProps.pothos?.schema,
|
|
593
594
|
commands: routeProps.pothos?.commands,
|
|
595
|
+
internalPackages: routeProps.pothos?.internalPackages,
|
|
594
596
|
};
|
|
595
597
|
}
|
|
596
598
|
return result;
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -26,7 +26,7 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
|
26
26
|
export class NextjsSite extends SsrSite {
|
|
27
27
|
constructor(scope, id, props) {
|
|
28
28
|
super(scope, id, {
|
|
29
|
-
buildCommand: "npx --yes open-next@~1.
|
|
29
|
+
buildCommand: "npx --yes open-next@~1.2.0 build",
|
|
30
30
|
...props,
|
|
31
31
|
});
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.6",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"immer": "9",
|
|
73
73
|
"ink": "^4.0.0",
|
|
74
74
|
"ink-spinner": "^5.0.0",
|
|
75
|
-
"kysely": "^0.23.
|
|
76
|
-
"kysely-codegen": "^0.
|
|
75
|
+
"kysely": "^0.23.5",
|
|
76
|
+
"kysely-codegen": "^0.10.0",
|
|
77
77
|
"kysely-data-api": "^0.2.0",
|
|
78
78
|
"minimatch": "^6.1.6",
|
|
79
79
|
"openid-client": "^5.1.8",
|
package/pothos.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * as Pothos from "./pothos.js";
|
|
2
2
|
interface GenerateOpts {
|
|
3
3
|
schema: string;
|
|
4
|
+
internalPackages?: string[];
|
|
4
5
|
}
|
|
5
6
|
export declare function generate(opts: GenerateOpts): Promise<string>;
|
|
6
|
-
export declare function extractSchema(opts:
|
|
7
|
-
schema: string;
|
|
8
|
-
}): Promise<any>;
|
|
7
|
+
export declare function extractSchema(opts: GenerateOpts): Promise<any>;
|
package/pothos.js
CHANGED
|
@@ -32,6 +32,9 @@ export async function extractSchema(opts) {
|
|
|
32
32
|
setup(build) {
|
|
33
33
|
const filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/; // Must not start with "/" or "./" or "../"
|
|
34
34
|
build.onResolve({ filter }, (args) => {
|
|
35
|
+
const packageName = args.path.match(/^(@[^\/]+\/[^\/]+|[^@/]+)/);
|
|
36
|
+
if (packageName && opts.internalPackages?.includes(packageName[0]))
|
|
37
|
+
return;
|
|
35
38
|
return {
|
|
36
39
|
path: args.path,
|
|
37
40
|
external: true,
|
|
@@ -42,7 +42,7 @@ export const useDotnetHandler = Context.memo(async () => {
|
|
|
42
42
|
const name = input.handler.split(":")[0];
|
|
43
43
|
const proc = spawn(`dotnet`, [
|
|
44
44
|
`exec`,
|
|
45
|
-
url.fileURLToPath(new URL(`../../support/${BOOTSTRAP_MAP[
|
|
45
|
+
url.fileURLToPath(new URL(`../../support/${BOOTSTRAP_MAP[input.runtime]}/release/dotnet-bootstrap.dll`, import.meta.url)),
|
|
46
46
|
name + ".dll",
|
|
47
47
|
input.handler,
|
|
48
48
|
], {
|
|
@@ -81,7 +81,7 @@ export const useDotnetHandler = Context.memo(async () => {
|
|
|
81
81
|
"dotnet",
|
|
82
82
|
"publish",
|
|
83
83
|
"--output",
|
|
84
|
-
input.out,
|
|
84
|
+
'"' + input.out + '"',
|
|
85
85
|
"--configuration",
|
|
86
86
|
"Release",
|
|
87
87
|
"--framework",
|
|
@@ -104,6 +104,7 @@ export const useDotnetHandler = Context.memo(async () => {
|
|
|
104
104
|
return {
|
|
105
105
|
type: "success",
|
|
106
106
|
handler: input.props.handler,
|
|
107
|
+
runtime: input.props.runtime,
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
catch (ex) {
|
package/runtime/handlers.d.ts
CHANGED
package/runtime/workers.js
CHANGED
|
@@ -45,6 +45,7 @@ export const useRuntimeWorkers = Context.memo(async () => {
|
|
|
45
45
|
workerID: evt.properties.workerID,
|
|
46
46
|
environment: evt.properties.env,
|
|
47
47
|
url: `${server.url}/${evt.properties.workerID}/${server.API_VERSION}`,
|
|
48
|
+
runtime: props.runtime,
|
|
48
49
|
});
|
|
49
50
|
workers.set(evt.properties.workerID, {
|
|
50
51
|
workerID: evt.properties.workerID,
|
package/sst.mjs
CHANGED
|
@@ -3960,7 +3960,8 @@ var init_workers = __esm({
|
|
|
3960
3960
|
...build2,
|
|
3961
3961
|
workerID: evt.properties.workerID,
|
|
3962
3962
|
environment: evt.properties.env,
|
|
3963
|
-
url: `${server.url}/${evt.properties.workerID}/${server.API_VERSION}
|
|
3963
|
+
url: `${server.url}/${evt.properties.workerID}/${server.API_VERSION}`,
|
|
3964
|
+
runtime: props.runtime
|
|
3964
3965
|
});
|
|
3965
3966
|
workers.set(evt.properties.workerID, {
|
|
3966
3967
|
workerID: evt.properties.workerID,
|
|
@@ -4069,7 +4070,7 @@ var init_dotnet = __esm({
|
|
|
4069
4070
|
`exec`,
|
|
4070
4071
|
url3.fileURLToPath(
|
|
4071
4072
|
new URL(
|
|
4072
|
-
`../../support/${BOOTSTRAP_MAP[
|
|
4073
|
+
`../../support/${BOOTSTRAP_MAP[input.runtime]}/release/dotnet-bootstrap.dll`,
|
|
4073
4074
|
import.meta.url
|
|
4074
4075
|
)
|
|
4075
4076
|
),
|
|
@@ -4114,7 +4115,7 @@ var init_dotnet = __esm({
|
|
|
4114
4115
|
"dotnet",
|
|
4115
4116
|
"publish",
|
|
4116
4117
|
"--output",
|
|
4117
|
-
input.out,
|
|
4118
|
+
'"' + input.out + '"',
|
|
4118
4119
|
"--configuration",
|
|
4119
4120
|
"Release",
|
|
4120
4121
|
"--framework",
|
|
@@ -4131,7 +4132,8 @@ var init_dotnet = __esm({
|
|
|
4131
4132
|
);
|
|
4132
4133
|
return {
|
|
4133
4134
|
type: "success",
|
|
4134
|
-
handler: input.props.handler
|
|
4135
|
+
handler: input.props.handler,
|
|
4136
|
+
runtime: input.props.runtime
|
|
4135
4137
|
};
|
|
4136
4138
|
} catch (ex) {
|
|
4137
4139
|
return {
|
|
@@ -6172,6 +6174,9 @@ async function extractSchema(opts) {
|
|
|
6172
6174
|
setup(build2) {
|
|
6173
6175
|
const filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/;
|
|
6174
6176
|
build2.onResolve({ filter }, (args) => {
|
|
6177
|
+
const packageName = args.path.match(/^(@[^\/]+\/[^\/]+|[^@/]+)/);
|
|
6178
|
+
if (packageName && opts.internalPackages?.includes(packageName[0]))
|
|
6179
|
+
return;
|
|
6175
6180
|
return {
|
|
6176
6181
|
path: args.path,
|
|
6177
6182
|
external: true
|
|
@@ -6320,7 +6325,8 @@ var init_pothos2 = __esm({
|
|
|
6320
6325
|
async function build2(route) {
|
|
6321
6326
|
try {
|
|
6322
6327
|
const schema = await pothos_exports.generate({
|
|
6323
|
-
schema: route.schema
|
|
6328
|
+
schema: route.schema,
|
|
6329
|
+
internalPackages: route.internalPackages
|
|
6324
6330
|
});
|
|
6325
6331
|
await fs15.writeFile(route.output, schema);
|
|
6326
6332
|
if (Array.isArray(route.commands) && route.commands.length > 0) {
|
|
@@ -6368,8 +6374,6 @@ import { DataApiDialect } from "kysely-data-api";
|
|
|
6368
6374
|
import { RDSData } from "@aws-sdk/client-rds-data";
|
|
6369
6375
|
import * as fs16 from "fs/promises";
|
|
6370
6376
|
import {
|
|
6371
|
-
DatabaseMetadata,
|
|
6372
|
-
EnumCollection,
|
|
6373
6377
|
PostgresDialect,
|
|
6374
6378
|
MysqlDialect,
|
|
6375
6379
|
Serializer,
|
|
@@ -6391,44 +6395,28 @@ var init_kysely = __esm({
|
|
|
6391
6395
|
if (!db.types)
|
|
6392
6396
|
return;
|
|
6393
6397
|
logger("generating types for", db.migratorID);
|
|
6398
|
+
const dataApi = new DataApiDialect({
|
|
6399
|
+
mode: db.engine.includes("postgres") ? "postgres" : "mysql",
|
|
6400
|
+
driver: {
|
|
6401
|
+
secretArn: db.secretArn,
|
|
6402
|
+
resourceArn: db.clusterArn,
|
|
6403
|
+
database: db.defaultDatabaseName,
|
|
6404
|
+
client: useAWSClient(RDSData)
|
|
6405
|
+
}
|
|
6406
|
+
});
|
|
6394
6407
|
const k = new Kysely({
|
|
6395
|
-
dialect:
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
database: db.defaultDatabaseName,
|
|
6401
|
-
client: useAWSClient(RDSData)
|
|
6402
|
-
}
|
|
6403
|
-
})
|
|
6408
|
+
dialect: dataApi
|
|
6409
|
+
});
|
|
6410
|
+
const dialect = db.engine.includes("postgres") ? new PostgresDialect() : new MysqlDialect();
|
|
6411
|
+
const instrospection = await dialect.introspector.introspect({
|
|
6412
|
+
db: k
|
|
6404
6413
|
});
|
|
6405
|
-
const tables = await k.introspection.getTables();
|
|
6406
6414
|
logger("introspected tables");
|
|
6407
|
-
const metadata3 = db.engine.includes("postgres") ? tables.map((table) => ({
|
|
6408
|
-
...table,
|
|
6409
|
-
columns: table.columns.map((column) => {
|
|
6410
|
-
const isArray = column.dataType.startsWith("_");
|
|
6411
|
-
return {
|
|
6412
|
-
...column,
|
|
6413
|
-
dataType: isArray ? column.dataType.slice(1) : column.dataType,
|
|
6414
|
-
enumValues: null,
|
|
6415
|
-
isArray
|
|
6416
|
-
};
|
|
6417
|
-
})
|
|
6418
|
-
})) : tables.map((table) => ({
|
|
6419
|
-
...table,
|
|
6420
|
-
columns: table.columns.map((column) => ({
|
|
6421
|
-
...column,
|
|
6422
|
-
enumValues: null
|
|
6423
|
-
}))
|
|
6424
|
-
}));
|
|
6425
|
-
logger("generated metadata", metadata3.length);
|
|
6426
6415
|
const transformer = new Transformer();
|
|
6427
|
-
const Dialect = db.engine.includes("postgres") ? new PostgresDialect() : new MysqlDialect();
|
|
6428
6416
|
const nodes = transformer.transform({
|
|
6429
|
-
dialect
|
|
6417
|
+
dialect,
|
|
6430
6418
|
camelCase: db.types.camelCase === true,
|
|
6431
|
-
metadata:
|
|
6419
|
+
metadata: instrospection
|
|
6432
6420
|
});
|
|
6433
6421
|
logger("transformed nodes", nodes.length);
|
|
6434
6422
|
const lastIndex = nodes.length - 1;
|
|
@@ -47911,7 +47899,7 @@ var connect = (program2) => program2.command(
|
|
|
47911
47899
|
{
|
|
47912
47900
|
Effect: "Allow",
|
|
47913
47901
|
Principal: {
|
|
47914
|
-
AWS: "arn:aws:iam::917397401067:
|
|
47902
|
+
AWS: "arn:aws:iam::917397401067:role/*"
|
|
47915
47903
|
},
|
|
47916
47904
|
Action: "sts:AssumeRole"
|
|
47917
47905
|
}
|
|
@@ -47932,7 +47920,7 @@ var connect = (program2) => program2.command(
|
|
|
47932
47920
|
const project = useProject2();
|
|
47933
47921
|
const identity = await useSTSIdentity2();
|
|
47934
47922
|
console.log(
|
|
47935
|
-
`http://localhost:3000/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}`
|
|
47923
|
+
`http://localhost:3000/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}®ion=${project.config.region}`
|
|
47936
47924
|
);
|
|
47937
47925
|
}
|
|
47938
47926
|
);
|
|
@@ -16,7 +16,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof be))r
|
|
|
16
16
|
`));var r=e.pax;if(r)for(var i in r)t+=Lo(" "+i+"="+r[i]+`
|
|
17
17
|
`);return Buffer.from(t)};wr.decodePax=function(e){for(var t={};e.length;){for(var r=0;r<e.length&&e[r]!==32;)r++;var i=parseInt(e.slice(0,r).toString(),10);if(!i)return t;var n=e.slice(r+1,i-1).toString(),s=n.indexOf("=");if(s===-1)return t;t[n.slice(0,s)]=n.slice(s+1),e=e.slice(i)}return t};wr.encode=function(e){var t=wE(512),r=e.name,i="";if(e.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var n=r.indexOf("/");if(n===-1)return null;i+=i?"/"+r.slice(0,n):r.slice(0,n),r=r.slice(n+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(i)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(r),t.write(wt(e.mode&RE,6),100),t.write(wt(e.uid,6),108),t.write(wt(e.gid,6),116),t.write(wt(e.size,11),124),t.write(wt(e.mtime.getTime()/1e3|0,11),136),t[156]=Hd+LE(e.type),e.linkname&&t.write(e.linkname,157),$d.copy(t,li),OE.copy(t,Mo),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(wt(e.devmajor||0,6),329),t.write(wt(e.devminor||0,6),337),i&&t.write(i,345),t.write(wt(Vd(t),6),148),t)};wr.decode=function(e,t,r){var i=e[156]===0?0:e[156]-Hd,n=br(e,0,100,t),s=St(e,100,8),o=St(e,108,8),u=St(e,116,8),l=St(e,124,12),p=St(e,136,12),d=IE(i),m=e[157]===0?null:br(e,157,100,t),y=br(e,265,32),g=br(e,297,32),b=St(e,329,8),A=St(e,337,8),E=Vd(e);if(E===8*32)return null;if(E!==St(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if($d.compare(e,li,li+6)===0)e[345]&&(n=br(e,345,155,t)+"/"+n);else if(!(TE.compare(e,li,li+6)===0&&xE.compare(e,Mo,Mo+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return i===0&&n&&n[n.length-1]==="/"&&(i=5),{name:n,mode:s,uid:o,gid:u,size:l,mtime:new Date(1e3*p),type:d,linkname:m,uname:y,gname:g,devmajor:b,devminor:A}}});var tp=L((Ox,ep)=>{var Yd=D("util"),DE=Wd(),hi=Do(),Kd=We().Writable,Xd=We().PassThrough,Jd=a(function(){},"noop"),Qd=a(function(e){return e&=511,e&&512-e},"overflow"),PE=a(function(e,t){var r=new Hn(e,t);return r.end(),r},"emptyStream"),CE=a(function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e},"mixinPax"),Hn=a(function(e,t){this._parent=e,this.offset=t,Xd.call(this,{autoDestroy:!1})},"Source");Yd.inherits(Hn,Xd);Hn.prototype.destroy=function(e){this._parent.destroy(e)};var it=a(function(e){if(!(this instanceof it))return new it(e);Kd.call(this,e),e=e||{},this._offset=0,this._buffer=DE(),this._missing=0,this._partial=!1,this._onparse=Jd,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,r=t._buffer,i=a(function(){t._continue()},"oncontinue"),n=a(function(y){if(t._locked=!1,y)return t.destroy(y);t._stream||i()},"onunlock"),s=a(function(){t._stream=null;var y=Qd(t._header.size);y?t._parse(y,o):t._parse(512,m),t._locked||i()},"onstreamend"),o=a(function(){t._buffer.consume(Qd(t._header.size)),t._parse(512,m),i()},"ondrain"),u=a(function(){var y=t._header.size;t._paxGlobal=hi.decodePax(r.slice(0,y)),r.consume(y),s()},"onpaxglobalheader"),l=a(function(){var y=t._header.size;t._pax=hi.decodePax(r.slice(0,y)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),r.consume(y),s()},"onpaxheader"),p=a(function(){var y=t._header.size;this._gnuLongPath=hi.decodeLongPath(r.slice(0,y),e.filenameEncoding),r.consume(y),s()},"ongnulongpath"),d=a(function(){var y=t._header.size;this._gnuLongLinkPath=hi.decodeLongPath(r.slice(0,y),e.filenameEncoding),r.consume(y),s()},"ongnulonglinkpath"),m=a(function(){var y=t._offset,g;try{g=t._header=hi.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(b){t.emit("error",b)}if(r.consume(512),!g){t._parse(512,m),i();return}if(g.type==="gnu-long-path"){t._parse(g.size,p),i();return}if(g.type==="gnu-long-link-path"){t._parse(g.size,d),i();return}if(g.type==="pax-global-header"){t._parse(g.size,u),i();return}if(g.type==="pax-header"){t._parse(g.size,l),i();return}if(t._gnuLongPath&&(g.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(g.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=g=CE(g,t._pax),t._pax=null),t._locked=!0,!g.size||g.type==="directory"){t._parse(512,m),t.emit("entry",g,PE(t,y),n);return}t._stream=new Hn(t,y),t.emit("entry",g,t._stream,n),t._parse(g.size,s),i()},"onheader");this._onheader=m,this._parse(512,m)},"Extract");Yd.inherits(it,Kd);it.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))};it.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)};it.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=Jd,this._overflow?this._write(this._overflow,void 0,e):e()}};it.prototype._write=function(e,t,r){if(!this._destroyed){var i=this._stream,n=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,i?i.write(e,r):(n.append(e),r());this._cb=r,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),i?i.end(e):n.append(e),this._overflow=o,this._onparse()}};it.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()};ep.exports=it});var ip=L((xx,rp)=>{rp.exports=D("fs").constants||D("constants")});var sp=L((Rx,ap)=>{var NE=Kr(),qE=a(function(){},"noop"),FE=a(function(e){return e.setHeader&&typeof e.abort=="function"},"isRequest"),jE=a(function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},"isChildProcess"),np=a(function(e,t,r){if(typeof t=="function")return np(e,null,t);t||(t={}),r=NE(r||qE);var i=e._writableState,n=e._readableState,s=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,u=!1,l=a(function(){e.writable||p()},"onlegacyfinish"),p=a(function(){o=!1,s||r.call(e)},"onfinish"),d=a(function(){s=!1,o||r.call(e)},"onend"),m=a(function(E){r.call(e,E?new Error("exited with error code: "+E):null)},"onexit"),y=a(function(E){r.call(e,E)},"onerror"),g=a(function(){process.nextTick(b)},"onclose"),b=a(function(){if(!u){if(s&&!(n&&n.ended&&!n.destroyed))return r.call(e,new Error("premature close"));if(o&&!(i&&i.ended&&!i.destroyed))return r.call(e,new Error("premature close"))}},"onclosenexttick"),A=a(function(){e.req.on("finish",p)},"onrequest");return FE(e)?(e.on("complete",p),e.on("abort",g),e.req?A():e.on("request",A)):o&&!i&&(e.on("end",l),e.on("close",l)),jE(e)&&e.on("exit",m),e.on("end",d),e.on("finish",p),t.error!==!1&&e.on("error",y),e.on("close",g),function(){u=!0,e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",A),e.req&&e.req.removeListener("finish",p),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",d),e.removeListener("error",y),e.removeListener("close",g)}},"eos");ap.exports=np});var hp=L((Ix,lp)=>{var Sr=ip(),op=sp(),Zn=Me(),kE=Buffer.alloc,up=We().Readable,Er=We().Writable,BE=D("string_decoder").StringDecoder,$n=Do(),UE=parseInt("755",8),GE=parseInt("644",8),fp=kE(1024),Co=a(function(){},"noop"),Po=a(function(e,t){t&=511,t&&e.push(fp.slice(0,512-t))},"overflow");function zE(e){switch(e&Sr.S_IFMT){case Sr.S_IFBLK:return"block-device";case Sr.S_IFCHR:return"character-device";case Sr.S_IFDIR:return"directory";case Sr.S_IFIFO:return"fifo";case Sr.S_IFLNK:return"symlink"}return"file"}a(zE,"modeToType");var Vn=a(function(e){Er.call(this),this.written=0,this._to=e,this._destroyed=!1},"Sink");Zn(Vn,Er);Vn.prototype._write=function(e,t,r){if(this.written+=e.length,this._to.push(e))return r();this._to._drain=r};Vn.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var Qn=a(function(){Er.call(this),this.linkname="",this._decoder=new BE("utf-8"),this._destroyed=!1},"LinkSink");Zn(Qn,Er);Qn.prototype._write=function(e,t,r){this.linkname+=this._decoder.write(e),r()};Qn.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var ci=a(function(){Er.call(this),this._destroyed=!1},"Void");Zn(ci,Er);ci.prototype._write=function(e,t,r){r(new Error("No body allowed for this entry"))};ci.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var Ye=a(function(e){if(!(this instanceof Ye))return new Ye(e);up.call(this,e),this._drain=Co,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null},"Pack");Zn(Ye,up);Ye.prototype.entry=function(e,t,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof t=="function"&&(r=t,t=null),r||(r=Co);var i=this;if((!e.size||e.type==="symlink")&&(e.size=0),e.type||(e.type=zE(e.mode)),e.mode||(e.mode=e.type==="directory"?UE:GE),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),typeof t=="string"&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var n=this.push(t);return Po(i,e.size),n?process.nextTick(r):this._drain=r,new ci}if(e.type==="symlink"&&!e.linkname){var s=new Qn;return op(s,function(u){if(u)return i.destroy(),r(u);e.linkname=s.linkname,i._encode(e),r()}),s}if(this._encode(e),e.type!=="file"&&e.type!=="contiguous-file")return process.nextTick(r),new ci;var o=new Vn(this);return this._stream=o,op(o,function(u){if(i._stream=null,u)return i.destroy(),r(u);if(o.written!==e.size)return i.destroy(),r(new Error("size mismatch"));Po(i,e.size),i._finalizing&&i.finalize(),r()}),o}};Ye.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(fp),this.push(null))};Ye.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};Ye.prototype._encode=function(e){if(!e.pax){var t=$n.encode(e);if(t){this.push(t);return}}this._encodePax(e)};Ye.prototype._encodePax=function(e){var t=$n.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),r={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push($n.encode(r)),this.push(t),Po(this,t.length),r.size=e.size,r.type=e.type,this.push($n.encode(r))};Ye.prototype._read=function(e){var t=this._drain;this._drain=Co,t()};lp.exports=Ye});var cp=L(No=>{No.extract=tp();No.pack=hp()});var gp=L((Dx,pp)=>{var WE=D("zlib"),HE=cp(),dp=pr(),nt=a(function(e){if(!(this instanceof nt))return new nt(e);e=this.options=dp.defaults(e,{gzip:!1}),typeof e.gzipOptions!="object"&&(e.gzipOptions={}),this.supports={directory:!0,symlink:!0},this.engine=HE.pack(e),this.compressor=!1,e.gzip&&(this.compressor=WE.createGzip(e.gzipOptions),this.compressor.on("error",this._onCompressorError.bind(this)))},"Tar");nt.prototype._onCompressorError=function(e){this.engine.emit("error",e)};nt.prototype.append=function(e,t,r){var i=this;t.mtime=t.date;function n(o,u){if(o){r(o);return}i.engine.entry(t,u,function(l){r(l,t)})}if(a(n,"append"),t.sourceType==="buffer")n(null,e);else if(t.sourceType==="stream"&&t.stats){t.size=t.stats.size;var s=i.engine.entry(t,function(o){r(o,t)});e.pipe(s)}else t.sourceType==="stream"&&dp.collectStream(e,n)};nt.prototype.finalize=function(){this.engine.finalize()};nt.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};nt.prototype.pipe=function(e,t){return this.compressor?this.engine.pipe.apply(this.engine,[this.compressor]).pipe(e,t):this.engine.pipe.apply(this.engine,arguments)};nt.prototype.unpipe=function(){return this.compressor?this.compressor.unpipe.apply(this.compressor,arguments):this.engine.unpipe.apply(this.engine,arguments)};pp.exports=nt});var _p=L((Cx,mp)=>{var $E=D("util").inherits,yp=We().Transform,ZE=So(),vp=pr(),Et=a(function(e){if(!(this instanceof Et))return new Et(e);e=this.options=vp.defaults(e,{}),yp.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]},"Json");$E(Et,yp);Et.prototype._transform=function(e,t,r){r(null,e)};Et.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)};Et.prototype.append=function(e,t,r){var i=this;t.crc32=0;function n(s,o){if(s){r(s);return}t.size=o.length||0,t.crc32=ZE.unsigned(o),i.files.push(t),r(null,t)}a(n,"onend"),t.sourceType==="buffer"?n(null,e):t.sourceType==="stream"&&vp.collectStream(e,n)};Et.prototype.finalize=function(){this._writeStringified(),this.end()};mp.exports=Et});var wp=L((qx,bp)=>{var VE=ad(),di={},Ot=a(function(e,t){return Ot.create(e,t)},"vending");Ot.create=function(e,t){if(di[e]){var r=new VE(e,t);return r.setFormat(e),r.setModule(new di[e](t)),r}else throw new Error("create("+e+"): format not registered")};Ot.registerFormat=function(e,t){if(di[e])throw new Error("register("+e+"): format already registered");if(typeof t!="function")throw new Error("register("+e+"): format module invalid");if(typeof t.prototype.append!="function"||typeof t.prototype.finalize!="function")throw new Error("register("+e+"): format module missing methods");di[e]=t};Ot.isRegisteredFormat=function(e){return!!di[e]};Ot.registerFormat("zip",Bd());Ot.registerFormat("tar",gp());Ot.registerFormat("json",_p());bp.exports=Ot});var Fo=L(Tt=>{Tt.setopts=e1;Tt.ownProp=Sp;Tt.makeAbs=pi;Tt.finish=t1;Tt.mark=r1;Tt.isIgnored=Op;Tt.childrenIgnored=i1;function Sp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}a(Sp,"ownProp");var QE=D("fs"),Ht=D("path"),YE=Dr(),Ep=D("path").isAbsolute,qo=YE.Minimatch;function KE(e,t){return e.localeCompare(t,"en")}a(KE,"alphasort");function XE(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(JE))}a(XE,"setupIgnores");function JE(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new qo(r,{dot:!0})}return{matcher:new qo(e,{dot:!0}),gmatcher:t}}a(JE,"ignoreMap");function e1(e,t,r){if(r||(r={}),r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir&&(e.mark=!0),e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.absolute=!!r.absolute,e.fs=r.fs||QE,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),XE(e,r),e.changedCwd=!1;var i=process.cwd();Sp(r,"cwd")?(e.cwd=Ht.resolve(r.cwd),e.changedCwd=e.cwd!==i):e.cwd=Ht.resolve(i),e.root=r.root||Ht.resolve(e.cwd,"/"),e.root=Ht.resolve(e.root),e.cwdAbs=Ep(e.cwd)?e.cwd:pi(e,e.cwd),e.nomount=!!r.nomount,process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/"),e.cwd=e.cwd.replace(/\\/g,"/"),e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")),r.nonegate=!0,r.nocomment=!0,r.allowWindowsEscape=!0,e.minimatch=new qo(t,r),e.options=e.minimatch.options}a(e1,"setopts");function t1(e){for(var t=e.nounique,r=t?[]:Object.create(null),i=0,n=e.matches.length;i<n;i++){var s=e.matches[i];if(!s||Object.keys(s).length===0){if(e.nonull){var o=e.minimatch.globSet[i];t?r.push(o):r[o]=!0}}else{var u=Object.keys(s);t?r.push.apply(r,u):u.forEach(function(l){r[l]=!0})}}if(t||(r=Object.keys(r)),e.nosort||(r=r.sort(KE)),e.mark){for(var i=0;i<r.length;i++)r[i]=e._mark(r[i]);e.nodir&&(r=r.filter(function(l){var p=!/\/$/.test(l),d=e.cache[l]||e.cache[pi(e,l)];return p&&d&&(p=d!=="DIR"&&!Array.isArray(d)),p}))}e.ignore.length&&(r=r.filter(function(l){return!Op(e,l)})),e.found=r}a(t1,"finish");function r1(e,t){var r=pi(e,t),i=e.cache[r],n=t;if(i){var s=i==="DIR"||Array.isArray(i),o=t.slice(-1)==="/";if(s&&!o?n+="/":!s&&o&&(n=n.slice(0,-1)),n!==t){var u=pi(e,n);e.statCache[u]=e.statCache[r],e.cache[u]=e.cache[r]}}return n}a(r1,"mark");function pi(e,t){var r=t;return t.charAt(0)==="/"?r=Ht.join(e.root,t):Ep(t)||t===""?r=t:e.changedCwd?r=Ht.resolve(e.cwd,t):r=Ht.resolve(t),process.platform==="win32"&&(r=r.replace(/\\/g,"/")),r}a(pi,"makeAbs");function Op(e,t){return e.ignore.length?e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))}):!1}a(Op,"isIgnored");function i1(e,t){return e.ignore.length?e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))}):!1}a(i1,"childrenIgnored")});var Ip=L((zx,Ap)=>{Ap.exports=Rp;Rp.GlobSync=we;var n1=Vr(),Tp=Dr(),Bx=Tp.Minimatch,Ux=Bo().Glob,Gx=D("util"),jo=D("path"),xp=D("assert"),Yn=D("path").isAbsolute,$t=Fo(),a1=$t.setopts,ko=$t.ownProp,s1=$t.childrenIgnored,o1=$t.isIgnored;function Rp(e,t){if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
|
18
18
|
See: https://github.com/isaacs/node-glob/issues/167`);return new we(e,t).found}a(Rp,"globSync");function we(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
|
19
|
-
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof we))return new we(e,t);if(a1(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var i=0;i<r;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}a(we,"GlobSync");we.prototype._finish=function(){if(xp.ok(this instanceof we),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var n in t)try{n=e._makeAbs(n);var s=n1.realpathSync(n,e.realpathCache);i[s]=!0}catch(o){if(o.syscall==="stat")i[e._makeAbs(n)]=!0;else throw o}})}$t.finish(this)};we.prototype._process=function(e,t,r){xp.ok(this instanceof we);for(var i=0;typeof e[i]=="string";)i++;var n;switch(i){case e.length:this._processSimple(e.join("/"),t);return;case 0:n=null;break;default:n=e.slice(0,i).join("/");break}var s=e.slice(i),o;n===null?o=".":((Yn(n)||Yn(e.map(function(p){return typeof p=="string"?p:"[*]"}).join("/")))&&(!n||!Yn(n))&&(n="/"+n),o=n);var u=this._makeAbs(o);if(!s1(this,o)){var l=s[0]===Tp.GLOBSTAR;l?this._processGlobStar(n,o,u,s,t,r):this._processReaddir(n,o,u,s,t,r)}};we.prototype._processReaddir=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){for(var u=i[0],l=!!this.minimatch.negate,p=u._glob,d=this.dot||p.charAt(0)===".",m=[],y=0;y<o.length;y++){var g=o[y];if(g.charAt(0)!=="."||d){var b;l&&!e?b=!g.match(u):b=g.match(u),b&&m.push(g)}}var A=m.length;if(A!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var y=0;y<A;y++){var g=m[y];e&&(e.slice(-1)!=="/"?g=e+"/"+g:g=e+g),g.charAt(0)==="/"&&!this.nomount&&(g=jo.join(this.root,g)),this._emitMatch(n,g)}return}i.shift();for(var y=0;y<A;y++){var g=m[y],E;e?E=[e,g]:E=[g],this._process(E.concat(i),n,s)}}}};we.prototype._emitMatch=function(e,t){if(!o1(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};we.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,i;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();return this.symlinks[e]=n,!n&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};we.prototype._readdir=function(e,t){var r;if(t&&!ko(this.symlinks,e))return this._readdirInGlobStar(e);if(ko(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};we.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,t};we.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=t.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};we.prototype._processGlobStar=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){var u=i.slice(1),l=e?[e]:[],p=l.concat(u);this._process(p,n,!1);var d=o.length,m=this.symlinks[r];if(!(m&&s))for(var y=0;y<d;y++){var g=o[y];if(!(g.charAt(0)==="."&&!this.dot)){var b=l.concat(o[y],u);this._process(b,n,!0);var A=l.concat(o[y],i);this._process(A,n,!0)}}}};we.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&Yn(e)&&!this.nomount){var i=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=jo.join(this.root,e):(e=jo.resolve(this.root,e),i&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};we.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&ko(this.cache,t)){var o=this.cache[t];if(Array.isArray(o)&&(o="DIR"),!r||o==="DIR")return o;if(r&&o==="FILE")return!1}var i,n=this.statCache[t];if(!n){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(t)}catch{n=s}else n=s}this.statCache[t]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,r&&o==="FILE"?!1:o};we.prototype._mark=function(e){return $t.mark(this,e)};we.prototype._makeAbs=function(e){return $t.makeAbs(this,e)}});var Bo=L((Zx,Mp)=>{Mp.exports=Zt;var u1=Vr(),Lp=Dr(),Hx=Lp.Minimatch,f1=Me(),l1=D("events").EventEmitter,Uo=D("path"),Go=D("assert"),gi=D("path").isAbsolute,Wo=Ip(),Vt=Fo(),h1=Vt.setopts,zo=Vt.ownProp,Ho=Rs(),$x=D("util"),c1=Vt.childrenIgnored,d1=Vt.isIgnored,p1=Kr();function Zt(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return Wo(e,t)}return new le(e,t,r)}a(Zt,"glob");Zt.sync=Wo;var g1=Zt.GlobSync=Wo.GlobSync;Zt.glob=Zt;function y1(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e}a(y1,"extend");Zt.hasMagic=function(e,t){var r=y1({},t);r.noprocess=!0;var i=new le(e,r),n=i.minimatch.set;if(!e)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};Zt.Glob=le;f1(le,l1);function le(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new g1(e,t)}if(!(this instanceof le))return new le(e,t,r);h1(this,e,t),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=p1(r),this.on("error",r),this.on("end",function(l){r(null,l)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,o=0;o<i;o++)this._process(this.minimatch.set[o],o,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}a(u,"done")}a(le,"Glob");le.prototype._finish=function(){if(Go(this instanceof le),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Vt.finish(this),this.emit("end",this.found)}};le.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,i);function i(){--e===0&&t._finish()}a(i,"next")};le.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),n=this,s=i.length;if(s===0)return t();var o=this.matches[e]=Object.create(null);i.forEach(function(u,l){u=n._makeAbs(u),u1.realpath(u,n.realpathCache,function(p,d){p?p.syscall==="stat"?o[u]=!0:n.emit("error",p):o[d]=!0,--s===0&&(n.matches[e]=o,t())})})};le.prototype._mark=function(e){return Vt.mark(this,e)};le.prototype._makeAbs=function(e){return Vt.makeAbs(this,e)};le.prototype.abort=function(){this.aborted=!0,this.emit("abort")};le.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};le.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<i.length;t++){var n=i[t];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};le.prototype._process=function(e,t,r,i){if(Go(this instanceof le),Go(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,i]);return}for(var n=0;typeof e[n]=="string";)n++;var s;switch(n){case e.length:this._processSimple(e.join("/"),t,i);return;case 0:s=null;break;default:s=e.slice(0,n).join("/");break}var o=e.slice(n),u;s===null?u=".":((gi(s)||gi(e.map(function(d){return typeof d=="string"?d:"[*]"}).join("/")))&&(!s||!gi(s))&&(s="/"+s),u=s);var l=this._makeAbs(u);if(c1(this,u))return i();var p=o[0]===Lp.GLOBSTAR;p?this._processGlobStar(s,u,l,o,t,r,i):this._processReaddir(s,u,l,o,t,r,i)}};le.prototype._processReaddir=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,p){return u._processReaddir2(e,t,r,i,n,s,p,o)})};le.prototype._processReaddir2=function(e,t,r,i,n,s,o,u){if(!o)return u();for(var l=i[0],p=!!this.minimatch.negate,d=l._glob,m=this.dot||d.charAt(0)===".",y=[],g=0;g<o.length;g++){var b=o[g];if(b.charAt(0)!=="."||m){var A;p&&!e?A=!b.match(l):A=b.match(l),A&&y.push(b)}}var E=y.length;if(E===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var g=0;g<E;g++){var b=y[g];e&&(e!=="/"?b=e+"/"+b:b=e+b),b.charAt(0)==="/"&&!this.nomount&&(b=Uo.join(this.root,b)),this._emitMatch(n,b)}return u()}i.shift();for(var g=0;g<E;g++){var b=y[g],x;e&&(e!=="/"?b=e+"/"+b:b=e+b),this._process([b].concat(i),n,s,u)}u()};le.prototype._emitMatch=function(e,t){if(!this.aborted&&!d1(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=gi(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0;var n=this.statCache[r];n&&this.emit("stat",t,n),this.emit("match",t)}}};le.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,i=this,n=Ho(r,s);n&&i.fs.lstat(e,n);function s(o,u){if(o&&o.code==="ENOENT")return t();var l=u&&u.isSymbolicLink();i.symlinks[e]=l,!l&&u&&!u.isDirectory()?(i.cache[e]="FILE",t()):i._readdir(e,!1,t)}a(s,"lstatcb_")};le.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Ho("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!zo(this.symlinks,e))return this._readdirInGlobStar(e,r);if(zo(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return r();if(Array.isArray(i))return r(null,i)}var n=this;n.fs.readdir(e,v1(this,e,r))}};function v1(e,t,r){return function(i,n){i?e._readdirError(t,i,r):e._readdirEntries(t,n,r)}}a(v1,"readdirCb");le.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<t.length;i++){var n=t[i];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,r(null,t)}};le.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(e);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=t.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};le.prototype._processGlobStar=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,p){u._processGlobStar2(e,t,r,i,n,s,p,o)})};le.prototype._processGlobStar2=function(e,t,r,i,n,s,o,u){if(!o)return u();var l=i.slice(1),p=e?[e]:[],d=p.concat(l);this._process(d,n,!1,u);var m=this.symlinks[r],y=o.length;if(m&&s)return u();for(var g=0;g<y;g++){var b=o[g];if(!(b.charAt(0)==="."&&!this.dot)){var A=p.concat(o[g],l);this._process(A,n,!0,u);var E=p.concat(o[g],i);this._process(E,n,!0,u)}}u()};le.prototype._processSimple=function(e,t,r){var i=this;this._stat(e,function(n,s){i._processSimple2(e,t,n,s,r)})};le.prototype._processSimple2=function(e,t,r,i,n){if(this.matches[t]||(this.matches[t]=Object.create(null)),!i)return n();if(e&&gi(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Uo.join(this.root,e):(e=Uo.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),n()};le.prototype._stat=function(e,t){var r=this._makeAbs(e),i=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&zo(this.cache,r)){var n=this.cache[r];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return t(null,n);if(i&&n==="FILE")return t()}var s,o=this.statCache[r];if(o!==void 0){if(o===!1)return t(null,o);var u=o.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?t():t(null,u,o)}var l=this,p=Ho("stat\0"+r,d);p&&l.fs.lstat(r,p);function d(m,y){if(y&&y.isSymbolicLink())return l.fs.stat(r,function(g,b){g?l._stat2(e,r,null,y,t):l._stat2(e,r,g,b,t)});l._stat2(e,r,m,y,t)}a(d,"lstatcb_")};le.prototype._stat2=function(e,t,r,i,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,n();var s=e.slice(-1)==="/";if(this.statCache[t]=i,t.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var o=!0;return i&&(o=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,s&&o==="FILE"?n():n(null,o,i)}});var E1=L(()=>{process.on("unhandledRejection",e=>{throw e});var Kn=D("path"),Xn=D("fs/promises"),m1=D("fs"),_1=wp(),b1=Bo(),Zo=process.argv.slice(2),w1=Zo[0],Dp=Zo[1],Np=Zo[2],Pp=Np*1024*1024,Jn,xt,$o,ea=[],Cp=[];S1().catch(()=>{process.exit(1)});function S1(){return new Promise(async(e,t)=>{await i();for(let s of w1.split(",")){let o=n(s);for(let u of o){let l=Kn.join(s,u),[p,d]=await Promise.all([Xn.readFile(l),Xn.stat(l)]),m=d.size;if(m>Pp)throw new Error(`Cannot package file "${l}". The file is larger than ${Np}MB.`);$o+m>Pp&&(await xt.finalize(),await i()),xt.append(p,{name:u,date:new Date("1980-01-01T00:00:00.000Z"),mode:d.mode}),$o+=m}Cp.push(o)}await xt.finalize();let r=Kn.join(Dp,"filenames");await Xn.writeFile(r,Cp.join(`
|
|
19
|
+
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof we))return new we(e,t);if(a1(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var i=0;i<r;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}a(we,"GlobSync");we.prototype._finish=function(){if(xp.ok(this instanceof we),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var n in t)try{n=e._makeAbs(n);var s=n1.realpathSync(n,e.realpathCache);i[s]=!0}catch(o){if(o.syscall==="stat")i[e._makeAbs(n)]=!0;else throw o}})}$t.finish(this)};we.prototype._process=function(e,t,r){xp.ok(this instanceof we);for(var i=0;typeof e[i]=="string";)i++;var n;switch(i){case e.length:this._processSimple(e.join("/"),t);return;case 0:n=null;break;default:n=e.slice(0,i).join("/");break}var s=e.slice(i),o;n===null?o=".":((Yn(n)||Yn(e.map(function(p){return typeof p=="string"?p:"[*]"}).join("/")))&&(!n||!Yn(n))&&(n="/"+n),o=n);var u=this._makeAbs(o);if(!s1(this,o)){var l=s[0]===Tp.GLOBSTAR;l?this._processGlobStar(n,o,u,s,t,r):this._processReaddir(n,o,u,s,t,r)}};we.prototype._processReaddir=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){for(var u=i[0],l=!!this.minimatch.negate,p=u._glob,d=this.dot||p.charAt(0)===".",m=[],y=0;y<o.length;y++){var g=o[y];if(g.charAt(0)!=="."||d){var b;l&&!e?b=!g.match(u):b=g.match(u),b&&m.push(g)}}var A=m.length;if(A!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var y=0;y<A;y++){var g=m[y];e&&(e.slice(-1)!=="/"?g=e+"/"+g:g=e+g),g.charAt(0)==="/"&&!this.nomount&&(g=jo.join(this.root,g)),this._emitMatch(n,g)}return}i.shift();for(var y=0;y<A;y++){var g=m[y],E;e?E=[e,g]:E=[g],this._process(E.concat(i),n,s)}}}};we.prototype._emitMatch=function(e,t){if(!o1(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};we.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,i;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();return this.symlinks[e]=n,!n&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};we.prototype._readdir=function(e,t){var r;if(t&&!ko(this.symlinks,e))return this._readdirInGlobStar(e);if(ko(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};we.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,t};we.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=t.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};we.prototype._processGlobStar=function(e,t,r,i,n,s){var o=this._readdir(r,s);if(o){var u=i.slice(1),l=e?[e]:[],p=l.concat(u);this._process(p,n,!1);var d=o.length,m=this.symlinks[r];if(!(m&&s))for(var y=0;y<d;y++){var g=o[y];if(!(g.charAt(0)==="."&&!this.dot)){var b=l.concat(o[y],u);this._process(b,n,!0);var A=l.concat(o[y],i);this._process(A,n,!0)}}}};we.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&Yn(e)&&!this.nomount){var i=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=jo.join(this.root,e):(e=jo.resolve(this.root,e),i&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};we.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&ko(this.cache,t)){var o=this.cache[t];if(Array.isArray(o)&&(o="DIR"),!r||o==="DIR")return o;if(r&&o==="FILE")return!1}var i,n=this.statCache[t];if(!n){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(t)}catch{n=s}else n=s}this.statCache[t]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,r&&o==="FILE"?!1:o};we.prototype._mark=function(e){return $t.mark(this,e)};we.prototype._makeAbs=function(e){return $t.makeAbs(this,e)}});var Bo=L((Zx,Mp)=>{Mp.exports=Zt;var u1=Vr(),Lp=Dr(),Hx=Lp.Minimatch,f1=Me(),l1=D("events").EventEmitter,Uo=D("path"),Go=D("assert"),gi=D("path").isAbsolute,Wo=Ip(),Vt=Fo(),h1=Vt.setopts,zo=Vt.ownProp,Ho=Rs(),$x=D("util"),c1=Vt.childrenIgnored,d1=Vt.isIgnored,p1=Kr();function Zt(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return Wo(e,t)}return new le(e,t,r)}a(Zt,"glob");Zt.sync=Wo;var g1=Zt.GlobSync=Wo.GlobSync;Zt.glob=Zt;function y1(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e}a(y1,"extend");Zt.hasMagic=function(e,t){var r=y1({},t);r.noprocess=!0;var i=new le(e,r),n=i.minimatch.set;if(!e)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};Zt.Glob=le;f1(le,l1);function le(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new g1(e,t)}if(!(this instanceof le))return new le(e,t,r);h1(this,e,t),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=p1(r),this.on("error",r),this.on("end",function(l){r(null,l)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,o=0;o<i;o++)this._process(this.minimatch.set[o],o,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}a(u,"done")}a(le,"Glob");le.prototype._finish=function(){if(Go(this instanceof le),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Vt.finish(this),this.emit("end",this.found)}};le.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,i);function i(){--e===0&&t._finish()}a(i,"next")};le.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),n=this,s=i.length;if(s===0)return t();var o=this.matches[e]=Object.create(null);i.forEach(function(u,l){u=n._makeAbs(u),u1.realpath(u,n.realpathCache,function(p,d){p?p.syscall==="stat"?o[u]=!0:n.emit("error",p):o[d]=!0,--s===0&&(n.matches[e]=o,t())})})};le.prototype._mark=function(e){return Vt.mark(this,e)};le.prototype._makeAbs=function(e){return Vt.makeAbs(this,e)};le.prototype.abort=function(){this.aborted=!0,this.emit("abort")};le.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};le.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<i.length;t++){var n=i[t];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};le.prototype._process=function(e,t,r,i){if(Go(this instanceof le),Go(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,i]);return}for(var n=0;typeof e[n]=="string";)n++;var s;switch(n){case e.length:this._processSimple(e.join("/"),t,i);return;case 0:s=null;break;default:s=e.slice(0,n).join("/");break}var o=e.slice(n),u;s===null?u=".":((gi(s)||gi(e.map(function(d){return typeof d=="string"?d:"[*]"}).join("/")))&&(!s||!gi(s))&&(s="/"+s),u=s);var l=this._makeAbs(u);if(c1(this,u))return i();var p=o[0]===Lp.GLOBSTAR;p?this._processGlobStar(s,u,l,o,t,r,i):this._processReaddir(s,u,l,o,t,r,i)}};le.prototype._processReaddir=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,p){return u._processReaddir2(e,t,r,i,n,s,p,o)})};le.prototype._processReaddir2=function(e,t,r,i,n,s,o,u){if(!o)return u();for(var l=i[0],p=!!this.minimatch.negate,d=l._glob,m=this.dot||d.charAt(0)===".",y=[],g=0;g<o.length;g++){var b=o[g];if(b.charAt(0)!=="."||m){var A;p&&!e?A=!b.match(l):A=b.match(l),A&&y.push(b)}}var E=y.length;if(E===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var g=0;g<E;g++){var b=y[g];e&&(e!=="/"?b=e+"/"+b:b=e+b),b.charAt(0)==="/"&&!this.nomount&&(b=Uo.join(this.root,b)),this._emitMatch(n,b)}return u()}i.shift();for(var g=0;g<E;g++){var b=y[g],x;e&&(e!=="/"?b=e+"/"+b:b=e+b),this._process([b].concat(i),n,s,u)}u()};le.prototype._emitMatch=function(e,t){if(!this.aborted&&!d1(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=gi(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var i=this.cache[r];if(i==="DIR"||Array.isArray(i))return}this.matches[e][t]=!0;var n=this.statCache[r];n&&this.emit("stat",t,n),this.emit("match",t)}}};le.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,i=this,n=Ho(r,s);n&&i.fs.lstat(e,n);function s(o,u){if(o&&o.code==="ENOENT")return t();var l=u&&u.isSymbolicLink();i.symlinks[e]=l,!l&&u&&!u.isDirectory()?(i.cache[e]="FILE",t()):i._readdir(e,!1,t)}a(s,"lstatcb_")};le.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Ho("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!zo(this.symlinks,e))return this._readdirInGlobStar(e,r);if(zo(this.cache,e)){var i=this.cache[e];if(!i||i==="FILE")return r();if(Array.isArray(i))return r(null,i)}var n=this;n.fs.readdir(e,v1(this,e,r))}};function v1(e,t,r){return function(i,n){i?e._readdirError(t,i,r):e._readdirEntries(t,n,r)}}a(v1,"readdirCb");le.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<t.length;i++){var n=t[i];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,r(null,t)}};le.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(e);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=t.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};le.prototype._processGlobStar=function(e,t,r,i,n,s,o){var u=this;this._readdir(r,s,function(l,p){u._processGlobStar2(e,t,r,i,n,s,p,o)})};le.prototype._processGlobStar2=function(e,t,r,i,n,s,o,u){if(!o)return u();var l=i.slice(1),p=e?[e]:[],d=p.concat(l);this._process(d,n,!1,u);var m=this.symlinks[r],y=o.length;if(m&&s)return u();for(var g=0;g<y;g++){var b=o[g];if(!(b.charAt(0)==="."&&!this.dot)){var A=p.concat(o[g],l);this._process(A,n,!0,u);var E=p.concat(o[g],i);this._process(E,n,!0,u)}}u()};le.prototype._processSimple=function(e,t,r){var i=this;this._stat(e,function(n,s){i._processSimple2(e,t,n,s,r)})};le.prototype._processSimple2=function(e,t,r,i,n){if(this.matches[t]||(this.matches[t]=Object.create(null)),!i)return n();if(e&&gi(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=Uo.join(this.root,e):(e=Uo.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),n()};le.prototype._stat=function(e,t){var r=this._makeAbs(e),i=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&zo(this.cache,r)){var n=this.cache[r];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return t(null,n);if(i&&n==="FILE")return t()}var s,o=this.statCache[r];if(o!==void 0){if(o===!1)return t(null,o);var u=o.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?t():t(null,u,o)}var l=this,p=Ho("stat\0"+r,d);p&&l.fs.lstat(r,p);function d(m,y){if(y&&y.isSymbolicLink())return l.fs.stat(r,function(g,b){g?l._stat2(e,r,null,y,t):l._stat2(e,r,g,b,t)});l._stat2(e,r,m,y,t)}a(d,"lstatcb_")};le.prototype._stat2=function(e,t,r,i,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,n();var s=e.slice(-1)==="/";if(this.statCache[t]=i,t.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var o=!0;return i&&(o=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,s&&o==="FILE"?n():n(null,o,i)}});var E1=L(()=>{process.on("unhandledRejection",e=>{throw e});var Kn=D("path"),Xn=D("fs/promises"),m1=D("fs"),_1=wp(),b1=Bo(),Zo=process.argv.slice(2),w1=Zo[0],Dp=Zo[1],Np=Zo[2],Pp=Np*1024*1024,Jn,xt,$o,ea=[],Cp=[];S1().catch(()=>{process.exit(1)});function S1(){return new Promise(async(e,t)=>{await i();for(let s of w1.split(",")){let o=n(s);for(let u of o){let l=Kn.join(s,u),[p,d]=await Promise.all([Xn.readFile(l),Xn.stat(l)]),m=d.size;if(m>Pp)throw new Error(`Cannot package file "${l}". The file is larger than ${Np}MB.`);$o+m>Pp&&(await xt.finalize(),await i()),xt.append(p,{name:u,date:new Date("1980-01-01T00:00:00.000Z"),mode:d.mode}),$o+=m,Cp.push(u)}}await xt.finalize();let r=Kn.join(Dp,"filenames");await Xn.writeFile(r,Cp.join(`
|
|
20
20
|
`));async function i(){let s=ea.length,o=Kn.join(Dp,`part${s}.zip`);await Xn.mkdir(Kn.dirname(o),{recursive:!0}),Jn=m1.createWriteStream(o),xt=_1("zip"),$o=0,ea.push({output:Jn,archive:xt,isOutputClosed:!1}),xt.on("warning",t),xt.on("error",t),Jn.once("close",()=>{ea[s].isOutputClosed=!0,ea.every(({isOutputClosed:u})=>u)&&e()}),xt.pipe(Jn)}a(i,"openZip");function n(s){return b1.sync("**",{dot:!0,nodir:!0,follow:!0,cwd:s})}a(n,"getFilesInPath")})}a(S1,"generateZips")});export default E1();
|
|
21
21
|
/*! Bundled license information:
|
|
22
22
|
|