@fireproof/vendor 0.22.0-keybag → 0.23.1-dev-issue-1057

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/merge-package.ts DELETED
@@ -1,207 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as fs from "fs/promises";
3
- import * as path from "path";
4
-
5
- // import { glob } from "glob";
6
- import { $, glob } from "zx";
7
- import { command, flag, run, boolean, string, option, restPositionals } from "cmd-ts";
8
-
9
- interface CommandArgs {
10
- readonly verbose: boolean;
11
- readonly prepare: boolean;
12
- readonly buildBase: string;
13
- readonly buildPackageJson: string;
14
- readonly srcPackageJson: string;
15
- readonly packagesStr: string[];
16
- }
17
-
18
- async function prepare(packages: PackageOptions[], { buildBase }: CommandArgs) {
19
- await $`rm -rf ${buildBase}`;
20
- await $`mkdir -p ${buildBase}/patched`;
21
- await $`cp package.json ${buildBase}/package.json`;
22
-
23
- await Promise.all(
24
- packages
25
- .filter((p): p is GitOptions => p.type === "git")
26
- .map(async ({ name, url, npm }) => {
27
- await fs.mkdir(`${buildBase}/patched/${name}`, { recursive: true });
28
- await $`git clone ${url} ${buildBase}/patched/${name}`;
29
- await $`cd ${buildBase}/patched/${name} && ${npm} install && ${npm} run build && ${npm} pack`;
30
- await $`cd ${buildBase} && pnpm install -f patched/${name}/*.tgz`;
31
- }),
32
- );
33
- for (const { name: pkg, type } of packages as NamedOptions[]) {
34
- if (type === "npm") {
35
- await $`cd ${buildBase} && pnpm install ${pkg}`;
36
- }
37
- await $`cd ${buildBase} && rm -rf src/${pkg}`;
38
- await $`cd ${buildBase} && mkdir -p src/${pkg}`;
39
- await $`cd ${buildBase} && rsync -vaxH node_modules/${pkg}/ src/${pkg}/`;
40
- }
41
- const files = (
42
- await Promise.all(
43
- packages
44
- .map(({ name }) => name)
45
- .map((p) => `${buildBase}/src/${p}/**/*.[jt]s`)
46
- .map((f) => glob(f)),
47
- )
48
- )
49
- .flat()
50
- .filter((f) => !f.endsWith(".d.ts"));
51
- await $`jscodeshift --parser=ts -t=./to-esm-transform.ts ${files}`;
52
- }
53
-
54
- function patchVersion(packageJson: Record<string, unknown>) {
55
- let version = "refs/tags/v0.0.0-smoke";
56
- if (process.env.GITHUB_REF && process.env.GITHUB_REF.startsWith("refs/tags/v")) {
57
- version = process.env.GITHUB_REF;
58
- }
59
- version = version.split("/").slice(-1)[0].replace(/^v/, "");
60
- console.log(`Patch version ${version} in package.json`);
61
- packageJson.version = version;
62
- }
63
-
64
- type Exports = Record<string, Record<string, string>>;
65
- interface PackageJson {
66
- name: string;
67
- dependencies: Record<string, string>;
68
- exports: Exports;
69
- }
70
-
71
- function pluginExports(name: string, exports: Exports, srcDir: string, buildBase: string): Exports {
72
- const result: Exports = {};
73
- // const base = path.relative(buildBase, srcDir)
74
- const nested = {};
75
- result[`./${name}`] = nested;
76
- console.log(">>>>>=", name, srcDir);
77
- // !exports && console.log(">>>>>=", name, srcDir)
78
- for (const [key, value] of Object.entries(exports || {})) {
79
- // const pluggedKey = `./${path.join(name, key)}`;
80
-
81
- if (typeof value === "string") {
82
- nested[key] = `./${path.join(path.relative(buildBase, srcDir), value)}`;
83
- } else {
84
- nested[key] = Object.entries(value).reduce(
85
- (acc, [k, v]) => {
86
- acc[k] = `./${path.join(path.relative(buildBase, srcDir), v)}`;
87
- return acc;
88
- },
89
- {} as Record<string, string>,
90
- );
91
- }
92
- }
93
- return result;
94
- }
95
-
96
- function mergePackageJson(dest: PackageJson, src: PackageJson, srcDir: string, { buildBase }: CommandArgs) {
97
- dest.dependencies = { ...dest.dependencies, ...src.dependencies };
98
- dest.exports = {
99
- ...dest.exports,
100
- ...pluginExports(src.name, src.exports, srcDir, buildBase),
101
- };
102
- }
103
-
104
- interface PackageOptions {
105
- readonly type: "npm" | "git";
106
- readonly name: string;
107
- }
108
-
109
- interface NamedOptions extends PackageOptions {
110
- readonly type: "npm";
111
- readonly name: string;
112
- }
113
-
114
- interface GitOptions extends PackageOptions {
115
- readonly type: "git";
116
- readonly url: string;
117
- readonly npm: string;
118
- }
119
-
120
- function toPackageOptions(packages: string): NamedOptions | GitOptions {
121
- const [name, url, npm] = packages.split(",");
122
- if (url) {
123
- return { type: "git", name, url, npm: npm || "pnpm" };
124
- }
125
- return { type: "npm", name };
126
- }
127
-
128
- async function main() {
129
- const cmd = command({
130
- name: "merge-package",
131
- description: "merge a package.json to build a vendore package.json",
132
- version: "1.0.0",
133
- args: {
134
- verbose: flag({
135
- long: "verbose",
136
- type: boolean,
137
- }),
138
- prepare: flag({
139
- long: "prepare",
140
- type: boolean,
141
- }),
142
- buildBase: option({
143
- long: "build-base",
144
- type: string,
145
- description: "build base directory",
146
- defaultValue: () => "./dist",
147
- defaultValueIsSerializable: true,
148
- }),
149
- buildPackageJson: option({
150
- long: "dest-package-json",
151
- type: string,
152
- description: "build destination",
153
- defaultValue: () => "./dist/package.json",
154
- defaultValueIsSerializable: true,
155
- }),
156
- srcPackageJson: option({
157
- long: "src-package-json",
158
- type: string,
159
- description: "source package.json",
160
- defaultValue: () => "./package.json",
161
- defaultValueIsSerializable: true,
162
- }),
163
- packagesStr: restPositionals({
164
- description:
165
- "packages to merge, without anything it's pulled from npm, if package,url,npm its pulled from git and installed with npm",
166
- }),
167
- },
168
- handler: async (args) => {
169
- $.verbose = args.verbose;
170
- const packages = args.packagesStr.map(toPackageOptions);
171
- if (args.prepare) {
172
- await prepare(packages, args);
173
- }
174
- await fs.mkdir(path.dirname(args.buildPackageJson), { recursive: true });
175
- const packageJson = JSON.parse(await fs.readFile(args.srcPackageJson, "utf8"));
176
- patchVersion(packageJson);
177
- // await $`pwd ; find "dist/src/@ipld/dag-json" -type f -print`
178
- for (const packageFile of packages.map((p) => `dist/src/${p.name}/package.json`)) {
179
- const mPackageJson = JSON.parse(await fs.readFile(packageFile, "utf8"));
180
- await fs.unlink(packageFile);
181
- mergePackageJson(packageJson, mPackageJson, path.dirname(packageFile), args);
182
- }
183
- // filter our own packages
184
- packageJson.dependencies = Object.entries(packageJson.dependencies).reduce(
185
- (acc, [k]) => {
186
- if (!packages.find((p) => p.name === k)) {
187
- acc[k] = packageJson.dependencies[k];
188
- }
189
- return acc;
190
- },
191
- {} as Record<string, string>,
192
- );
193
- await fs.writeFile(args.buildPackageJson, JSON.stringify(packageJson, null, 2));
194
- const projectRoot = path.resolve(dirname(args.srcPackageJson));
195
- const gitignoreSrc = path.resolve(projectRoot, ".gitignore");
196
- await $`cp ${gitignoreSrc} ${path.join(args.buildBase, ".npmignore")}`;
197
- // await $`cp ../.gitignore ${args.buildBase}/.npmignore`;
198
- await $`cd ${args.buildBase} && pnpm pack`;
199
- },
200
- });
201
- await run(cmd, process.argv.slice(2));
202
- }
203
-
204
- main().catch((a) => {
205
- console.error(a);
206
- process.exit(1);
207
- });
@@ -1,19 +0,0 @@
1
- import { expectType } from "tsd";
2
- import pLimit from "./index.js";
3
-
4
- const limit = pLimit(1);
5
-
6
- const input = [limit(async () => "foo"), limit(async () => "bar"), limit(async () => undefined)];
7
-
8
- expectType<Promise<(string | undefined)[]>>(Promise.all(input));
9
-
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
- expectType<Promise<string>>(limit((a: string) => "", "test"));
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- expectType<Promise<string>>(limit(async (a: string, b: number) => "", "test", 1));
14
-
15
- expectType<number>(limit.activeCount);
16
- expectType<number>(limit.pendingCount);
17
-
18
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
19
- expectType<void>(limit.clearQueue());
package/p-limit/license DELETED
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,59 +0,0 @@
1
- {
2
- "name": "p-limit",
3
- "version": "6.2.0",
4
- "description": "Run multiple promise-returning & async functions with limited concurrency",
5
- "license": "MIT",
6
- "repository": "sindresorhus/p-limit",
7
- "funding": "https://github.com/sponsors/sindresorhus",
8
- "author": {
9
- "name": "Sindre Sorhus",
10
- "email": "sindresorhus@gmail.com",
11
- "url": "https://sindresorhus.com"
12
- },
13
- "type": "module",
14
- "exports": {
15
- "types": "./index.d.ts",
16
- "default": "./index.js"
17
- },
18
- "sideEffects": false,
19
- "engines": {
20
- "node": ">=18"
21
- },
22
- "scripts": {
23
- "build": "echo vendor need this",
24
- "test": "xo && ava && tsd"
25
- },
26
- "files": [
27
- "index.js",
28
- "index.d.ts"
29
- ],
30
- "keywords": [
31
- "promise",
32
- "limit",
33
- "limited",
34
- "concurrency",
35
- "throttle",
36
- "throat",
37
- "rate",
38
- "batch",
39
- "ratelimit",
40
- "task",
41
- "queue",
42
- "async",
43
- "await",
44
- "promises",
45
- "bluebird"
46
- ],
47
- "dependencies": {
48
- "yocto-queue": "^1.2.1"
49
- },
50
- "devDependencies": {
51
- "ava": "^6.1.3",
52
- "delay": "^6.0.0",
53
- "in-range": "^3.0.0",
54
- "random-int": "^3.0.0",
55
- "time-span": "^5.1.0",
56
- "tsd": "^0.31.1",
57
- "xo": "^0.58.0"
58
- }
59
- }
package/p-limit/readme.md DELETED
@@ -1,128 +0,0 @@
1
- # p-limit
2
-
3
- > Run multiple promise-returning & async functions with limited concurrency
4
-
5
- _Works in Node.js and browsers._
6
-
7
- ## Install
8
-
9
- ```sh
10
- npm install p-limit
11
- ```
12
-
13
- ## Usage
14
-
15
- ```js
16
- import pLimit from "p-limit";
17
-
18
- const limit = pLimit(1);
19
-
20
- const input = [limit(() => fetchSomething("foo")), limit(() => fetchSomething("bar")), limit(() => doSomething())];
21
-
22
- // Only one promise is run at once
23
- const result = await Promise.all(input);
24
- console.log(result);
25
- ```
26
-
27
- ## API
28
-
29
- ### pLimit(concurrency) <sup>default export</sup>
30
-
31
- Returns a `limit` function.
32
-
33
- #### concurrency
34
-
35
- Type: `number`\
36
- Minimum: `1`
37
-
38
- Concurrency limit.
39
-
40
- ### limit(fn, ...args)
41
-
42
- Returns the promise returned by calling `fn(...args)`.
43
-
44
- #### fn
45
-
46
- Type: `Function`
47
-
48
- Promise-returning/async function.
49
-
50
- #### args
51
-
52
- Any arguments to pass through to `fn`.
53
-
54
- Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a _lot_ of functions.
55
-
56
- ### limit.activeCount
57
-
58
- The number of promises that are currently running.
59
-
60
- ### limit.pendingCount
61
-
62
- The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
63
-
64
- ### limit.clearQueue()
65
-
66
- Discard pending promises that are waiting to run.
67
-
68
- This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
69
-
70
- Note: This does not cancel promises that are already running.
71
-
72
- ### limit.concurrency
73
-
74
- Get or set the concurrency limit.
75
-
76
- ### limitFunction(fn, options) <sup>named export</sup>
77
-
78
- Returns a function with limited concurrency.
79
-
80
- The returned function manages its own concurrent executions, allowing you to call it multiple times without exceeding the specified concurrency limit.
81
-
82
- Ideal for scenarios where you need to control the number of simultaneous executions of a single function, rather than managing concurrency across multiple functions.
83
-
84
- ```js
85
- import { limitFunction } from "p-limit";
86
-
87
- const limitedFunction = limitFunction(
88
- async () => {
89
- return doSomething();
90
- },
91
- { concurrency: 1 },
92
- );
93
-
94
- const input = Array.from({ length: 10 }, limitedFunction);
95
-
96
- // Only one promise is run at once.
97
- await Promise.all(input);
98
- ```
99
-
100
- #### fn
101
-
102
- Type: `Function`
103
-
104
- Promise-returning/async function.
105
-
106
- #### options
107
-
108
- Type: `object`
109
-
110
- #### concurrency
111
-
112
- Type: `number`\
113
- Minimum: `1`
114
-
115
- Concurrency limit.
116
-
117
- ## FAQ
118
-
119
- ### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package?
120
-
121
- This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue.
122
-
123
- ## Related
124
-
125
- - [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
126
- - [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
127
- - [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
128
- - [More…](https://github.com/sindresorhus/promise-fun)
@@ -1,42 +0,0 @@
1
- import { ImportDeclaration, API, FileInfo, Options } from "jscodeshift";
2
-
3
- const nodeExternals = new Set(["path", "fs", "fs/promises"]);
4
-
5
- const replace = {
6
- /*
7
- "cborg": "@fireproof/vendor/cborg",
8
- "cborg/utils": "@fireproof/vendor/cborg/utils",
9
- "cborg/json": "@fireproof/vendor/cborg/json",
10
- "cborg/length": "@fireproof/vendor/cborg/length",
11
- "cborg/taglib": "@fireproof/vendor/cborg/taglib",
12
- "@ipld/dag-json": "@fireproof/vendor/@ipld/dag-json",
13
- "@ipld/dag-cbor": "@fireproof/vendor/@ipld/dag-cbor",
14
- */
15
- };
16
-
17
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
- export default function (fileInfo: FileInfo, api: API, options: Options) {
19
- return api
20
- .jscodeshift(fileInfo.source)
21
- .find(ImportDeclaration)
22
- .map((path) => {
23
- const sourceValue = path.node.source.value;
24
- if (!sourceValue) {
25
- return path;
26
- }
27
- const val = sourceValue.toString();
28
- if (nodeExternals.has(val)) {
29
- return path;
30
- } else if (replace[val]) {
31
- path.node.source.value = replace[val];
32
- }
33
- // else if (/^[^.].*/.test(val)) {
34
- // // eslint-disable-next-line no-console
35
- // // console.log(path.node.source)
36
- // path.node.source.value = `https://esm.sh/${path.node.source.value}`;
37
- // }
38
- return path; //.node as unknown as ASTPath<ASTNode>;
39
- })
40
- .toSource();
41
- //return orig;
42
- }