plotlink-ows 0.1.13

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.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/app/db.ts +8 -0
  4. package/app/lib/llm-client.ts +265 -0
  5. package/app/lib/paths.ts +11 -0
  6. package/app/lib/publish.ts +204 -0
  7. package/app/lib/writer-prompt.ts +44 -0
  8. package/app/node_modules/.prisma/local-client/client.d.ts +1 -0
  9. package/app/node_modules/.prisma/local-client/client.js +5 -0
  10. package/app/node_modules/.prisma/local-client/default.d.ts +1 -0
  11. package/app/node_modules/.prisma/local-client/default.js +5 -0
  12. package/app/node_modules/.prisma/local-client/edge.d.ts +1 -0
  13. package/app/node_modules/.prisma/local-client/edge.js +184 -0
  14. package/app/node_modules/.prisma/local-client/index-browser.js +173 -0
  15. package/app/node_modules/.prisma/local-client/index.d.ts +3304 -0
  16. package/app/node_modules/.prisma/local-client/index.js +207 -0
  17. package/app/node_modules/.prisma/local-client/libquery_engine-darwin-arm64.dylib.node +0 -0
  18. package/app/node_modules/.prisma/local-client/package.json +183 -0
  19. package/app/node_modules/.prisma/local-client/query_engine_bg.js +2 -0
  20. package/app/node_modules/.prisma/local-client/query_engine_bg.wasm +0 -0
  21. package/app/node_modules/.prisma/local-client/runtime/edge-esm.js +35 -0
  22. package/app/node_modules/.prisma/local-client/runtime/edge.js +35 -0
  23. package/app/node_modules/.prisma/local-client/runtime/index-browser.d.ts +370 -0
  24. package/app/node_modules/.prisma/local-client/runtime/index-browser.js +17 -0
  25. package/app/node_modules/.prisma/local-client/runtime/library.d.ts +3982 -0
  26. package/app/node_modules/.prisma/local-client/runtime/library.js +147 -0
  27. package/app/node_modules/.prisma/local-client/runtime/react-native.js +84 -0
  28. package/app/node_modules/.prisma/local-client/runtime/wasm-compiler-edge.js +85 -0
  29. package/app/node_modules/.prisma/local-client/runtime/wasm-engine-edge.js +38 -0
  30. package/app/node_modules/.prisma/local-client/schema.prisma +21 -0
  31. package/app/node_modules/.prisma/local-client/wasm-edge-light-loader.mjs +5 -0
  32. package/app/node_modules/.prisma/local-client/wasm-worker-loader.mjs +5 -0
  33. package/app/node_modules/.prisma/local-client/wasm.d.ts +1 -0
  34. package/app/node_modules/.prisma/local-client/wasm.js +191 -0
  35. package/app/prisma/schema.prisma +57 -0
  36. package/app/routes/auth.ts +173 -0
  37. package/app/routes/chat.ts +135 -0
  38. package/app/routes/config.ts +210 -0
  39. package/app/routes/dashboard.ts +186 -0
  40. package/app/routes/oauth.ts +150 -0
  41. package/app/routes/publish.ts +112 -0
  42. package/app/routes/wallet.ts +99 -0
  43. package/app/server.ts +154 -0
  44. package/app/vite.config.ts +19 -0
  45. package/app/web/App.tsx +102 -0
  46. package/app/web/components/Chat.tsx +272 -0
  47. package/app/web/components/Dashboard.tsx +222 -0
  48. package/app/web/components/LLMSetup.tsx +291 -0
  49. package/app/web/components/Layout.tsx +235 -0
  50. package/app/web/components/Login.tsx +62 -0
  51. package/app/web/components/Publish.tsx +245 -0
  52. package/app/web/components/Settings.tsx +175 -0
  53. package/app/web/components/Setup.tsx +84 -0
  54. package/app/web/components/WalletCard.tsx +117 -0
  55. package/app/web/dist/assets/index-C9kXlYO_.css +2 -0
  56. package/app/web/dist/assets/index-CJiiaLHs.js +9 -0
  57. package/app/web/dist/index.html +16 -0
  58. package/app/web/index.html +15 -0
  59. package/app/web/main.tsx +10 -0
  60. package/app/web/plotlink-logo.svg +5 -0
  61. package/app/web/styles.css +51 -0
  62. package/bin/plotlink-ows.js +394 -0
  63. package/lib/ows/index.ts +3 -0
  64. package/lib/ows/policy.ts +68 -0
  65. package/lib/ows/types.ts +14 -0
  66. package/lib/ows/wallet.ts +70 -0
  67. package/package.json +79 -0
  68. package/packages/cli/node_modules/commander/LICENSE +22 -0
  69. package/packages/cli/node_modules/commander/Readme.md +1149 -0
  70. package/packages/cli/node_modules/commander/esm.mjs +16 -0
  71. package/packages/cli/node_modules/commander/index.js +24 -0
  72. package/packages/cli/node_modules/commander/lib/argument.js +149 -0
  73. package/packages/cli/node_modules/commander/lib/command.js +2662 -0
  74. package/packages/cli/node_modules/commander/lib/error.js +39 -0
  75. package/packages/cli/node_modules/commander/lib/help.js +709 -0
  76. package/packages/cli/node_modules/commander/lib/option.js +367 -0
  77. package/packages/cli/node_modules/commander/lib/suggestSimilar.js +101 -0
  78. package/packages/cli/node_modules/commander/package-support.json +16 -0
  79. package/packages/cli/node_modules/commander/package.json +82 -0
  80. package/packages/cli/node_modules/commander/typings/esm.d.mts +3 -0
  81. package/packages/cli/node_modules/commander/typings/index.d.ts +1045 -0
  82. package/packages/cli/node_modules/resolve-from/index.d.ts +31 -0
  83. package/packages/cli/node_modules/resolve-from/index.js +47 -0
  84. package/packages/cli/node_modules/resolve-from/license +9 -0
  85. package/packages/cli/node_modules/resolve-from/package.json +36 -0
  86. package/packages/cli/node_modules/resolve-from/readme.md +72 -0
  87. package/packages/cli/node_modules/tsup/LICENSE +21 -0
  88. package/packages/cli/node_modules/tsup/README.md +75 -0
  89. package/packages/cli/node_modules/tsup/assets/cjs_shims.js +13 -0
  90. package/packages/cli/node_modules/tsup/assets/esm_shims.js +9 -0
  91. package/packages/cli/node_modules/tsup/assets/package.json +3 -0
  92. package/packages/cli/node_modules/tsup/dist/chunk-DI5BO6XE.js +153 -0
  93. package/packages/cli/node_modules/tsup/dist/chunk-JZ25TPTY.js +42 -0
  94. package/packages/cli/node_modules/tsup/dist/chunk-PEEXUWMS.js +6 -0
  95. package/packages/cli/node_modules/tsup/dist/chunk-TWFEYLU4.js +352 -0
  96. package/packages/cli/node_modules/tsup/dist/chunk-VGC3FXLU.js +203 -0
  97. package/packages/cli/node_modules/tsup/dist/cli-default.js +12 -0
  98. package/packages/cli/node_modules/tsup/dist/cli-main.js +8 -0
  99. package/packages/cli/node_modules/tsup/dist/cli-node.js +14 -0
  100. package/packages/cli/node_modules/tsup/dist/index.d.ts +511 -0
  101. package/packages/cli/node_modules/tsup/dist/index.js +1711 -0
  102. package/packages/cli/node_modules/tsup/dist/rollup.js +6949 -0
  103. package/packages/cli/node_modules/tsup/package.json +99 -0
  104. package/packages/cli/node_modules/tsup/schema.json +362 -0
  105. package/packages/cli/package.json +35 -0
  106. package/packages/cli/src/commands/agent-register.ts +77 -0
  107. package/packages/cli/src/commands/chain.ts +29 -0
  108. package/packages/cli/src/commands/claim.ts +70 -0
  109. package/packages/cli/src/commands/create.ts +34 -0
  110. package/packages/cli/src/commands/status.ts +201 -0
  111. package/packages/cli/src/config.ts +103 -0
  112. package/packages/cli/src/index.ts +21 -0
  113. package/packages/cli/src/sdk/abi.ts +222 -0
  114. package/packages/cli/src/sdk/client.ts +713 -0
  115. package/packages/cli/src/sdk/constants.ts +56 -0
  116. package/packages/cli/src/sdk/index.ts +46 -0
  117. package/packages/cli/src/sdk/ipfs.ts +88 -0
  118. package/packages/cli/src/sdk.ts +36 -0
  119. package/packages/cli/tsconfig.json +20 -0
  120. package/packages/cli/tsup.config.ts +14 -0
  121. package/public/.well-known/farcaster.json +38 -0
  122. package/public/basescan-icon.svg +4 -0
  123. package/public/embed-image.png +0 -0
  124. package/public/favicon.png +0 -0
  125. package/public/hunt-token.svg +11 -0
  126. package/public/icon-192.png +0 -0
  127. package/public/icon.png +0 -0
  128. package/public/manifest.json +26 -0
  129. package/public/mc-icon-light.svg +12 -0
  130. package/public/og-image.png +0 -0
  131. package/public/plotlink-logo-symbol.svg +5 -0
  132. package/public/plotlink-logo.svg +5 -0
  133. package/public/screenshot-1.png +0 -0
  134. package/public/screenshot-2.png +0 -0
  135. package/public/screenshot-3.png +0 -0
  136. package/public/splash.png +0 -0
  137. package/public/wide-banner.png +0 -0
  138. package/scripts/backfill-trade-prices.ts +97 -0
  139. package/scripts/backfill-usd-rates.ts +220 -0
  140. package/scripts/e2e-verify.ts +1100 -0
  141. package/scripts/ows-smoke-test.ts +37 -0
  142. package/scripts/score-users.mjs +203 -0
@@ -0,0 +1,31 @@
1
+ declare const resolveFrom: {
2
+ /**
3
+ Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
4
+
5
+ @param fromDirectory - Directory to resolve from.
6
+ @param moduleId - What you would use in `require()`.
7
+ @returns Resolved module path. Throws when the module can't be found.
8
+
9
+ @example
10
+ ```
11
+ import resolveFrom = require('resolve-from');
12
+
13
+ // There is a file at `./foo/bar.js`
14
+
15
+ resolveFrom('foo', './bar');
16
+ //=> '/Users/sindresorhus/dev/test/foo/bar.js'
17
+ ```
18
+ */
19
+ (fromDirectory: string, moduleId: string): string;
20
+
21
+ /**
22
+ Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
23
+
24
+ @param fromDirectory - Directory to resolve from.
25
+ @param moduleId - What you would use in `require()`.
26
+ @returns Resolved module path or `undefined` when the module can't be found.
27
+ */
28
+ silent(fromDirectory: string, moduleId: string): string | undefined;
29
+ };
30
+
31
+ export = resolveFrom;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+ const path = require('path');
3
+ const Module = require('module');
4
+ const fs = require('fs');
5
+
6
+ const resolveFrom = (fromDirectory, moduleId, silent) => {
7
+ if (typeof fromDirectory !== 'string') {
8
+ throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
9
+ }
10
+
11
+ if (typeof moduleId !== 'string') {
12
+ throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
13
+ }
14
+
15
+ try {
16
+ fromDirectory = fs.realpathSync(fromDirectory);
17
+ } catch (error) {
18
+ if (error.code === 'ENOENT') {
19
+ fromDirectory = path.resolve(fromDirectory);
20
+ } else if (silent) {
21
+ return;
22
+ } else {
23
+ throw error;
24
+ }
25
+ }
26
+
27
+ const fromFile = path.join(fromDirectory, 'noop.js');
28
+
29
+ const resolveFileName = () => Module._resolveFilename(moduleId, {
30
+ id: fromFile,
31
+ filename: fromFile,
32
+ paths: Module._nodeModulePaths(fromDirectory)
33
+ });
34
+
35
+ if (silent) {
36
+ try {
37
+ return resolveFileName();
38
+ } catch (error) {
39
+ return;
40
+ }
41
+ }
42
+
43
+ return resolveFileName();
44
+ };
45
+
46
+ module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
47
+ module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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.
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "resolve-from",
3
+ "version": "5.0.0",
4
+ "description": "Resolve the path of a module like `require.resolve()` but from a given path",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/resolve-from",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "require",
24
+ "resolve",
25
+ "path",
26
+ "module",
27
+ "from",
28
+ "like",
29
+ "import"
30
+ ],
31
+ "devDependencies": {
32
+ "ava": "^1.4.1",
33
+ "tsd": "^0.7.2",
34
+ "xo": "^0.24.0"
35
+ }
36
+ }
@@ -0,0 +1,72 @@
1
+ # resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from)
2
+
3
+ > Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install resolve-from
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const resolveFrom = require('resolve-from');
17
+
18
+ // There is a file at `./foo/bar.js`
19
+
20
+ resolveFrom('foo', './bar');
21
+ //=> '/Users/sindresorhus/dev/test/foo/bar.js'
22
+ ```
23
+
24
+
25
+ ## API
26
+
27
+ ### resolveFrom(fromDirectory, moduleId)
28
+
29
+ Like `require()`, throws when the module can't be found.
30
+
31
+ ### resolveFrom.silent(fromDirectory, moduleId)
32
+
33
+ Returns `undefined` instead of throwing when the module can't be found.
34
+
35
+ #### fromDirectory
36
+
37
+ Type: `string`
38
+
39
+ Directory to resolve from.
40
+
41
+ #### moduleId
42
+
43
+ Type: `string`
44
+
45
+ What you would use in `require()`.
46
+
47
+
48
+ ## Tip
49
+
50
+ Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times:
51
+
52
+ ```js
53
+ const resolveFromFoo = resolveFrom.bind(null, 'foo');
54
+
55
+ resolveFromFoo('./bar');
56
+ resolveFromFoo('./baz');
57
+ ```
58
+
59
+
60
+ ## Related
61
+
62
+ - [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory
63
+ - [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
64
+ - [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
65
+ - [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
66
+ - [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily
67
+ - [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
68
+
69
+
70
+ ## License
71
+
72
+ MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 EGOIST
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,75 @@
1
+ > [!WARNING]
2
+ > This project is not actively maintained anymore. Please consider using [tsdown](https://github.com/rolldown/tsdown/) instead. Read more in [the migration guide](https://tsdown.dev/guide/migrate-from-tsup).
3
+
4
+ # tsup
5
+
6
+ [![npm version](https://badgen.net/npm/v/tsup)](https://npm.im/tsup) [![npm downloads](https://badgen.net/npm/dm/tsup)](https://npm.im/tsup)
7
+
8
+ Bundle your TypeScript library with no config, powered by [esbuild](https://github.com/evanw/esbuild).
9
+
10
+ ## 👀 What can it bundle?
11
+
12
+ Anything that's supported by Node.js natively, namely `.js`, `.json`, `.mjs`. And TypeScript `.ts`, `.tsx`. [CSS support is experimental](https://tsup.egoist.dev/#css-support).
13
+
14
+ ## ⚙️ Install
15
+
16
+ Install it locally in your project folder:
17
+
18
+ ```bash
19
+ npm i tsup -D
20
+ # Or Yarn
21
+ yarn add tsup --dev
22
+ # Or pnpm
23
+ pnpm add tsup -D
24
+ ```
25
+
26
+ You can also install it globally but it's not recommended.
27
+
28
+ ## 📖 Usage
29
+
30
+ ### Bundle files
31
+
32
+ ```bash
33
+ tsup [...files]
34
+ ```
35
+
36
+ Files are written into `./dist`.
37
+
38
+ You can bundle multiple files in one go:
39
+
40
+ ```bash
41
+ tsup src/index.ts src/cli.ts
42
+ ```
43
+
44
+ This will output `dist/index.js` and `dist/cli.js`.
45
+
46
+ ## 📚 Documentation
47
+
48
+ For complete usages, please dive into the [docs](https://tsup.egoist.dev).
49
+
50
+ For all configuration options, please see [the API docs](https://jsdocs.io/package/tsup).
51
+
52
+ ## 💬 Discussions
53
+
54
+ Head over to the [discussions](https://github.com/egoist/tsup/discussions) to share your ideas.
55
+
56
+ ## Sponsors
57
+
58
+ <p align="center">
59
+ <a href="https://chromatic.com" target="_blank"><picture>
60
+ <source media="(prefers-color-scheme: dark)" width="500" srcset="https://fastly.jsdelivr.net/gh/egoist-bot/images@main/uPic/Group 2 (2).png">
61
+ <img alt="Ship UIs faster with automated workflows for Storybook" width="500" src="https://fastly.jsdelivr.net/gh/egoist-bot/images@main/uPic/Group%202%20(1).png">
62
+ </picture></a>
63
+ </p>
64
+
65
+ <p align="center">
66
+ <a href="https://github.com/sponsors/egoist" target="_blank"><img src="https://sponsors-images.egoist.dev/sponsors.svg" alt="sponsors"></a>
67
+ </p>
68
+
69
+ ## Project Stats
70
+
71
+ ![Alt](https://repobeats.axiom.co/api/embed/4ef361ec8445b33c2dab451e1d23784015834c72.svg 'Repobeats analytics image')
72
+
73
+ ## License
74
+
75
+ MIT &copy; [EGOIST](https://github.com/sponsors/egoist)
@@ -0,0 +1,13 @@
1
+ // Shim globals in cjs bundle
2
+ // There's a weird bug that esbuild will always inject importMetaUrl
3
+ // if we export it as `const importMetaUrl = ... __filename ...`
4
+ // But using a function will not cause this issue
5
+
6
+ const getImportMetaUrl = () =>
7
+ typeof document === "undefined"
8
+ ? new URL(`file:${__filename}`).href
9
+ : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
10
+ ? document.currentScript.src
11
+ : new URL("main.js", document.baseURI).href;
12
+
13
+ export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()
@@ -0,0 +1,9 @@
1
+ // Shim globals in esm bundle
2
+ import path from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const getFilename = () => fileURLToPath(import.meta.url)
6
+ const getDirname = () => path.dirname(getFilename())
7
+
8
+ export const __dirname = /* @__PURE__ */ getDirname()
9
+ export const __filename = /* @__PURE__ */ getFilename()
@@ -0,0 +1,3 @@
1
+ {
2
+ "sideEffects": false
3
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
2
+
3
+ var _chunkPEEXUWMSjs = require('./chunk-PEEXUWMS.js');
4
+
5
+
6
+ var _chunkTWFEYLU4js = require('./chunk-TWFEYLU4.js');
7
+
8
+ // src/cli-main.ts
9
+ var _cac = require('cac');
10
+
11
+ // node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
12
+ function isBuffer(obj) {
13
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
14
+ }
15
+ function keyIdentity(key) {
16
+ return key;
17
+ }
18
+ function flatten(target, opts) {
19
+ opts = opts || {};
20
+ const delimiter = opts.delimiter || ".";
21
+ const maxDepth = opts.maxDepth;
22
+ const transformKey = opts.transformKey || keyIdentity;
23
+ const output = {};
24
+ function step(object, prev, currentDepth) {
25
+ currentDepth = currentDepth || 1;
26
+ Object.keys(object).forEach(function(key) {
27
+ const value = object[key];
28
+ const isarray = opts.safe && Array.isArray(value);
29
+ const type = Object.prototype.toString.call(value);
30
+ const isbuffer = isBuffer(value);
31
+ const isobject = type === "[object Object]" || type === "[object Array]";
32
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
33
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
34
+ return step(value, newKey, currentDepth + 1);
35
+ }
36
+ output[newKey] = value;
37
+ });
38
+ }
39
+ step(target);
40
+ return output;
41
+ }
42
+
43
+ // src/cli-main.ts
44
+ function ensureArray(input) {
45
+ return Array.isArray(input) ? input : input.split(",");
46
+ }
47
+ async function main(options = {}) {
48
+ const cli = _cac.cac.call(void 0, "tsup");
49
+ cli.command("[...files]", "Bundle files", {
50
+ ignoreOptionDefaultValue: true
51
+ }).option("--entry.* <file>", "Use a key-value pair as entry files").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--format <format>", 'Bundle format, "cjs", "iife", "esm"', {
52
+ default: "cjs"
53
+ }).option("--minify [terser]", "Minify bundle").option("--minify-whitespace", "Minify whitespace").option("--minify-identifiers", "Minify identifiers").option("--minify-syntax", "Minify syntax").option(
54
+ "--keep-names",
55
+ "Keep original function and class names in minified code"
56
+ ).option("--target <target>", 'Bundle target, "es20XX" or "esnext"', {
57
+ default: "es2017"
58
+ }).option(
59
+ "--legacy-output",
60
+ "Output different formats to different folder instead of using different extensions"
61
+ ).option("--dts [entry]", "Generate declaration file").option("--dts-resolve", "Resolve externals types used for d.ts files").option("--dts-only", "Emit declaration files only").option(
62
+ "--experimental-dts [entry]",
63
+ "Generate declaration file (experimental)"
64
+ ).option(
65
+ "--sourcemap [inline]",
66
+ "Generate external sourcemap, or inline source: --sourcemap inline"
67
+ ).option(
68
+ "--watch [path]",
69
+ 'Watch mode, if path is not specified, it watches the current folder ".". Repeat "--watch" for more than one path'
70
+ ).option("--ignore-watch <path>", "Ignore custom paths in watch mode").option(
71
+ "--onSuccess <command>",
72
+ "Execute command after successful build, specially useful for watch mode"
73
+ ).option("--env.* <value>", "Define compile-time env variables").option(
74
+ "--inject <file>",
75
+ "Replace a global variable with an import from another file"
76
+ ).option("--define.* <value>", "Define compile-time constants").option(
77
+ "--external <name>",
78
+ "Mark specific packages / package.json (dependencies and peerDependencies) as external"
79
+ ).option("--global-name <name>", "Global variable name for iife format").option("--jsxFactory <jsxFactory>", "Name of JSX factory function", {
80
+ default: "React.createElement"
81
+ }).option("--jsxFragment <jsxFragment>", "Name of JSX fragment function", {
82
+ default: "React.Fragment"
83
+ }).option("--replaceNodeEnv", "Replace process.env.NODE_ENV").option("--no-splitting", "Disable code splitting").option("--clean", "Clean output directory").option(
84
+ "--silent",
85
+ 'Suppress non-error logs (excluding "onSuccess" process output)'
86
+ ).option("--pure <express>", "Mark specific expressions as pure").option("--metafile", "Emit esbuild metafile (a JSON file)").option("--platform <platform>", "Target platform", {
87
+ default: "node"
88
+ }).option("--loader <ext=loader>", "Specify the loader for a file extension").option("--tsconfig <filename>", "Use a custom tsconfig").option("--config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--shims", "Enable cjs and esm shims").option("--inject-style", "Inject style tag to document head").option(
89
+ "--treeshake [strategy]",
90
+ 'Using Rollup for treeshaking instead, "recommended" or "smallest" or "safest"'
91
+ ).option("--publicDir [dir]", "Copy public directory to output directory").option(
92
+ "--killSignal <signal>",
93
+ 'Signal to kill child process, "SIGTERM" or "SIGKILL"'
94
+ ).option("--cjsInterop", "Enable cjs interop").action(async (files, flags) => {
95
+ const { build } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.js")));
96
+ Object.assign(options, {
97
+ ...flags
98
+ });
99
+ if (!options.entry && files.length > 0) {
100
+ options.entry = files.map(_chunkTWFEYLU4js.slash);
101
+ }
102
+ if (flags.format) {
103
+ const format = ensureArray(flags.format);
104
+ options.format = format;
105
+ }
106
+ if (flags.external) {
107
+ const external = ensureArray(flags.external);
108
+ options.external = external;
109
+ }
110
+ if (flags.target) {
111
+ options.target = flags.target.includes(",") ? flags.target.split(",") : flags.target;
112
+ }
113
+ if (flags.dts || flags.dtsResolve || flags.dtsOnly) {
114
+ options.dts = {};
115
+ if (typeof flags.dts === "string") {
116
+ options.dts.entry = flags.dts;
117
+ }
118
+ if (flags.dtsResolve) {
119
+ options.dts.resolve = flags.dtsResolve;
120
+ }
121
+ if (flags.dtsOnly) {
122
+ options.dts.only = true;
123
+ }
124
+ }
125
+ if (flags.inject) {
126
+ const inject = ensureArray(flags.inject);
127
+ options.inject = inject;
128
+ }
129
+ if (flags.define) {
130
+ const define = flatten(flags.define);
131
+ options.define = define;
132
+ }
133
+ if (flags.loader) {
134
+ const loader = ensureArray(flags.loader);
135
+ options.loader = loader.reduce((result, item) => {
136
+ const parts = item.split("=");
137
+ return {
138
+ ...result,
139
+ [parts[0]]: parts[1]
140
+ };
141
+ }, {});
142
+ }
143
+ await build(options);
144
+ });
145
+ cli.help();
146
+ cli.version(_chunkPEEXUWMSjs.version);
147
+ cli.parse(process.argv, { run: false });
148
+ await cli.runMatchedCommand();
149
+ }
150
+
151
+
152
+
153
+ exports.main = main;
@@ -0,0 +1,42 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/errors.ts
2
+ var _worker_threads = require('worker_threads');
3
+ var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
4
+ var PrettyError = class extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = this.constructor.name;
8
+ if (typeof Error.captureStackTrace === "function") {
9
+ Error.captureStackTrace(this, this.constructor);
10
+ } else {
11
+ this.stack = new Error(message).stack;
12
+ }
13
+ }
14
+ };
15
+ function handleError(error) {
16
+ if (error.loc) {
17
+ console.error(
18
+ _picocolors2.default.bold(
19
+ _picocolors2.default.red(
20
+ `Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`
21
+ )
22
+ )
23
+ );
24
+ }
25
+ if (error.frame) {
26
+ console.error(_picocolors2.default.red(error.message));
27
+ console.error(_picocolors2.default.dim(error.frame));
28
+ } else if (error instanceof PrettyError) {
29
+ console.error(_picocolors2.default.red(error.message));
30
+ } else {
31
+ console.error(_picocolors2.default.red(error.stack));
32
+ }
33
+ process.exitCode = 1;
34
+ if (!_worker_threads.isMainThread && _worker_threads.parentPort) {
35
+ _worker_threads.parentPort.postMessage("error");
36
+ }
37
+ }
38
+
39
+
40
+
41
+
42
+ exports.PrettyError = PrettyError; exports.handleError = handleError;
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
+ var version = "8.5.1";
3
+
4
+
5
+
6
+ exports.version = version;