screw-up 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.d.ts +2 -9
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/cli-internal.d.ts +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/fast-tags.d.ts +42 -0
- package/dist/fast-tags.d.ts.map +1 -0
- package/dist/generated/packageMetadata.d.ts +4 -4
- package/dist/git-operations.d.ts +6 -5
- package/dist/git-operations.d.ts.map +1 -1
- package/dist/index.cjs +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/main.cjs +4 -4
- package/dist/main.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/{packageMetadata-CCW9p12u.cjs → packageMetadata-B3Z9TVh6.cjs} +183 -434
- package/dist/packageMetadata-B3Z9TVh6.cjs.map +1 -0
- package/dist/{packageMetadata-LkGK6Bjw.js → packageMetadata-CTjfzPVl.js} +183 -434
- package/dist/packageMetadata-CTjfzPVl.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/vite-plugin.d.ts +2 -2
- package/dist/vite-plugin.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/cache-manager.d.ts +0 -52
- package/dist/cache-manager.d.ts.map +0 -1
- package/dist/cache-operations.d.ts +0 -79
- package/dist/cache-operations.d.ts.map +0 -1
- package/dist/cache.d.ts +0 -67
- package/dist/cache.d.ts.map +0 -1
- package/dist/packageMetadata-CCW9p12u.cjs.map +0 -1
- package/dist/packageMetadata-LkGK6Bjw.js.map +0 -1
package/dist/analyzer.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { Logger } from './internal.js';
|
|
@@ -27,13 +27,6 @@ export interface TagInfo {
|
|
|
27
27
|
hash: string;
|
|
28
28
|
version: Version | undefined;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Tag cache for performance optimization
|
|
32
|
-
*/
|
|
33
|
-
export interface TagCache {
|
|
34
|
-
commitToTags: Map<string, TagInfo[]>;
|
|
35
|
-
initialized: boolean;
|
|
36
|
-
}
|
|
37
30
|
/**
|
|
38
31
|
* Get cached Git metadata fetcher function
|
|
39
32
|
* @param targetDir - Target directory to resolve Git metadata
|
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMvC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAaD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAuhBD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,EACjB,6BAA6B,OAAO,EACpC,QAAQ,MAAM,uBAaf,CAAC"}
|
package/dist/cli-internal.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { Logger } from './internal';
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { Logger } from './internal';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: screw-up
|
|
3
|
+
* version: 1.7.0
|
|
4
|
+
* description: Simply package metadata inserter on Vite plugin
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Logger } from './internal.js';
|
|
12
|
+
/**
|
|
13
|
+
* Fast implementation of listTags that reads directly from filesystem
|
|
14
|
+
* @param repoPath - Repository path
|
|
15
|
+
* @returns Array of all tag names
|
|
16
|
+
*/
|
|
17
|
+
export declare const listTagsFast: (repoPath: string) => Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get hash for a specific tag by reading refs directly
|
|
20
|
+
* @param repoPath - Repository path
|
|
21
|
+
* @param tagName - Name of the tag
|
|
22
|
+
* @returns The SHA-1 hash the tag points to, or null if not found
|
|
23
|
+
*/
|
|
24
|
+
export declare const resolveTagFast: (repoPath: string, tagName: string) => Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Batch resolve multiple tags for better performance
|
|
27
|
+
* @param repoPath - Repository path
|
|
28
|
+
* @param tagNames - Array of tag names to resolve
|
|
29
|
+
* @returns Map of tag name to hash
|
|
30
|
+
*/
|
|
31
|
+
export declare const resolveTagsBatch: (repoPath: string, tagNames: string[]) => Promise<Map<string, string>>;
|
|
32
|
+
/**
|
|
33
|
+
* Batch resolve multiple tags with their commit hashes for better performance
|
|
34
|
+
* @param repoPath - Repository path
|
|
35
|
+
* @param tagNames - Array of tag names to resolve
|
|
36
|
+
* @returns Map of tag name to {oid, commitOid}
|
|
37
|
+
*/
|
|
38
|
+
export declare const resolveTagsBatchWithCommit: (repoPath: string, tagNames: string[], logger: Logger) => Promise<Map<string, {
|
|
39
|
+
oid: string;
|
|
40
|
+
commitOid: string;
|
|
41
|
+
}>>;
|
|
42
|
+
//# sourceMappingURL=fast-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-tags.d.ts","sourceRoot":"","sources":["../src/fast-tags.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAqE5C;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CA6BrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,SAAS,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,IAAI,CA2DvB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,UAAU,MAAM,EAAE,KACjB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsE7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,MAAM,EAChB,UAAU,MAAM,EAAE,EAClB,QAAQ,MAAM,KACb,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAyHzD,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export declare const name = "screw-up";
|
|
12
|
-
export declare const version = "1.
|
|
12
|
+
export declare const version = "1.7.0";
|
|
13
13
|
export declare const description = "Simply package metadata inserter on Vite plugin";
|
|
14
14
|
export declare const author = "Kouji Matsui (@kekyo@mi.kekyo.net)";
|
|
15
15
|
export declare const license = "MIT";
|
|
16
16
|
export declare const repository_url = "https://github.com/kekyo/screw-up.git";
|
|
17
|
-
export declare const git_commit_hash = "
|
|
17
|
+
export declare const git_commit_hash = "0865d5a2d4d1e89be8dae4b6abeba1393a767707";
|
|
18
18
|
//# sourceMappingURL=packageMetadata.d.ts.map
|
package/dist/git-operations.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { TagInfo, Version } from './analyzer';
|
|
12
|
+
import { Logger } from './internal.js';
|
|
12
13
|
/**
|
|
13
14
|
* Git operations for tag management
|
|
14
15
|
* Handles all Git interactions
|
|
@@ -41,14 +42,14 @@ export declare const resolveTagToCommit: (repoPath: string, tagOid: string) => P
|
|
|
41
42
|
* @param parseVersion - Function to parse version from tag name
|
|
42
43
|
* @returns Array of TagInfo
|
|
43
44
|
*/
|
|
44
|
-
export declare const getTagsInfo: (repoPath: string, tagNames: string[], parseVersion: (tagName: string) => Version | undefined) => Promise<TagInfo[]>;
|
|
45
|
+
export declare const getTagsInfo: (repoPath: string, tagNames: string[], parseVersion: (tagName: string) => Version | undefined, logger: Logger) => Promise<TagInfo[]>;
|
|
45
46
|
/**
|
|
46
47
|
* Build complete tag cache from repository
|
|
47
48
|
* @param repoPath - Repository path
|
|
48
49
|
* @param parseVersion - Function to parse version from tag name
|
|
49
50
|
* @returns Map of commit hash to TagInfo array
|
|
50
51
|
*/
|
|
51
|
-
export declare const buildCompleteTagCache: (repoPath: string, parseVersion: (tagName: string) => Version | undefined) => Promise<Map<string, TagInfo[]>>;
|
|
52
|
+
export declare const buildCompleteTagCache: (repoPath: string, parseVersion: (tagName: string) => Version | undefined, logger: Logger) => Promise<Map<string, TagInfo[]>>;
|
|
52
53
|
/**
|
|
53
54
|
* Check if a tag has moved to a different commit
|
|
54
55
|
* @param repoPath - Repository path
|
|
@@ -64,5 +65,5 @@ export declare const hasTagMoved: (repoPath: string, tagName: string, cachedComm
|
|
|
64
65
|
* @param cache - Current cache
|
|
65
66
|
* @returns Array of modified tag names
|
|
66
67
|
*/
|
|
67
|
-
export declare const findModifiedTags: (repoPath: string, tagNames: string[], cache: Map<string, TagInfo[]
|
|
68
|
+
export declare const findModifiedTags: (repoPath: string, tagNames: string[], cache: Map<string, TagInfo[]>, logger: Logger) => Promise<string[]>;
|
|
68
69
|
//# sourceMappingURL=git-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-operations.d.ts","sourceRoot":"","sources":["../src/git-operations.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"git-operations.d.ts","sourceRoot":"","sources":["../src/git-operations.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAO5C;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,KACf,OAAO,CAAC,UAAU,EAAE,CAUtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,EAChB,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,CAmBhB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,EAChB,UAAU,MAAM,EAAE,EAClB,cAAc,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,EACtD,QAAQ,MAAM,KACb,OAAO,CAAC,OAAO,EAAE,CA6BnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,EAChB,cAAc,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,EACtD,QAAQ,MAAM,KACb,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAiDhC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,EAChB,SAAS,MAAM,EACf,cAAc,MAAM,KACnB,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,UAAU,MAAM,EAAE,EAClB,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAC7B,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,EAAE,CA+ClB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
const fs = require("fs/promises");
|
|
12
12
|
const fs$1 = require("fs");
|
|
13
13
|
const path = require("path");
|
|
14
|
-
const packageMetadata = require("./packageMetadata-
|
|
14
|
+
const packageMetadata = require("./packageMetadata-B3Z9TVh6.cjs");
|
|
15
|
+
/*!
|
|
16
|
+
* name: async-primitives
|
|
17
|
+
* version: 1.0.0
|
|
18
|
+
* description: A collection of primitive functions for asynchronous operations
|
|
19
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
20
|
+
* license: MIT
|
|
21
|
+
* repository.url: https://github.com/kekyo/async-primitives.git
|
|
22
|
+
* git.commit.hash: 87c2c54e1ee681110dd8e9e0466ee12c15f5557c
|
|
23
|
+
*/
|
|
15
24
|
const __NOOP_HANDLER = () => {
|
|
16
25
|
};
|
|
17
26
|
const __NOOP_RELEASABLE = {
|
|
@@ -62,7 +71,7 @@ const defer = (fn) => {
|
|
|
62
71
|
setTimeout(fn, 0);
|
|
63
72
|
}
|
|
64
73
|
};
|
|
65
|
-
const ABORTED_ERROR = () => new Error("Lock acquisition was aborted");
|
|
74
|
+
const ABORTED_ERROR$2 = () => new Error("Lock acquisition was aborted");
|
|
66
75
|
const createLockHandle = (releaseCallback) => {
|
|
67
76
|
let isActive = true;
|
|
68
77
|
const release = () => {
|
|
@@ -80,7 +89,7 @@ const createLockHandle = (releaseCallback) => {
|
|
|
80
89
|
[Symbol.dispose]: release
|
|
81
90
|
};
|
|
82
91
|
};
|
|
83
|
-
const
|
|
92
|
+
const createMutex = (maxConsecutiveCalls = 20) => {
|
|
84
93
|
let isLocked = false;
|
|
85
94
|
const queue = [];
|
|
86
95
|
let count = 0;
|
|
@@ -91,7 +100,7 @@ const createAsyncLock = (maxConsecutiveCalls = 20) => {
|
|
|
91
100
|
}
|
|
92
101
|
const item = queue.shift();
|
|
93
102
|
if ((_a = item.signal) == null ? void 0 : _a.aborted) {
|
|
94
|
-
item.reject(ABORTED_ERROR());
|
|
103
|
+
item.reject(ABORTED_ERROR$2());
|
|
95
104
|
scheduleNextProcess();
|
|
96
105
|
return;
|
|
97
106
|
}
|
|
@@ -124,7 +133,7 @@ const createAsyncLock = (maxConsecutiveCalls = 20) => {
|
|
|
124
133
|
const lock = async (signal) => {
|
|
125
134
|
if (signal) {
|
|
126
135
|
if (signal.aborted) {
|
|
127
|
-
throw ABORTED_ERROR();
|
|
136
|
+
throw ABORTED_ERROR$2();
|
|
128
137
|
}
|
|
129
138
|
return new Promise((resolve, reject) => {
|
|
130
139
|
const queueItem = {
|
|
@@ -134,7 +143,7 @@ const createAsyncLock = (maxConsecutiveCalls = 20) => {
|
|
|
134
143
|
};
|
|
135
144
|
const abortHandle = onAbort(signal, () => {
|
|
136
145
|
removeFromQueue(queueItem);
|
|
137
|
-
reject(ABORTED_ERROR());
|
|
146
|
+
reject(ABORTED_ERROR$2());
|
|
138
147
|
});
|
|
139
148
|
queueItem.resolve = (handle) => {
|
|
140
149
|
abortHandle.release();
|
|
@@ -248,7 +257,7 @@ const screwUp = (options = {}) => {
|
|
|
248
257
|
} = options;
|
|
249
258
|
const assetFiltersRegex = assetFilters.map((filter) => new RegExp(filter));
|
|
250
259
|
const resolvedOutputMetadataFileTypePath = outputMetadataFileTypePath || outputMetadataFilePath.replace(/\.ts$/, ".d.ts");
|
|
251
|
-
const generateMetadataSourceLocker =
|
|
260
|
+
const generateMetadataSourceLocker = createMutex();
|
|
252
261
|
const loggerPrefix = `${packageMetadata.name}-vite`;
|
|
253
262
|
let logger = packageMetadata.createConsoleLogger(loggerPrefix);
|
|
254
263
|
let banner;
|
|
@@ -362,13 +371,12 @@ const screwUp = (options = {}) => {
|
|
|
362
371
|
configResolved: async (config) => {
|
|
363
372
|
const l = await generateMetadataSourceLocker.lock();
|
|
364
373
|
try {
|
|
365
|
-
|
|
374
|
+
const tempEnableLogging = true;
|
|
366
375
|
projectRoot = config.root;
|
|
367
|
-
if (config == null ? void 0 : config.logger) {
|
|
376
|
+
if (tempEnableLogging || (config == null ? void 0 : config.logger)) {
|
|
368
377
|
logger = packageMetadata.createConsoleLogger(loggerPrefix, config.logger);
|
|
369
|
-
} else if (config == null ? void 0 : config.customLogger) {
|
|
370
|
-
logger = packageMetadata.createConsoleLogger(loggerPrefix, config.customLogger);
|
|
371
378
|
}
|
|
379
|
+
logger.debug(`configResolved: Started.`);
|
|
372
380
|
fetchGitMetadata = packageMetadata.getFetchGitMetadata(
|
|
373
381
|
projectRoot,
|
|
374
382
|
checkWorkingDirectoryStatus,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../node_modules/async-primitives/dist/async-primitives.js","../src/vite-plugin.ts"],"sourcesContent":["const __NOOP_HANDLER = () => {\n};\nconst __NOOP_RELEASABLE = {\n release: __NOOP_HANDLER,\n [Symbol.dispose]: __NOOP_HANDLER\n};\nconst onAbort = (signal, callback) => {\n if (!signal) {\n return __NOOP_RELEASABLE;\n }\n if (signal.aborted) {\n try {\n callback();\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n return __NOOP_RELEASABLE;\n }\n let abortHandler;\n abortHandler = () => {\n if (abortHandler) {\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n try {\n callback();\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n }\n };\n const release = () => {\n if (abortHandler) {\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n }\n };\n signal.addEventListener(\"abort\", abortHandler, { once: true });\n const handle = {\n release,\n [Symbol.dispose]: release\n };\n return handle;\n};\nconst delay = (msec, signal) => {\n if (signal) {\n if (signal.aborted) {\n throw new Error(\"Delay was aborted\");\n }\n return new Promise((resolve, reject) => {\n const abortHandle = onAbort(signal, () => {\n clearTimeout(timeoutId);\n reject(new Error(\"Delay was aborted\"));\n });\n const timeoutId = setTimeout(() => {\n abortHandle.release();\n resolve();\n }, msec);\n });\n } else {\n return new Promise((resolve) => {\n setTimeout(resolve, msec);\n });\n }\n};\nconst defer = (fn) => {\n if (typeof setImmediate === \"function\") {\n setImmediate(fn);\n } else {\n setTimeout(fn, 0);\n }\n};\nconst ABORTED_ERROR = () => new Error(\"Lock acquisition was aborted\");\nconst createLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createAsyncLock = (maxConsecutiveCalls = 20) => {\n let isLocked = false;\n const queue = [];\n let count = 0;\n const processQueue = () => {\n var _a;\n if (isLocked || queue.length === 0) {\n return;\n }\n const item = queue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR());\n scheduleNextProcess();\n return;\n }\n isLocked = true;\n const lockHandle = createLockHandle(releaseLock);\n item.resolve(lockHandle);\n };\n const scheduleNextProcess = () => {\n count++;\n if (count >= maxConsecutiveCalls) {\n count = 0;\n defer(processQueue);\n } else {\n processQueue();\n }\n };\n const releaseLock = () => {\n if (!isLocked) {\n return;\n }\n isLocked = false;\n scheduleNextProcess();\n };\n const removeFromQueue = (item) => {\n const index = queue.indexOf(item);\n if (index !== -1) {\n queue.splice(index, 1);\n }\n };\n const lock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR();\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromQueue(queueItem);\n reject(ABORTED_ERROR());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n queue.push(queueItem);\n processQueue();\n });\n } else {\n return new Promise((resolve, reject) => {\n queue.push({\n resolve,\n reject\n });\n processQueue();\n });\n }\n };\n return {\n lock,\n get isLocked() {\n return isLocked;\n },\n get pendingCount() {\n return queue.length;\n }\n };\n};\nconst createDeferred = (signal) => {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n const disposer = onAbort(signal, () => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n _reject(new Error(\"Deferred aborted\"));\n }\n });\n return {\n // The promise that resolves to the result\n promise,\n // Resolve the promise with a result\n resolve: (value) => {\n const _resolve = resolve;\n if (_resolve) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _resolve(value);\n }\n },\n // Reject the promise with an error\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reject: (error) => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _reject(error);\n }\n }\n };\n};\nconst createSignal = () => {\n const waiters = [];\n return {\n trigger: () => {\n if (waiters.length >= 1) {\n waiters.shift().resolve();\n }\n },\n wait: async (signal) => {\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Signal aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Signal aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n }\n };\n};\nconst createManuallySignal = (initialState) => {\n const waiters = [];\n let raised = initialState != null ? initialState : false;\n return {\n trigger: () => {\n raised = false;\n const waiter = waiters.shift();\n if (waiter) {\n waiter.resolve();\n raised = false;\n }\n },\n raise: () => {\n while (waiters.length >= 1) {\n raised = true;\n waiters.shift().resolve();\n }\n raised = true;\n },\n drop: () => {\n raised = false;\n },\n wait: async (signal) => {\n if (raised) {\n return;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Signal aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Signal aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n }\n };\n};\nconst createDeferredGenerator = (options) => {\n const maxItemReserved = options == null ? void 0 : options.maxItemReserved;\n const signal = options == null ? void 0 : options.signal;\n const queue = [];\n const arrived = createManuallySignal();\n const canReserve = maxItemReserved ? createManuallySignal(true) : void 0;\n const generator = async function* () {\n while (true) {\n while (true) {\n const item = queue.shift();\n if (maxItemReserved && queue.length === maxItemReserved - 1) {\n canReserve.raise();\n }\n if (!item) {\n break;\n }\n switch (item.kind) {\n case \"value\":\n yield item.value;\n break;\n case \"completed\":\n return;\n case \"error\":\n throw item.error;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Deferred generator aborted\");\n }\n }\n arrived.drop();\n try {\n await arrived.wait(signal);\n } catch (error) {\n if (error instanceof Error && error.message === \"Signal aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n }();\n const enqueue = async (item, signal2) => {\n while (true) {\n if (!maxItemReserved || queue.length < maxItemReserved) {\n const remains = queue.push(item);\n if (remains === 1) {\n arrived.raise();\n }\n if (remains === maxItemReserved) {\n canReserve.drop();\n }\n break;\n }\n try {\n await canReserve.wait(signal2);\n } catch (error) {\n if (error instanceof Error && error.message === \"Signal aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n };\n return {\n // The async generator that yields values\n generator,\n // Yield a value to the generator\n yield: (value, signal2) => enqueue({ kind: \"value\", value }, signal2),\n // Complete the generator (equivalent to return)\n return: (signal2) => enqueue({ kind: \"completed\" }, signal2),\n // Throw an error to the generator\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n throw: (error, signal2) => enqueue({ kind: \"error\", error }, signal2)\n };\n};\nconst createLogicalContext = (id) => {\n return { id, data: /* @__PURE__ */ new Map() };\n};\nlet currentLogicalContext = createLogicalContext(Symbol(\"[root]\"));\nconst setCurrentLogicalContext = (context) => {\n currentLogicalContext = context;\n};\nconst trampoline = (adjustment, callback, thisArg, ...args) => {\n const previousLogicalContext = currentLogicalContext;\n currentLogicalContext = adjustment.contextToUse;\n try {\n return callback.call(thisArg, ...args);\n } finally {\n adjustment.contextAfter = currentLogicalContext;\n currentLogicalContext = previousLogicalContext;\n }\n};\nlet isPrepared = false;\nconst prepare = () => {\n if (isPrepared) {\n return;\n }\n isPrepared = true;\n if (typeof globalThis.setTimeout !== \"undefined\") {\n const __setTimeout = globalThis.setTimeout;\n globalThis.setTimeout = (handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setTimeout(\n (...args2) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n };\n }\n if (typeof globalThis.setInterval !== \"undefined\") {\n const __setInterval = globalThis.setInterval;\n globalThis.setInterval = (handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setInterval(\n (...args2) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n };\n }\n if (typeof globalThis.queueMicrotask !== \"undefined\") {\n const __queueMicrotask = globalThis.queueMicrotask;\n globalThis.queueMicrotask = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __queueMicrotask(() => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0);\n });\n };\n }\n if (typeof globalThis.setImmediate !== \"undefined\") {\n const __setImmediate = globalThis.setImmediate;\n globalThis.setImmediate = (callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setImmediate((...callbackArgs) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0, ...callbackArgs);\n }, ...args);\n };\n }\n if (typeof process !== \"undefined\" && process.nextTick) {\n const __nextTick = process.nextTick;\n process.nextTick = (callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __nextTick(() => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0, ...args);\n });\n };\n }\n if (typeof Promise !== \"undefined\") {\n const __then = Promise.prototype.then;\n const __catch = Promise.prototype.catch;\n const __finally = Promise.prototype.finally;\n Promise.prototype.then = function(onFulfilled, onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __then.call(\n this,\n onFulfilled ? (value) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onFulfilled, void 0, value);\n } : void 0,\n onRejected ? (reason) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.catch = function(onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __catch.call(\n this,\n onRejected ? (reason) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.finally = function(onFinally) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __finally.call(\n this,\n onFinally ? () => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onFinally, void 0);\n } : void 0\n );\n return resultPromise;\n };\n }\n if (typeof EventTarget !== \"undefined\" && EventTarget.prototype && EventTarget.prototype.addEventListener) {\n const __eventTargetAddEventListener = EventTarget.prototype.addEventListener;\n EventTarget.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __eventTargetAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __eventTargetAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __eventTargetAddEventListener.call(this, type, wrappedListener, options);\n }\n return __eventTargetAddEventListener.call(this, type, listener, options);\n };\n }\n if (typeof Element !== \"undefined\" && Element.prototype && Element.prototype.addEventListener) {\n const __elementAddEventListener = Element.prototype.addEventListener;\n Element.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __elementAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __elementAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __elementAddEventListener.call(this, type, wrappedListener, options);\n }\n return __elementAddEventListener.call(this, type, listener, options);\n };\n }\n if (typeof globalThis.requestAnimationFrame !== \"undefined\") {\n const __requestAnimationFrame = globalThis.requestAnimationFrame;\n globalThis.requestAnimationFrame = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __requestAnimationFrame((time) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, time);\n });\n };\n }\n if (typeof globalThis.XMLHttpRequest !== \"undefined\") {\n const __XMLHttpRequest = globalThis.XMLHttpRequest;\n globalThis.XMLHttpRequest = class extends __XMLHttpRequest {\n constructor() {\n super();\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onreadystatechange\",\n \"onloadstart\",\n \"onprogress\",\n \"onabort\",\n \"onerror\",\n \"onload\",\n \"ontimeout\",\n \"onloadend\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.WebSocket !== \"undefined\") {\n const __WebSocket = globalThis.WebSocket;\n globalThis.WebSocket = class extends __WebSocket {\n constructor(url, protocols) {\n super(url, protocols);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onopen\",\n \"onmessage\",\n \"onerror\",\n \"onclose\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MutationObserver !== \"undefined\") {\n const __MutationObserver = globalThis.MutationObserver;\n globalThis.MutationObserver = class extends __MutationObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (mutations, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, mutations, observer);\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.ResizeObserver !== \"undefined\") {\n const __ResizeObserver = globalThis.ResizeObserver;\n globalThis.ResizeObserver = class extends __ResizeObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.IntersectionObserver !== \"undefined\") {\n const __IntersectionObserver = globalThis.IntersectionObserver;\n globalThis.IntersectionObserver = class extends __IntersectionObserver {\n constructor(callback, options) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback, options);\n }\n };\n }\n if (typeof globalThis.Worker !== \"undefined\") {\n const __Worker = globalThis.Worker;\n globalThis.Worker = class extends __Worker {\n constructor(scriptURL, options) {\n super(scriptURL, options);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onmessage\",\n \"onmessageerror\",\n \"onerror\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MessagePort !== \"undefined\") {\n const __MessagePort = globalThis.MessagePort;\n const createMessagePortWrapper = (originalPort) => {\n const _userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\"onmessage\", \"onmessageerror\"];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(originalPort, prop, {\n get: () => _userHandlers.get(prop) || null,\n set: (newHandler) => {\n _userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, wrappedHandler);\n }\n } else {\n const descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, null);\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n const originalAddEventListener = originalPort.addEventListener;\n originalPort.addEventListener = function(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return originalAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return originalAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return originalAddEventListener.call(this, type, wrappedListener, options);\n }\n return originalAddEventListener.call(this, type, listener, options);\n };\n return originalPort;\n };\n if (typeof globalThis.MessageChannel !== \"undefined\") {\n const __MessageChannel = globalThis.MessageChannel;\n globalThis.MessageChannel = class extends __MessageChannel {\n constructor() {\n super();\n createMessagePortWrapper(this.port1);\n createMessagePortWrapper(this.port2);\n }\n };\n }\n }\n};\nconst setLogicalContextValue = (key, value) => {\n prepare();\n if (value !== void 0) {\n currentLogicalContext.data.set(key, value);\n } else {\n currentLogicalContext.data.delete(key);\n }\n};\nconst getLogicalContextValue = (key) => {\n prepare();\n return currentLogicalContext.data.get(key);\n};\nconst runOnNewLogicalContext = (prefix, handler) => {\n const previousLogicalContext = currentLogicalContext;\n setCurrentLogicalContext(createLogicalContext(Symbol(`${prefix}-${crypto.randomUUID()}`)));\n try {\n return handler();\n } finally {\n setCurrentLogicalContext(previousLogicalContext);\n }\n};\nconst getCurrentLogicalContextId = () => {\n prepare();\n return currentLogicalContext.id;\n};\nconst createAsyncLocal = () => {\n const key = Symbol(`async-local-${crypto.randomUUID()}`);\n return {\n setValue: (value) => {\n setLogicalContextValue(key, value);\n },\n getValue: () => {\n return getLogicalContextValue(key);\n }\n };\n};\nexport {\n createAsyncLocal,\n createAsyncLock,\n createDeferred,\n createDeferredGenerator,\n createManuallySignal,\n createSignal,\n defer,\n delay,\n getCurrentLogicalContextId,\n getLogicalContextValue,\n onAbort,\n runOnNewLogicalContext,\n setLogicalContextValue\n};\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport type { Plugin } from 'vite';\nimport { readFile, writeFile, readdir, mkdir } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { createAsyncLock } from 'async-primitives';\nimport { resolvePackageMetadata, createConsoleLogger } from './internal';\nimport { ScrewUpOptions, PackageMetadata } from './types';\nimport { getFetchGitMetadata } from './analyzer';\nimport { git_commit_hash, name, version } from './generated/packageMetadata';\n\n/**\n * Generate banner string from package.json metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output in specified order\n * @returns Banner string\n */\nexport const generateBanner = (\n metadata: PackageMetadata,\n outputKeys: string[]\n): string => {\n const parts: string[] = [];\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n parts.push(`${key}: ${value}`);\n }\n }\n\n return parts.length > 0 ? `/*!\\n * ${parts.join('\\n * ')}\\n */` : '';\n};\n\n/**\n * Insert banner header at appropriate position considering shebang\n * @param content - The content to insert banner into\n * @param banner - The banner header to insert\n * @returns Content with banner header inserted\n */\nconst insertBannerHeader = (content: string, banner: string): string => {\n const lines = content.split('\\n');\n\n // Check if first line is shebang\n if (lines.length > 0 && lines[0].startsWith('#!')) {\n // Insert banner after shebang line\n return lines[0] + '\\n' + banner + '\\n' + lines.slice(1).join('\\n');\n } else {\n // Insert banner at the beginning\n return banner + '\\n' + content;\n }\n};\n\n/**\n * Convert string key to valid TypeScript identifier\n * @param key - The key to convert\n * @returns Valid TypeScript identifier\n */\nconst sanitizeKey = (key: string): string => {\n // Replace dots and other invalid characters with underscores\n return key.replace(/[^a-zA-Z0-9_]/g, '_').replace(/^(\\d)/, '_$1');\n};\n\n/**\n * Generate TypeScript metadata file content from package metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output\n * @returns TypeScript file content\n */\nconst generateMetadataFile = (\n metadata: PackageMetadata,\n outputKeys: string[]\n): string => {\n const lines: string[] = [];\n\n lines.push('// This file is auto-generated by screw-up plugin');\n lines.push('// Do not edit manually');\n lines.push('');\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n const sanitizedKey = sanitizeKey(key);\n const escapedValue = JSON.stringify(value);\n lines.push(`export const ${sanitizedKey} = ${escapedValue};`);\n }\n }\n\n lines.push('');\n\n return lines.join('\\n');\n};\n\n/**\n * Generate TypeScript type definition file content from output keys\n * @param outputKeys - Array of keys to output\n * @returns TypeScript type definition file content\n */\nconst generateMetadataTypeFile = (outputKeys: string[]): string => {\n const lines: string[] = [];\n\n lines.push('// This file is auto-generated by screw-up plugin');\n lines.push('// Do not edit manually');\n lines.push('');\n\n for (const key of outputKeys) {\n const sanitizedKey = sanitizeKey(key);\n lines.push(`export declare const ${sanitizedKey}: string;`);\n }\n\n lines.push('');\n\n return lines.join('\\n');\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Vite plugin that adds banner to the bundled code\n * @param options - Plugin options\n * @returns Vite plugin\n */\nexport const screwUp = (options: ScrewUpOptions = {}): Plugin => {\n const {\n outputKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n assetFilters = ['\\\\.d\\\\.ts$'],\n outputMetadataFile = false,\n outputMetadataFilePath = 'src/generated/packageMetadata.ts',\n outputMetadataFileTypePath,\n outputMetadataKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n checkWorkingDirectoryStatus = true,\n alwaysOverrideVersionFromGit = true,\n insertMetadataBanner = true,\n } = options;\n\n const assetFiltersRegex = assetFilters.map((filter) => new RegExp(filter));\n\n // Generate default type definition file path if not provided\n const resolvedOutputMetadataFileTypePath =\n outputMetadataFileTypePath ||\n outputMetadataFilePath.replace(/\\.ts$/, '.d.ts');\n const generateMetadataSourceLocker = createAsyncLock();\n\n const loggerPrefix = `${name}-vite`;\n let logger = createConsoleLogger(loggerPrefix);\n let banner: string;\n let metadata: any;\n let projectRoot: string;\n let fetchGitMetadata = () => Promise.resolve<any>({});\n\n // Helper function to write file if content has changed\n const writeFileIfChanged = async (\n filePath: string,\n content: string,\n description: string\n ): Promise<boolean> => {\n try {\n // Check if file exists and compare content\n let shouldWrite = !existsSync(filePath);\n if (!shouldWrite) {\n try {\n const existingContent = await readFile(filePath, 'utf-8');\n shouldWrite = existingContent !== content;\n } catch {\n // File doesn't exist or couldn't read, we should write it\n shouldWrite = true;\n }\n }\n\n if (shouldWrite) {\n // Ensure directory exists\n await mkdir(dirname(filePath), { recursive: true });\n // Write file only if content has changed\n await writeFile(filePath, content);\n return true;\n } else {\n // File content is the same, no need to write\n return false;\n }\n } catch (error) {\n logger.warn(`Failed to write ${description}: ${filePath}: ${error}`);\n return false;\n }\n };\n\n // Generate and write metadata TypeScript file\n const generateMetadataSourceFile = async () => {\n // Resolve package metadata\n const result = await resolvePackageMetadata(\n projectRoot,\n fetchGitMetadata,\n alwaysOverrideVersionFromGit,\n logger\n );\n metadata = result.metadata;\n // Regenerate banner with updated metadata\n banner = generateBanner(metadata, outputKeys);\n if (outputMetadataFile) {\n const metadataSourceContent = generateMetadataFile(\n metadata,\n outputMetadataKeys\n );\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n return await writeFileIfChanged(\n metadataSourcePath,\n metadataSourceContent,\n 'metadata source file'\n );\n }\n return false;\n };\n\n // Generate and write metadata TypeScript type definition file\n const generateMetadataTypeDefinitionFile = async () => {\n if (outputMetadataFile) {\n const metadataTypeContent = generateMetadataTypeFile(outputMetadataKeys);\n const metadataTypePath = join(\n projectRoot,\n resolvedOutputMetadataFileTypePath\n );\n return await writeFileIfChanged(\n metadataTypePath,\n metadataTypeContent,\n 'metadata type definition file'\n );\n }\n return false;\n };\n\n // Generate dummy metadata TypeScript file with empty string values\n const generateDummyMetadataFile = async () => {\n if (outputMetadataFile) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Only generate if file doesn't exist (don't overwrite existing files)\n if (!existsSync(metadataSourcePath)) {\n // Create dummy metadata with empty strings for all keys\n const dummyMetadata: any = {};\n outputMetadataKeys.forEach((key) => {\n dummyMetadata[key] = '[Require first build]';\n });\n const dummyContent = generateMetadataFile(\n dummyMetadata,\n outputMetadataKeys\n );\n return await writeFileIfChanged(\n metadataSourcePath,\n dummyContent,\n 'dummy metadata source file'\n );\n }\n }\n return false;\n };\n\n return {\n name: 'screw-up',\n // Ensure screw-up runs before other plugins\n // (especially vite-plugin-dts, avoid packageMetadata.ts is not found)\n enforce: 'pre',\n // Plugin starting\n applyToEnvironment: async (penv) => {\n logger.info(`${version}-${git_commit_hash}: Started.`);\n\n // Partial (but maybe exact) project root\n projectRoot = penv.config.root;\n\n // Generate type definition file early since it doesn't require actual metadata values\n if (projectRoot && (await generateMetadataTypeDefinitionFile())) {\n logger.info(\n `applyToEnvironment: Metadata type definition file is generated: ${resolvedOutputMetadataFileTypePath}`\n );\n }\n\n // Generate dummy metadata source file to prevent import errors on initial build\n if (projectRoot && (await generateDummyMetadataFile())) {\n logger.info(\n `applyToEnvironment: Dummy metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n\n return true;\n },\n // Configuration resolved phase\n configResolved: async (config) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`configResolved: Started.`);\n\n // Save project root\n projectRoot = config.root;\n if (config?.logger) {\n logger = createConsoleLogger(loggerPrefix, config.logger);\n } else if (config?.customLogger) {\n logger = createConsoleLogger(loggerPrefix, config.customLogger);\n }\n // Get Git metadata fetcher function\n fetchGitMetadata = getFetchGitMetadata(\n projectRoot,\n checkWorkingDirectoryStatus,\n logger\n );\n // Generate metadata TypeScript file early to ensure it's available during TypeScript compilation\n if (await generateMetadataSourceFile()) {\n logger.info(\n `configResolved: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configResolved: Exited.`);\n l.release();\n }\n },\n // Server hook\n configureServer: async (server) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`configureServer: Started.`);\n\n // Exclude generated metadata file from watcher to prevent infinite loop\n if (outputMetadataFile && server.watcher) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Use unwatch to exclude the file from being watched\n server.watcher.unwatch(metadataSourcePath);\n logger.debug(\n `configureServer: Excluded from watcher: ${outputMetadataFilePath}`\n );\n }\n\n if (await generateMetadataSourceFile()) {\n logger.info(\n `configureServer: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configureServer: Exited.`);\n l.release();\n }\n },\n // Build start phase\n buildStart: async () => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`buildStart: Started.`);\n // Re-resolve package metadata to capture any changes since configResolved\n // Update metadata TypeScript file with latest data\n if (await generateMetadataSourceFile()) {\n logger.info(\n `buildStart: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`buildStart: Exited.`);\n l.release();\n }\n },\n // Generate bundle phase\n generateBundle: (_options, bundle) => {\n // Add banner to each output file if enabled\n if (insertMetadataBanner) {\n let count = 0;\n for (const fileName in bundle) {\n const chunk = bundle[fileName];\n if (chunk.type === 'chunk') {\n chunk.code = insertBannerHeader(chunk.code, banner);\n count++;\n } else if (\n chunk.type === 'asset' &&\n assetFiltersRegex.some((filter) => filter.test(fileName))\n ) {\n if (typeof chunk.source === 'string') {\n chunk.source = insertBannerHeader(chunk.source, banner + '\\n'); // insert more blank line\n count++;\n }\n }\n }\n if (count >= 1) {\n logger.debug(\n `generateBundle: Banner header inserted: ${count} file(s)`\n );\n }\n }\n },\n // Write bundle phase\n writeBundle: async (options) => {\n // Handle files written by other plugins (like vite-plugin-dts) if banner insertion is enabled\n if (!insertMetadataBanner || !options.dir) return;\n\n try {\n // Read all files in the output directory\n const files = await readdir(options.dir, { recursive: true });\n\n // Iterate over all files\n let count = 0;\n for (const file of files) {\n const filePath = join(options.dir, file);\n\n // Check if the file is target asset file\n if (assetFiltersRegex.some((filter) => filter.test(file))) {\n try {\n // Read the asset file\n const content = await readFile(filePath, 'utf-8');\n // Append banner to the asset file if it doesn't already contain it\n if (!content.includes(banner)) {\n await writeFile(\n filePath,\n insertBannerHeader(content, banner + '\\n')\n );\n count++;\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n }\n }\n if (count >= 1) {\n logger.debug(`writeBundle: Banner header inserted: ${count} file(s)`);\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n },\n };\n};\n"],"names":["name","createConsoleLogger","existsSync","readFile","mkdir","dirname","writeFile","resolvePackageMetadata","join","version","git_commit_hash","getFetchGitMetadata","options","readdir"],"mappings":";;;;;AAAA,MAAM,iBAAiB,MAAM;AAC7B;AACA,MAAM,oBAAoB;AAAA,EACxB,SAAS;AAAA,EACT,CAAC,OAAO,OAAO,GAAG;AACpB;AACA,MAAM,UAAU,CAAC,QAAQ,aAAa;AACpC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS;AAClB,QAAI;AACF,eAAQ;AAAA,IACV,SAAS,OAAO;AACd,cAAQ,KAAK,8BAA8B,KAAK;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,iBAAe,MAAM;AACnB,QAAI,cAAc;AAChB,aAAO,oBAAoB,SAAS,YAAY;AAChD,qBAAe;AACf,UAAI;AACF,iBAAQ;AAAA,MACV,SAAS,OAAO;AACd,gBAAQ,KAAK,8BAA8B,KAAK;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU,MAAM;AACpB,QAAI,cAAc;AAChB,aAAO,oBAAoB,SAAS,YAAY;AAChD,qBAAe;AAAA,IACjB;AAAA,EACF;AACA,SAAO,iBAAiB,SAAS,cAAc,EAAE,MAAM,MAAM;AAC7D,QAAM,SAAS;AAAA,IACb;AAAA,IACA,CAAC,OAAO,OAAO,GAAG;AAAA,EACtB;AACE,SAAO;AACT;AAsBA,MAAM,QAAQ,CAAC,OAAO;AACpB,MAAI,OAAO,iBAAiB,YAAY;AACtC,iBAAa,EAAE;AAAA,EACjB,OAAO;AACL,eAAW,IAAI,CAAC;AAAA,EAClB;AACF;AACA,MAAM,gBAAgB,MAAM,IAAI,MAAM,8BAA8B;AACpE,MAAM,mBAAmB,CAAC,oBAAoB;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;AAAA,MAEhB;AAAA,IACF;AAAA,EAAA;AAEJ;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../node_modules/async-primitives/dist/index.js","../src/vite-plugin.ts"],"sourcesContent":["/*!\n * name: async-primitives\n * version: 1.0.0\n * description: A collection of primitive functions for asynchronous operations\n * author: Kouji Matsui (@kekyo@mi.kekyo.net)\n * license: MIT\n * repository.url: https://github.com/kekyo/async-primitives.git\n * git.commit.hash: 87c2c54e1ee681110dd8e9e0466ee12c15f5557c\n */\nconst __NOOP_HANDLER = () => {\n};\nconst __NOOP_RELEASABLE = {\n release: __NOOP_HANDLER,\n [Symbol.dispose]: __NOOP_HANDLER\n};\nconst onAbort = (signal, callback) => {\n if (!signal) {\n return __NOOP_RELEASABLE;\n }\n if (signal.aborted) {\n try {\n callback();\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n return __NOOP_RELEASABLE;\n }\n let abortHandler;\n abortHandler = () => {\n if (abortHandler) {\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n try {\n callback();\n } catch (error) {\n console.warn(\"AbortHook callback error: \", error);\n }\n }\n };\n const release = () => {\n if (abortHandler) {\n signal.removeEventListener(\"abort\", abortHandler);\n abortHandler = void 0;\n }\n };\n signal.addEventListener(\"abort\", abortHandler, { once: true });\n const handle = {\n release,\n [Symbol.dispose]: release\n };\n return handle;\n};\nconst delay = (msec, signal) => {\n if (signal) {\n if (signal.aborted) {\n throw new Error(\"Delay was aborted\");\n }\n return new Promise((resolve, reject) => {\n const abortHandle = onAbort(signal, () => {\n clearTimeout(timeoutId);\n reject(new Error(\"Delay was aborted\"));\n });\n const timeoutId = setTimeout(() => {\n abortHandle.release();\n resolve();\n }, msec);\n });\n } else {\n return new Promise((resolve) => {\n setTimeout(resolve, msec);\n });\n }\n};\nconst defer = (fn) => {\n if (typeof setImmediate === \"function\") {\n setImmediate(fn);\n } else {\n setTimeout(fn, 0);\n }\n};\nconst ABORTED_ERROR$2 = () => new Error(\"Lock acquisition was aborted\");\nconst createLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createMutex = (maxConsecutiveCalls = 20) => {\n let isLocked = false;\n const queue = [];\n let count = 0;\n const processQueue = () => {\n var _a;\n if (isLocked || queue.length === 0) {\n return;\n }\n const item = queue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR$2());\n scheduleNextProcess();\n return;\n }\n isLocked = true;\n const lockHandle = createLockHandle(releaseLock);\n item.resolve(lockHandle);\n };\n const scheduleNextProcess = () => {\n count++;\n if (count >= maxConsecutiveCalls) {\n count = 0;\n defer(processQueue);\n } else {\n processQueue();\n }\n };\n const releaseLock = () => {\n if (!isLocked) {\n return;\n }\n isLocked = false;\n scheduleNextProcess();\n };\n const removeFromQueue = (item) => {\n const index = queue.indexOf(item);\n if (index !== -1) {\n queue.splice(index, 1);\n }\n };\n const lock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR$2();\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromQueue(queueItem);\n reject(ABORTED_ERROR$2());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n queue.push(queueItem);\n processQueue();\n });\n } else {\n return new Promise((resolve, reject) => {\n queue.push({\n resolve,\n reject\n });\n processQueue();\n });\n }\n };\n return {\n lock,\n get isLocked() {\n return isLocked;\n },\n get pendingCount() {\n return queue.length;\n }\n };\n};\nconst createDeferred = (signal) => {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n const disposer = onAbort(signal, () => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n _reject(new Error(\"Deferred aborted\"));\n }\n });\n return {\n // The promise that resolves to the result\n promise,\n // Resolve the promise with a result\n resolve: (value) => {\n const _resolve = resolve;\n if (_resolve) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _resolve(value);\n }\n },\n // Reject the promise with an error\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reject: (error) => {\n const _reject = reject;\n if (_reject) {\n resolve = void 0;\n reject = void 0;\n disposer.release();\n _reject(error);\n }\n }\n };\n};\nconst createConditional = () => {\n const waiters = [];\n return {\n trigger: () => {\n if (waiters.length >= 1) {\n waiters.shift().resolve();\n }\n },\n wait: async (signal) => {\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Conditional aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Conditional aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n }\n };\n};\nconst createManuallyConditional = (initialState) => {\n const waiters = [];\n let raised = initialState != null ? initialState : false;\n return {\n trigger: () => {\n raised = false;\n const waiter = waiters.shift();\n if (waiter) {\n waiter.resolve();\n raised = false;\n }\n },\n raise: () => {\n while (waiters.length >= 1) {\n raised = true;\n waiters.shift().resolve();\n }\n raised = true;\n },\n drop: () => {\n raised = false;\n },\n wait: async (signal) => {\n if (raised) {\n return;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Conditional aborted\");\n }\n const waiter = createDeferred();\n waiters.push(waiter);\n const disposer = onAbort(signal, () => {\n waiters.splice(waiters.indexOf(waiter), 1);\n waiter.reject(new Error(\"Conditional aborted\"));\n });\n try {\n await waiter.promise;\n } finally {\n disposer.release();\n }\n }\n };\n};\nconst createDeferredGenerator = (options) => {\n const maxItemReserved = options == null ? void 0 : options.maxItemReserved;\n const signal = options == null ? void 0 : options.signal;\n const queue = [];\n const arrived = createManuallyConditional();\n const canReserve = maxItemReserved ? createManuallyConditional(true) : void 0;\n const generator = (async function* () {\n while (true) {\n while (true) {\n const item = queue.shift();\n if (maxItemReserved && queue.length === maxItemReserved - 1) {\n canReserve.raise();\n }\n if (!item) {\n break;\n }\n switch (item.kind) {\n // Yield return a value\n case \"value\":\n yield item.value;\n break;\n // Completed, exit the generator\n case \"completed\":\n return;\n // Error, throw an error\n case \"error\":\n throw item.error;\n }\n if (signal == null ? void 0 : signal.aborted) {\n throw new Error(\"Deferred generator aborted\");\n }\n }\n arrived.drop();\n try {\n await arrived.wait(signal);\n } catch (error) {\n if (error instanceof Error && error.message === \"Conditional aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n })();\n const enqueue = async (item, signal2) => {\n while (true) {\n if (!maxItemReserved || queue.length < maxItemReserved) {\n const remains = queue.push(item);\n if (remains === 1) {\n arrived.raise();\n }\n if (remains === maxItemReserved) {\n canReserve.drop();\n }\n break;\n }\n try {\n await canReserve.wait(signal2);\n } catch (error) {\n if (error instanceof Error && error.message === \"Conditional aborted\") {\n error.message = \"Deferred generator aborted\";\n }\n throw error;\n }\n }\n };\n return {\n // The async generator that yields values\n generator,\n // Yield a value to the generator\n yield: (value, signal2) => enqueue({ kind: \"value\", value }, signal2),\n // Complete the generator (equivalent to return)\n return: (signal2) => enqueue({ kind: \"completed\" }, signal2),\n // Throw an error to the generator\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n throw: (error, signal2) => enqueue({ kind: \"error\", error }, signal2)\n };\n};\nconst createLogicalContext = (id) => {\n return { id, data: /* @__PURE__ */ new Map() };\n};\nlet currentLogicalContext = createLogicalContext(Symbol(\"[root]\"));\nconst setCurrentLogicalContext = (context) => {\n currentLogicalContext = context;\n};\nconst trampoline = (adjustment, callback, thisArg, ...args) => {\n const previousLogicalContext = currentLogicalContext;\n currentLogicalContext = adjustment.contextToUse;\n try {\n return callback.call(thisArg, ...args);\n } finally {\n adjustment.contextAfter = currentLogicalContext;\n currentLogicalContext = previousLogicalContext;\n }\n};\nlet isPrepared = false;\nconst prepare = () => {\n if (isPrepared) {\n return;\n }\n isPrepared = true;\n if (typeof globalThis.setTimeout !== \"undefined\") {\n const __setTimeout = globalThis.setTimeout;\n globalThis.setTimeout = ((handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setTimeout(\n (...args2) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n });\n }\n if (typeof globalThis.setInterval !== \"undefined\") {\n const __setInterval = globalThis.setInterval;\n globalThis.setInterval = ((handler, timeout, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setInterval(\n (...args2) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, handler, void 0, ...args2);\n },\n timeout,\n ...args\n );\n });\n }\n if (typeof globalThis.queueMicrotask !== \"undefined\") {\n const __queueMicrotask = globalThis.queueMicrotask;\n globalThis.queueMicrotask = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __queueMicrotask(() => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0);\n });\n };\n }\n if (typeof globalThis.setImmediate !== \"undefined\") {\n const __setImmediate = globalThis.setImmediate;\n globalThis.setImmediate = ((callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __setImmediate((...callbackArgs) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0, ...callbackArgs);\n }, ...args);\n });\n }\n if (typeof process !== \"undefined\" && process.nextTick) {\n const __nextTick = process.nextTick;\n process.nextTick = (callback, ...args) => {\n const capturedLogicalContext = currentLogicalContext;\n return __nextTick(() => {\n const adjustment = { contextToUse: capturedLogicalContext };\n trampoline(adjustment, callback, void 0, ...args);\n });\n };\n }\n if (typeof Promise !== \"undefined\") {\n const __then = Promise.prototype.then;\n const __catch = Promise.prototype.catch;\n const __finally = Promise.prototype.finally;\n Promise.prototype.then = function(onFulfilled, onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __then.call(\n this,\n onFulfilled ? (value) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onFulfilled, void 0, value);\n } : void 0,\n onRejected ? (reason) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.catch = function(onRejected) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __catch.call(\n this,\n onRejected ? (reason) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onRejected, void 0, reason);\n } : void 0\n );\n return resultPromise;\n };\n Promise.prototype.finally = function(onFinally) {\n const capturedLogicalContext = currentLogicalContext;\n const resultPromise = __finally.call(\n this,\n onFinally ? () => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, onFinally, void 0);\n } : void 0\n );\n return resultPromise;\n };\n }\n if (typeof EventTarget !== \"undefined\" && EventTarget.prototype && EventTarget.prototype.addEventListener) {\n const __eventTargetAddEventListener = EventTarget.prototype.addEventListener;\n EventTarget.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __eventTargetAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __eventTargetAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __eventTargetAddEventListener.call(this, type, wrappedListener, options);\n }\n return __eventTargetAddEventListener.call(this, type, listener, options);\n };\n }\n if (typeof Element !== \"undefined\" && Element.prototype && Element.prototype.addEventListener) {\n const __elementAddEventListener = Element.prototype.addEventListener;\n Element.prototype.addEventListener = function(type, listener, options) {\n if (listener === null || listener === void 0) {\n return __elementAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return __elementAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return __elementAddEventListener.call(this, type, wrappedListener, options);\n }\n return __elementAddEventListener.call(this, type, listener, options);\n };\n }\n if (typeof globalThis.requestAnimationFrame !== \"undefined\") {\n const __requestAnimationFrame = globalThis.requestAnimationFrame;\n globalThis.requestAnimationFrame = (callback) => {\n const capturedLogicalContext = currentLogicalContext;\n return __requestAnimationFrame((time) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, time);\n });\n };\n }\n if (typeof globalThis.XMLHttpRequest !== \"undefined\") {\n const __XMLHttpRequest = globalThis.XMLHttpRequest;\n globalThis.XMLHttpRequest = class extends __XMLHttpRequest {\n constructor() {\n super();\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onreadystatechange\",\n \"onloadstart\",\n \"onprogress\",\n \"onabort\",\n \"onerror\",\n \"onload\",\n \"ontimeout\",\n \"onloadend\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.WebSocket !== \"undefined\") {\n const __WebSocket = globalThis.WebSocket;\n globalThis.WebSocket = class extends __WebSocket {\n constructor(url, protocols) {\n super(url, protocols);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onopen\",\n \"onmessage\",\n \"onerror\",\n \"onclose\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MutationObserver !== \"undefined\") {\n const __MutationObserver = globalThis.MutationObserver;\n globalThis.MutationObserver = class extends __MutationObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (mutations, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, mutations, observer);\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.ResizeObserver !== \"undefined\") {\n const __ResizeObserver = globalThis.ResizeObserver;\n globalThis.ResizeObserver = class extends __ResizeObserver {\n constructor(callback) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback);\n }\n };\n }\n if (typeof globalThis.IntersectionObserver !== \"undefined\") {\n const __IntersectionObserver = globalThis.IntersectionObserver;\n globalThis.IntersectionObserver = class extends __IntersectionObserver {\n constructor(callback, options) {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedCallback = (entries, observer) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, callback, void 0, entries, observer);\n };\n super(wrappedCallback, options);\n }\n };\n }\n if (typeof globalThis.Worker !== \"undefined\") {\n const __Worker = globalThis.Worker;\n globalThis.Worker = class extends __Worker {\n constructor(scriptURL, options) {\n super(scriptURL, options);\n this._userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\n \"onmessage\",\n \"onmessageerror\",\n \"onerror\"\n ];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(this, prop, {\n get: () => this._userHandlers.get(prop) || null,\n set: (newHandler) => {\n this._userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, wrappedHandler);\n } else {\n this[`_${prop}`] = wrappedHandler;\n }\n } else {\n const parentProto = Object.getPrototypeOf(Object.getPrototypeOf(this));\n const descriptor = Object.getOwnPropertyDescriptor(parentProto, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(this, null);\n } else {\n this[`_${prop}`] = null;\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n }\n addEventListener(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return super.addEventListener(type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return super.addEventListener(type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return super.addEventListener(type, wrappedListener, options);\n }\n return super.addEventListener(type, listener, options);\n }\n };\n }\n if (typeof globalThis.MessagePort !== \"undefined\") {\n const __MessagePort = globalThis.MessagePort;\n const createMessagePortWrapper = (originalPort) => {\n const _userHandlers = /* @__PURE__ */ new Map();\n const eventHandlerProperties = [\"onmessage\", \"onmessageerror\"];\n eventHandlerProperties.forEach((prop) => {\n Object.defineProperty(originalPort, prop, {\n get: () => _userHandlers.get(prop) || null,\n set: (newHandler) => {\n _userHandlers.set(prop, newHandler);\n if (newHandler && typeof newHandler === \"function\") {\n const capturedLogicalContext = currentLogicalContext;\n const wrappedHandler = function(event) {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, newHandler, this, event);\n };\n const descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, wrappedHandler);\n }\n } else {\n const descriptor = Object.getOwnPropertyDescriptor(__MessagePort.prototype, prop);\n if (descriptor && descriptor.set) {\n descriptor.set.call(originalPort, null);\n }\n }\n },\n configurable: true,\n enumerable: true\n });\n });\n const originalAddEventListener = originalPort.addEventListener;\n originalPort.addEventListener = function(type, listener, options) {\n const capturedLogicalContext = currentLogicalContext;\n if (!listener) {\n return originalAddEventListener.call(this, type, listener, options);\n }\n if (typeof listener === \"function\") {\n const wrappedListener = (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, listener, event.currentTarget, event);\n };\n return originalAddEventListener.call(this, type, wrappedListener, options);\n } else if (typeof listener === \"object\" && \"handleEvent\" in listener) {\n const wrappedListener = {\n handleEvent: (event) => {\n const adjustment = { contextToUse: capturedLogicalContext };\n return trampoline(adjustment, () => listener.handleEvent(event));\n }\n };\n return originalAddEventListener.call(this, type, wrappedListener, options);\n }\n return originalAddEventListener.call(this, type, listener, options);\n };\n return originalPort;\n };\n if (typeof globalThis.MessageChannel !== \"undefined\") {\n const __MessageChannel = globalThis.MessageChannel;\n globalThis.MessageChannel = class extends __MessageChannel {\n constructor() {\n super();\n createMessagePortWrapper(this.port1);\n createMessagePortWrapper(this.port2);\n }\n };\n }\n }\n};\nconst setLogicalContextValue = (key, value) => {\n prepare();\n if (value !== void 0) {\n currentLogicalContext.data.set(key, value);\n } else {\n currentLogicalContext.data.delete(key);\n }\n};\nconst getLogicalContextValue = (key) => {\n prepare();\n return currentLogicalContext.data.get(key);\n};\nconst runOnNewLogicalContext = (prefix, handler) => {\n const previousLogicalContext = currentLogicalContext;\n setCurrentLogicalContext(createLogicalContext(Symbol(`${prefix}-${crypto.randomUUID()}`)));\n try {\n return handler();\n } finally {\n setCurrentLogicalContext(previousLogicalContext);\n }\n};\nconst getCurrentLogicalContextId = () => {\n prepare();\n return currentLogicalContext.id;\n};\nconst createAsyncLocal = () => {\n const key = Symbol(`async-local-${crypto.randomUUID()}`);\n return {\n setValue: (value) => {\n setLogicalContextValue(key, value);\n },\n getValue: () => {\n return getLogicalContextValue(key);\n }\n };\n};\nconst ABORTED_ERROR$1 = () => new Error(\"Semaphore acquisition was aborted\");\nconst INVALID_COUNT_ERROR = () => new Error(\"Semaphore count must be greater than 0\");\nconst createSemaphoreHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createSemaphore = (count, maxConsecutiveCalls = 20) => {\n if (count < 1) {\n throw INVALID_COUNT_ERROR();\n }\n let availableCount = count;\n const queue = [];\n let consecutiveCallCount = 0;\n const processQueue = () => {\n var _a;\n while (availableCount > 0 && queue.length > 0) {\n const item = queue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR$1());\n continue;\n }\n availableCount--;\n const semaphoreHandle = createSemaphoreHandle(releaseSemaphore);\n item.resolve(semaphoreHandle);\n }\n };\n const scheduleNextProcess = () => {\n consecutiveCallCount++;\n if (consecutiveCallCount >= maxConsecutiveCalls) {\n consecutiveCallCount = 0;\n defer(processQueue);\n } else {\n processQueue();\n }\n };\n const releaseSemaphore = () => {\n availableCount++;\n scheduleNextProcess();\n };\n const removeFromQueue = (item) => {\n const index = queue.indexOf(item);\n if (index !== -1) {\n queue.splice(index, 1);\n }\n };\n const acquire = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR$1();\n }\n if (availableCount > 0) {\n availableCount--;\n return createSemaphoreHandle(releaseSemaphore);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromQueue(queueItem);\n reject(ABORTED_ERROR$1());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n queue.push(queueItem);\n processQueue();\n });\n } else {\n if (availableCount > 0) {\n availableCount--;\n return createSemaphoreHandle(releaseSemaphore);\n }\n return new Promise((resolve, reject) => {\n queue.push({\n resolve,\n reject\n });\n processQueue();\n });\n }\n };\n return {\n acquire,\n get availableCount() {\n return availableCount;\n },\n get pendingCount() {\n return queue.length;\n }\n };\n};\nconst ABORTED_ERROR = () => new Error(\"Lock acquisition was aborted\");\nconst createReadLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createWriteLockHandle = (releaseCallback) => {\n let isActive = true;\n const release = () => {\n if (!isActive) {\n return;\n }\n isActive = false;\n releaseCallback();\n };\n return {\n get isActive() {\n return isActive;\n },\n release,\n [Symbol.dispose]: release\n };\n};\nconst createReaderWriterLock = (maxConsecutiveCalls = 20) => {\n let currentReaders = 0;\n let hasWriter = false;\n const readQueue = [];\n const writeQueue = [];\n let consecutiveCallCount = 0;\n const processQueues = () => {\n var _a, _b;\n if (!hasWriter && currentReaders === 0 && writeQueue.length > 0) {\n const item = writeQueue.shift();\n if ((_a = item.signal) == null ? void 0 : _a.aborted) {\n item.reject(ABORTED_ERROR());\n scheduleNextProcess();\n return;\n }\n hasWriter = true;\n const writeLockHandle = createWriteLockHandle(releaseWriteLock);\n item.resolve(writeLockHandle);\n } else if (!hasWriter && writeQueue.length === 0 && readQueue.length > 0) {\n const readersToProcess = [];\n while (readQueue.length > 0) {\n const item = readQueue.shift();\n if ((_b = item.signal) == null ? void 0 : _b.aborted) {\n item.reject(ABORTED_ERROR());\n } else {\n readersToProcess.push(item);\n }\n }\n for (const item of readersToProcess) {\n currentReaders++;\n const readLockHandle = createReadLockHandle(releaseReadLock);\n item.resolve(readLockHandle);\n }\n }\n };\n const scheduleNextProcess = () => {\n consecutiveCallCount++;\n if (consecutiveCallCount >= maxConsecutiveCalls) {\n consecutiveCallCount = 0;\n defer(processQueues);\n } else {\n processQueues();\n }\n };\n const releaseReadLock = () => {\n if (currentReaders > 0) {\n currentReaders--;\n if (currentReaders === 0) {\n scheduleNextProcess();\n }\n }\n };\n const releaseWriteLock = () => {\n if (hasWriter) {\n hasWriter = false;\n scheduleNextProcess();\n }\n };\n const removeFromReadQueue = (item) => {\n const index = readQueue.indexOf(item);\n if (index !== -1) {\n readQueue.splice(index, 1);\n }\n };\n const removeFromWriteQueue = (item) => {\n const index = writeQueue.indexOf(item);\n if (index !== -1) {\n writeQueue.splice(index, 1);\n }\n };\n const readLock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR();\n }\n if (!hasWriter && writeQueue.length === 0) {\n currentReaders++;\n return createReadLockHandle(releaseReadLock);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromReadQueue(queueItem);\n reject(ABORTED_ERROR());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n readQueue.push(queueItem);\n processQueues();\n });\n } else {\n if (!hasWriter && writeQueue.length === 0) {\n currentReaders++;\n return createReadLockHandle(releaseReadLock);\n }\n return new Promise((resolve, reject) => {\n readQueue.push({\n resolve,\n reject\n });\n processQueues();\n });\n }\n };\n const writeLock = async (signal) => {\n if (signal) {\n if (signal.aborted) {\n throw ABORTED_ERROR();\n }\n if (!hasWriter && currentReaders === 0) {\n hasWriter = true;\n return createWriteLockHandle(releaseWriteLock);\n }\n return new Promise((resolve, reject) => {\n const queueItem = {\n resolve: void 0,\n reject: void 0,\n signal\n };\n const abortHandle = onAbort(signal, () => {\n removeFromWriteQueue(queueItem);\n reject(ABORTED_ERROR());\n });\n queueItem.resolve = (handle) => {\n abortHandle.release();\n resolve(handle);\n };\n queueItem.reject = (error) => {\n abortHandle.release();\n reject(error);\n };\n writeQueue.push(queueItem);\n processQueues();\n });\n } else {\n if (!hasWriter && currentReaders === 0) {\n hasWriter = true;\n return createWriteLockHandle(releaseWriteLock);\n }\n return new Promise((resolve, reject) => {\n writeQueue.push({\n resolve,\n reject\n });\n processQueues();\n });\n }\n };\n return {\n readLock,\n writeLock,\n get currentReaders() {\n return currentReaders;\n },\n get hasWriter() {\n return hasWriter;\n },\n get pendingReadersCount() {\n return readQueue.length;\n },\n get pendingWritersCount() {\n return writeQueue.length;\n }\n };\n};\nexport {\n createAsyncLocal,\n createMutex as createAsyncLock,\n createConditional,\n createDeferred,\n createDeferredGenerator,\n createManuallyConditional,\n createManuallyConditional as createManuallySignal,\n createMutex,\n createReaderWriterLock,\n createSemaphore,\n createConditional as createSignal,\n defer,\n delay,\n getCurrentLogicalContextId,\n getLogicalContextValue,\n onAbort,\n runOnNewLogicalContext,\n setLogicalContextValue\n};\n//# sourceMappingURL=index.js.map\n","// screw-up - Easy package metadata inserter on Vite plugin\n// Copyright (c) Kouji Matsui (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/screw-up/\n\nimport type { Plugin } from 'vite';\nimport { readFile, writeFile, readdir, mkdir } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { createMutex } from 'async-primitives';\nimport { resolvePackageMetadata, createConsoleLogger } from './internal';\nimport { ScrewUpOptions, PackageMetadata } from './types';\nimport { getFetchGitMetadata } from './analyzer';\nimport { git_commit_hash, name, version } from './generated/packageMetadata';\n\n/**\n * Generate banner string from package.json metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output in specified order\n * @returns Banner string\n */\nexport const generateBanner = (\n metadata: PackageMetadata,\n outputKeys: string[]\n): string => {\n const parts: string[] = [];\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n parts.push(`${key}: ${value}`);\n }\n }\n\n return parts.length > 0 ? `/*!\\n * ${parts.join('\\n * ')}\\n */` : '';\n};\n\n/**\n * Insert banner header at appropriate position considering shebang\n * @param content - The content to insert banner into\n * @param banner - The banner header to insert\n * @returns Content with banner header inserted\n */\nconst insertBannerHeader = (content: string, banner: string): string => {\n const lines = content.split('\\n');\n\n // Check if first line is shebang\n if (lines.length > 0 && lines[0].startsWith('#!')) {\n // Insert banner after shebang line\n return lines[0] + '\\n' + banner + '\\n' + lines.slice(1).join('\\n');\n } else {\n // Insert banner at the beginning\n return banner + '\\n' + content;\n }\n};\n\n/**\n * Convert string key to valid TypeScript identifier\n * @param key - The key to convert\n * @returns Valid TypeScript identifier\n */\nconst sanitizeKey = (key: string): string => {\n // Replace dots and other invalid characters with underscores\n return key.replace(/[^a-zA-Z0-9_]/g, '_').replace(/^(\\d)/, '_$1');\n};\n\n/**\n * Generate TypeScript metadata file content from package metadata\n * @param metadata - Package metadata\n * @param outputKeys - Array of keys to output\n * @returns TypeScript file content\n */\nconst generateMetadataFile = (\n metadata: PackageMetadata,\n outputKeys: string[]\n): string => {\n const lines: string[] = [];\n\n lines.push('// This file is auto-generated by screw-up plugin');\n lines.push('// Do not edit manually');\n lines.push('');\n\n for (const key of outputKeys) {\n const value = metadata[key];\n if (value) {\n const sanitizedKey = sanitizeKey(key);\n const escapedValue = JSON.stringify(value);\n lines.push(`export const ${sanitizedKey} = ${escapedValue};`);\n }\n }\n\n lines.push('');\n\n return lines.join('\\n');\n};\n\n/**\n * Generate TypeScript type definition file content from output keys\n * @param outputKeys - Array of keys to output\n * @returns TypeScript type definition file content\n */\nconst generateMetadataTypeFile = (outputKeys: string[]): string => {\n const lines: string[] = [];\n\n lines.push('// This file is auto-generated by screw-up plugin');\n lines.push('// Do not edit manually');\n lines.push('');\n\n for (const key of outputKeys) {\n const sanitizedKey = sanitizeKey(key);\n lines.push(`export declare const ${sanitizedKey}: string;`);\n }\n\n lines.push('');\n\n return lines.join('\\n');\n};\n\n/////////////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Vite plugin that adds banner to the bundled code\n * @param options - Plugin options\n * @returns Vite plugin\n */\nexport const screwUp = (options: ScrewUpOptions = {}): Plugin => {\n const {\n outputKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n assetFilters = ['\\\\.d\\\\.ts$'],\n outputMetadataFile = false,\n outputMetadataFilePath = 'src/generated/packageMetadata.ts',\n outputMetadataFileTypePath,\n outputMetadataKeys = [\n 'name',\n 'version',\n 'description',\n 'author',\n 'license',\n 'repository.url',\n 'git.commit.hash',\n ],\n checkWorkingDirectoryStatus = true,\n alwaysOverrideVersionFromGit = true,\n insertMetadataBanner = true,\n } = options;\n\n const assetFiltersRegex = assetFilters.map((filter) => new RegExp(filter));\n\n // Generate default type definition file path if not provided\n const resolvedOutputMetadataFileTypePath =\n outputMetadataFileTypePath ||\n outputMetadataFilePath.replace(/\\.ts$/, '.d.ts');\n const generateMetadataSourceLocker = createMutex();\n\n const loggerPrefix = `${name}-vite`;\n let logger = createConsoleLogger(loggerPrefix);\n let banner: string;\n let metadata: any;\n let projectRoot: string;\n let fetchGitMetadata = () => Promise.resolve<any>({});\n\n // Helper function to write file if content has changed\n const writeFileIfChanged = async (\n filePath: string,\n content: string,\n description: string\n ): Promise<boolean> => {\n try {\n // Check if file exists and compare content\n let shouldWrite = !existsSync(filePath);\n if (!shouldWrite) {\n try {\n const existingContent = await readFile(filePath, 'utf-8');\n shouldWrite = existingContent !== content;\n } catch {\n // File doesn't exist or couldn't read, we should write it\n shouldWrite = true;\n }\n }\n\n if (shouldWrite) {\n // Ensure directory exists\n await mkdir(dirname(filePath), { recursive: true });\n // Write file only if content has changed\n await writeFile(filePath, content);\n return true;\n } else {\n // File content is the same, no need to write\n return false;\n }\n } catch (error) {\n logger.warn(`Failed to write ${description}: ${filePath}: ${error}`);\n return false;\n }\n };\n\n // Generate and write metadata TypeScript file\n const generateMetadataSourceFile = async () => {\n // Resolve package metadata\n const result = await resolvePackageMetadata(\n projectRoot,\n fetchGitMetadata,\n alwaysOverrideVersionFromGit,\n logger\n );\n metadata = result.metadata;\n // Regenerate banner with updated metadata\n banner = generateBanner(metadata, outputKeys);\n if (outputMetadataFile) {\n const metadataSourceContent = generateMetadataFile(\n metadata,\n outputMetadataKeys\n );\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n return await writeFileIfChanged(\n metadataSourcePath,\n metadataSourceContent,\n 'metadata source file'\n );\n }\n return false;\n };\n\n // Generate and write metadata TypeScript type definition file\n const generateMetadataTypeDefinitionFile = async () => {\n if (outputMetadataFile) {\n const metadataTypeContent = generateMetadataTypeFile(outputMetadataKeys);\n const metadataTypePath = join(\n projectRoot,\n resolvedOutputMetadataFileTypePath\n );\n return await writeFileIfChanged(\n metadataTypePath,\n metadataTypeContent,\n 'metadata type definition file'\n );\n }\n return false;\n };\n\n // Generate dummy metadata TypeScript file with empty string values\n const generateDummyMetadataFile = async () => {\n if (outputMetadataFile) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Only generate if file doesn't exist (don't overwrite existing files)\n if (!existsSync(metadataSourcePath)) {\n // Create dummy metadata with empty strings for all keys\n const dummyMetadata: any = {};\n outputMetadataKeys.forEach((key) => {\n dummyMetadata[key] = '[Require first build]';\n });\n const dummyContent = generateMetadataFile(\n dummyMetadata,\n outputMetadataKeys\n );\n return await writeFileIfChanged(\n metadataSourcePath,\n dummyContent,\n 'dummy metadata source file'\n );\n }\n }\n return false;\n };\n\n return {\n name: 'screw-up',\n // Ensure screw-up runs before other plugins\n // (especially vite-plugin-dts, avoid packageMetadata.ts is not found)\n enforce: 'pre',\n // Plugin starting\n applyToEnvironment: async (penv) => {\n logger.info(`${version}-${git_commit_hash}: Started.`);\n\n // Partial (but maybe exact) project root\n projectRoot = penv.config.root;\n\n // Generate type definition file early since it doesn't require actual metadata values\n if (projectRoot && (await generateMetadataTypeDefinitionFile())) {\n logger.info(\n `applyToEnvironment: Metadata type definition file is generated: ${resolvedOutputMetadataFileTypePath}`\n );\n }\n\n // Generate dummy metadata source file to prevent import errors on initial build\n if (projectRoot && (await generateDummyMetadataFile())) {\n logger.info(\n `applyToEnvironment: Dummy metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n\n return true;\n },\n // Configuration resolved phase\n configResolved: async (config) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n // Enable debug logging for performance analysis\n const tempEnableLogging = true;\n\n // Save project root\n projectRoot = config.root;\n if (tempEnableLogging || config?.logger) {\n logger = createConsoleLogger(loggerPrefix, config.logger);\n } else if (config?.customLogger) {\n logger = createConsoleLogger(loggerPrefix, config.customLogger);\n }\n\n logger.debug(`configResolved: Started.`);\n // Get Git metadata fetcher function\n fetchGitMetadata = getFetchGitMetadata(\n projectRoot,\n checkWorkingDirectoryStatus,\n logger\n );\n // Generate metadata TypeScript file early to ensure it's available during TypeScript compilation\n if (await generateMetadataSourceFile()) {\n logger.info(\n `configResolved: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configResolved: Exited.`);\n l.release();\n }\n },\n // Server hook\n configureServer: async (server) => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`configureServer: Started.`);\n\n // Exclude generated metadata file from watcher to prevent infinite loop\n if (outputMetadataFile && server.watcher) {\n const metadataSourcePath = join(projectRoot, outputMetadataFilePath);\n // Use unwatch to exclude the file from being watched\n server.watcher.unwatch(metadataSourcePath);\n logger.debug(\n `configureServer: Excluded from watcher: ${outputMetadataFilePath}`\n );\n }\n\n if (await generateMetadataSourceFile()) {\n logger.info(\n `configureServer: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`configureServer: Exited.`);\n l.release();\n }\n },\n // Build start phase\n buildStart: async () => {\n // Avoid race conditions.\n const l = await generateMetadataSourceLocker.lock();\n try {\n logger.debug(`buildStart: Started.`);\n // Re-resolve package metadata to capture any changes since configResolved\n // Update metadata TypeScript file with latest data\n if (await generateMetadataSourceFile()) {\n logger.info(\n `buildStart: Metadata source file is generated: ${outputMetadataFilePath}`\n );\n }\n } finally {\n logger.debug(`buildStart: Exited.`);\n l.release();\n }\n },\n // Generate bundle phase\n generateBundle: (_options, bundle) => {\n // Add banner to each output file if enabled\n if (insertMetadataBanner) {\n let count = 0;\n for (const fileName in bundle) {\n const chunk = bundle[fileName];\n if (chunk.type === 'chunk') {\n chunk.code = insertBannerHeader(chunk.code, banner);\n count++;\n } else if (\n chunk.type === 'asset' &&\n assetFiltersRegex.some((filter) => filter.test(fileName))\n ) {\n if (typeof chunk.source === 'string') {\n chunk.source = insertBannerHeader(chunk.source, banner + '\\n'); // insert more blank line\n count++;\n }\n }\n }\n if (count >= 1) {\n logger.debug(\n `generateBundle: Banner header inserted: ${count} file(s)`\n );\n }\n }\n },\n // Write bundle phase\n writeBundle: async (options) => {\n // Handle files written by other plugins (like vite-plugin-dts) if banner insertion is enabled\n if (!insertMetadataBanner || !options.dir) return;\n\n try {\n // Read all files in the output directory\n const files = await readdir(options.dir, { recursive: true });\n\n // Iterate over all files\n let count = 0;\n for (const file of files) {\n const filePath = join(options.dir, file);\n\n // Check if the file is target asset file\n if (assetFiltersRegex.some((filter) => filter.test(file))) {\n try {\n // Read the asset file\n const content = await readFile(filePath, 'utf-8');\n // Append banner to the asset file if it doesn't already contain it\n if (!content.includes(banner)) {\n await writeFile(\n filePath,\n insertBannerHeader(content, banner + '\\n')\n );\n count++;\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n }\n }\n if (count >= 1) {\n logger.debug(`writeBundle: Banner header inserted: ${count} file(s)`);\n }\n } catch (error) {\n // Skip files that can't be read/written\n }\n },\n };\n};\n"],"names":["name","createConsoleLogger","existsSync","readFile","mkdir","dirname","writeFile","resolvePackageMetadata","join","version","git_commit_hash","getFetchGitMetadata","options","readdir"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,iBAAiB,MAAM;AAC7B;AACA,MAAM,oBAAoB;AAAA,EACxB,SAAS;AAAA,EACT,CAAC,OAAO,OAAO,GAAG;AACpB;AACA,MAAM,UAAU,CAAC,QAAQ,aAAa;AACpC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS;AAClB,QAAI;AACF,eAAQ;AAAA,IACV,SAAS,OAAO;AACd,cAAQ,KAAK,8BAA8B,KAAK;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,iBAAe,MAAM;AACnB,QAAI,cAAc;AAChB,aAAO,oBAAoB,SAAS,YAAY;AAChD,qBAAe;AACf,UAAI;AACF,iBAAQ;AAAA,MACV,SAAS,OAAO;AACd,gBAAQ,KAAK,8BAA8B,KAAK;AAAA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I,SAAQ,KAAK,IAAI;AAGvC,cAAI,kBAAkB,KAAK,CAAC,WAAW,OAAO,KAAK,IAAI,CAAC,GAAG;AACzD,gBAAI;AAEF,oBAAM,UAAU,MAAMT,YAAS,UAAU,OAAO;AAEhD,kBAAI,CAAC,QAAQ,SAAS,MAAM,GAAG;AAC7B,sBAAMG,GAAAA;AAAAA,kBACJ;AAAA,kBACA,mBAAmB,SAAS,SAAS,IAAI;AAAA,gBAAA;AAE3C;AAAA,cACF;AAAA,YACF,SAAS,OAAO;AAAA,YAEhB;AAAA,UACF;AAAA,QACF;AACA,YAAI,SAAS,GAAG;AACd,iBAAO,MAAM,wCAAwC,KAAK,UAAU;AAAA,QACtE;AAAA,MACF,SAAS,OAAO;AAAA,MAEhB;AAAA,IACF;AAAA,EAAA;AAEJ;;","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.7.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 0865d5a2d4d1e89be8dae4b6abeba1393a767707
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { screwUp } from './vite-plugin';
|