Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
382
node_modules/edge-runtime/LICENSE.md
generated
vendored
Normal file
382
node_modules/edge-runtime/LICENSE.md
generated
vendored
Normal file
|
|
@ -0,0 +1,382 @@
|
|||
# Mozilla Public License Version 2.0
|
||||
|
||||
1. Definitions
|
||||
|
||||
---
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
|
||||
---
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
|
||||
---
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
|
||||
---
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
|
||||
---
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
---
|
||||
|
||||
- *
|
||||
- 6. Disclaimer of Warranty \*
|
||||
- ------------------------- \*
|
||||
- *
|
||||
- Covered Software is provided under this License on an "as is" \*
|
||||
- basis, without warranty of any kind, either expressed, implied, or \*
|
||||
- statutory, including, without limitation, warranties that the \*
|
||||
- Covered Software is free of defects, merchantable, fit for a \*
|
||||
- particular purpose or non-infringing. The entire risk as to the \*
|
||||
- quality and performance of the Covered Software is with You. \*
|
||||
- Should any Covered Software prove defective in any respect, You \*
|
||||
- (not any Contributor) assume the cost of any necessary servicing, \*
|
||||
- repair, or correction. This disclaimer of warranty constitutes an \*
|
||||
- essential part of this License. No use of any Covered Software is \*
|
||||
- authorized under this License except under this disclaimer. \*
|
||||
- *
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
- *
|
||||
- 7. Limitation of Liability \*
|
||||
- -------------------------- \*
|
||||
- *
|
||||
- Under no circumstances and under no legal theory, whether tort \*
|
||||
- (including negligence), contract, or otherwise, shall any \*
|
||||
- Contributor, or anyone who distributes Covered Software as \*
|
||||
- permitted above, be liable to You for any direct, indirect, \*
|
||||
- special, incidental, or consequential damages of any character \*
|
||||
- including, without limitation, damages for lost profits, loss of \*
|
||||
- goodwill, work stoppage, computer failure or malfunction, or any \*
|
||||
- and all other commercial damages or losses, even if such party \*
|
||||
- shall have been informed of the possibility of such damages. This \*
|
||||
- limitation of liability shall not apply to liability for death or \*
|
||||
- personal injury resulting from such party's negligence to the \*
|
||||
- extent applicable law prohibits such limitation. Some \*
|
||||
- jurisdictions do not allow the exclusion or limitation of \*
|
||||
- incidental or consequential damages, so this exclusion and \*
|
||||
- limitation may not apply to You. \*
|
||||
- *
|
||||
|
||||
---
|
||||
|
||||
8. Litigation
|
||||
|
||||
---
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
|
||||
---
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
|
||||
---
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
## Exhibit A - Source Code Form License Notice
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
## Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
37
node_modules/edge-runtime/README.md
generated
vendored
Normal file
37
node_modules/edge-runtime/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<div align="center">
|
||||
<br>
|
||||
<img src="https://user-images.githubusercontent.com/2096101/235130063-e561514e-1f66-4ff6-9034-70dbf7ca3260.png#gh-dark-mode-only">
|
||||
<img src="https://user-images.githubusercontent.com/2096101/235127419-ac6fe609-d0cd-4339-a593-c48305a83823.png#gh-light-mode-only">
|
||||
<br>
|
||||
<br>
|
||||
<p align="center"><strong>edge-runtime</strong>: Run any Edge Function from CLI or Node.js module.</p>
|
||||
<p align="center">See <a href="https://edge-runtime.vercel.app/packages/runtime" target='_blank' rel='noopener noreferrer'>edge-runtime</a> section in our <a href="https://edge-runtime.vercel.app/" target='_blank' rel='noopener noreferrer'>website</a> for more information.</p>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install edge-runtime --save
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add edge-runtime --dev
|
||||
```
|
||||
|
||||
or using pnpm:
|
||||
|
||||
```sh
|
||||
pnpm install edge-runtime --save
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
**edge-runtime** © [Vercel](https://vercel.com), released under the [MPLv2](https://github.com/vercel/edge-runtime/blob/main/LICENSE.md) License.<br>
|
||||
Authored and maintained by [Vercel](https://vercel.com) with help from [contributors](https://github.com/vercel/edge-runtime/contributors).
|
||||
|
||||
> [vercel.com](https://vercel.com) · GitHub [Vercel](https://github.com/vercel) · Twitter [@vercel](https://twitter.com/vercel)
|
||||
1
node_modules/edge-runtime/dist/cli/eval.d.ts
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/eval.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const inlineEval: (script: string) => Promise<any>;
|
||||
11
node_modules/edge-runtime/dist/cli/eval.js
generated
vendored
Normal file
11
node_modules/edge-runtime/dist/cli/eval.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.inlineEval = void 0;
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const inlineEval = async (script) => {
|
||||
const runtime = new edge_runtime_1.EdgeRuntime();
|
||||
const result = await runtime.evaluate(script);
|
||||
return result;
|
||||
};
|
||||
exports.inlineEval = inlineEval;
|
||||
//# sourceMappingURL=eval.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/eval.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/eval.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/cli/eval.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;AAEtC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IACjD,MAAM,OAAO,GAAG,IAAI,0BAAW,EAAE,CAAA;IACjC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7C,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB","sourcesContent":["import { EdgeRuntime } from '../edge-runtime'\n\nexport const inlineEval = async (script: string) => {\n const runtime = new EdgeRuntime()\n const result = await runtime.evaluate(script)\n return result\n}\n"]}
|
||||
1
node_modules/edge-runtime/dist/cli/help.d.ts
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/help.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const help: () => string;
|
||||
31
node_modules/edge-runtime/dist/cli/help.js
generated
vendored
Normal file
31
node_modules/edge-runtime/dist/cli/help.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = void 0;
|
||||
const picocolors_1 = require("picocolors");
|
||||
const flags = {
|
||||
eval: 'Evaluate an input script',
|
||||
help: 'Display this message.',
|
||||
listen: 'Run as HTTP server.',
|
||||
port: 'Specify a port to use.',
|
||||
repl: 'Start an interactive session.',
|
||||
};
|
||||
const help = () => `
|
||||
edge-runtime ${(0, picocolors_1.dim)('[<flags>] [input]')}
|
||||
|
||||
${(0, picocolors_1.dim)('Flags:')}
|
||||
|
||||
${getSectionSummary(flags)}
|
||||
`;
|
||||
exports.help = help;
|
||||
function getPadLength(options) {
|
||||
const lengths = Object.keys(options).map((key) => key.length);
|
||||
return Math.max.apply(null, lengths) + 1;
|
||||
}
|
||||
function getSectionSummary(options) {
|
||||
const summaryPadLength = getPadLength(options);
|
||||
const summary = Object.entries(options)
|
||||
.map(([key, description]) => ` --${key.padEnd(summaryPadLength)} ${(0, picocolors_1.dim)(description)}`)
|
||||
.join('\n');
|
||||
return `${summary}`;
|
||||
}
|
||||
//# sourceMappingURL=help.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/help.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/help.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAGvC,MAAM,KAAK,GAAgB;IACzB,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,qBAAqB;IAC7B,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,+BAA+B;CACtC,CAAA;AAEM,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;iBACT,IAAA,gBAAG,EAAC,mBAAmB,CAAC;;IAErC,IAAA,gBAAG,EAAC,QAAQ,CAAC;;EAEf,iBAAiB,CAAC,KAAK,CAAC;CACzB,CAAA;AANY,QAAA,IAAI,QAMhB;AAED,SAAS,YAAY,CAAC,OAAoB;IACxC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAoB;IAC7C,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE9C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACpC,GAAG,CACF,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,CACrB,SAAS,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,IAAA,gBAAG,EAAC,WAAW,CAAC,EAAE,CAC9D;SACA,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO,GAAG,OAAO,EAAE,CAAA;AACrB,CAAC","sourcesContent":["import { dim, white } from 'picocolors'\ninterface HelpOptions extends Record<string, string> {}\n\nconst flags: HelpOptions = {\n eval: 'Evaluate an input script',\n help: 'Display this message.',\n listen: 'Run as HTTP server.',\n port: 'Specify a port to use.',\n repl: 'Start an interactive session.',\n}\n\nexport const help = () => `\n edge-runtime ${dim('[<flags>] [input]')}\n\n ${dim('Flags:')}\n\n${getSectionSummary(flags)}\n`\n\nfunction getPadLength(options: HelpOptions) {\n const lengths = Object.keys(options).map((key) => key.length)\n return Math.max.apply(null, lengths) + 1\n}\n\nfunction getSectionSummary(options: HelpOptions) {\n const summaryPadLength = getPadLength(options)\n\n const summary = Object.entries(options)\n .map(\n ([key, description]) =>\n ` --${key.padEnd(summaryPadLength)} ${dim(description)}`,\n )\n .join('\\n')\n\n return `${summary}`\n}\n"]}
|
||||
2
node_modules/edge-runtime/dist/cli/index.d.ts
generated
vendored
Normal file
2
node_modules/edge-runtime/dist/cli/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
export {};
|
||||
113
node_modules/edge-runtime/dist/cli/index.js
generated
vendored
Executable file
113
node_modules/edge-runtime/dist/cli/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,113 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const util_1 = require("util");
|
||||
const fs_1 = require("fs");
|
||||
const server_1 = require("../server");
|
||||
const child_process_1 = __importDefault(require("child_process"));
|
||||
const signal_exit_1 = require("signal-exit");
|
||||
const mri_1 = __importDefault(require("mri"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const { _: input, ...flags } = (0, mri_1.default)(process.argv.slice(2), {
|
||||
alias: {
|
||||
e: 'eval',
|
||||
h: 'host',
|
||||
l: 'listen',
|
||||
p: 'port',
|
||||
},
|
||||
default: {
|
||||
cwd: process.cwd(),
|
||||
eval: false,
|
||||
help: false,
|
||||
host: '127.0.0.1',
|
||||
listen: false,
|
||||
port: 3000,
|
||||
repl: false,
|
||||
},
|
||||
});
|
||||
async function main() {
|
||||
if (flags.help) {
|
||||
const { help } = await Promise.resolve().then(() => __importStar(require('./help')));
|
||||
console.log(help());
|
||||
return;
|
||||
}
|
||||
if (flags.eval) {
|
||||
const { inlineEval } = await Promise.resolve().then(() => __importStar(require('./eval')));
|
||||
console.log(await inlineEval(input[0]));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* If there is no script path to run a server, the CLI will start a REPL.
|
||||
*/
|
||||
const [scriptPath] = input;
|
||||
if (!scriptPath) {
|
||||
const replPath = path_1.default.resolve(__dirname, 'repl.js');
|
||||
return (0, util_1.promisify)(child_process_1.default.spawn).call(null, 'node', [replPath], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
const initialCode = (0, fs_1.readFileSync)(path_1.default.resolve(process.cwd(), scriptPath), 'utf-8');
|
||||
const runtime = new edge_runtime_1.EdgeRuntime({ initialCode });
|
||||
if (!flags.listen)
|
||||
return runtime.evaluate('');
|
||||
const logger = await Promise.resolve().then(() => __importStar(require('./logger'))).then(({ createLogger }) => createLogger());
|
||||
logger.debug(`v${String(require('../../package.json').version)} at Node.js ${process.version}`);
|
||||
/**
|
||||
* Start a server with the script provided in the file path.
|
||||
*/
|
||||
let server;
|
||||
let port = flags.port;
|
||||
while (server === undefined) {
|
||||
try {
|
||||
server = await (0, server_1.runServer)({
|
||||
host: flags.host,
|
||||
logger: logger,
|
||||
port,
|
||||
runtime,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
if ((error === null || error === void 0 ? void 0 : error.code) === 'EADDRINUSE') {
|
||||
logger.warn(`Port \`${port}\` already in use`);
|
||||
++port;
|
||||
}
|
||||
else
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
(0, signal_exit_1.onExit)(() => server === null || server === void 0 ? void 0 : server.close());
|
||||
logger(`Waiting incoming requests at ${logger.quotes(server.url)}`);
|
||||
}
|
||||
main().catch((error) => {
|
||||
if (!(error instanceof Error))
|
||||
error = new Error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/index.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/edge-runtime/dist/cli/logger.d.ts
generated
vendored
Normal file
7
node_modules/edge-runtime/dist/cli/logger.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { Logger } from '../types';
|
||||
export declare const format: (...args: unknown[]) => string;
|
||||
/**
|
||||
* Creates basic logger with colors that can be used from the CLI and the
|
||||
* server logs.
|
||||
*/
|
||||
export declare function createLogger(): Logger;
|
||||
37
node_modules/edge-runtime/dist/cli/logger.js
generated
vendored
Normal file
37
node_modules/edge-runtime/dist/cli/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createLogger = exports.format = void 0;
|
||||
const format_1 = require("@edge-runtime/format");
|
||||
const picocolors_1 = __importDefault(require("picocolors"));
|
||||
const isEnabled = process.env.EDGE_RUNTIME_LOGGING !== undefined
|
||||
? Boolean(process.env.EDGE_RUNTIME_LOGGING)
|
||||
: true;
|
||||
exports.format = (0, format_1.createFormat)();
|
||||
/**
|
||||
* Creates basic logger with colors that can be used from the CLI and the
|
||||
* server logs.
|
||||
*/
|
||||
function createLogger() {
|
||||
const logger = function (message, opts) {
|
||||
print(message, opts);
|
||||
};
|
||||
logger.info = logger;
|
||||
logger.error = (message, opts) => print(message, { color: 'red', ...opts });
|
||||
logger.debug = (message, opts) => print(message, { color: 'dim', ...opts });
|
||||
logger.warn = (message, opts) => print(message, { color: 'yellow', ...opts });
|
||||
logger.quotes = (str) => `\`${str}\``;
|
||||
return logger;
|
||||
}
|
||||
exports.createLogger = createLogger;
|
||||
function print(message, { color = 'white', withHeader = true, withBreakline = false, } = {}) {
|
||||
if (!isEnabled)
|
||||
return;
|
||||
const colorize = picocolors_1.default[color];
|
||||
const header = withHeader ? `${colorize('ƒ')} ` : '';
|
||||
const separator = withBreakline ? '\n' : '';
|
||||
console.log(`${header}${separator}${colorize(message)}`);
|
||||
}
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/logger.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/logger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/cli/logger.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAmD;AAGnD,4DAA6B;AAE7B,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,SAAS;IAC5C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC3C,CAAC,CAAC,IAAI,CAAA;AAEG,QAAA,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAA;AAEpC;;;GAGG;AACH,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,UAAU,OAAe,EAAE,IAAoB;QAC5D,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACtB,CAAW,CAAA;IAEX,MAAM,CAAC,IAAI,GAAG,MAAM,CAAA;IACpB,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC3E,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC3E,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC7E,MAAM,CAAC,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;IAC7C,OAAO,MAAM,CAAA;AACf,CAAC;AAXD,oCAWC;AAED,SAAS,KAAK,CACZ,OAAe,EACf,EACE,KAAK,GAAG,OAAO,EACf,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,KAAK,MACJ,EAAE;IAErB,IAAI,CAAC,SAAS;QAAE,OAAM;IACtB,MAAM,QAAQ,GAAG,oBAAI,CAAC,KAAK,CAAc,CAAA;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACpD,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["import { createFormat } from '@edge-runtime/format'\nimport type { Logger, LoggerOptions } from '../types'\nimport type { Formatter } from 'picocolors/types'\nimport pico from 'picocolors'\n\nconst isEnabled =\n process.env.EDGE_RUNTIME_LOGGING !== undefined\n ? Boolean(process.env.EDGE_RUNTIME_LOGGING)\n : true\n\nexport const format = createFormat()\n\n/**\n * Creates basic logger with colors that can be used from the CLI and the\n * server logs.\n */\nexport function createLogger() {\n const logger = function (message: string, opts?: LoggerOptions) {\n print(message, opts)\n } as Logger\n\n logger.info = logger\n logger.error = (message, opts) => print(message, { color: 'red', ...opts })\n logger.debug = (message, opts) => print(message, { color: 'dim', ...opts })\n logger.warn = (message, opts) => print(message, { color: 'yellow', ...opts })\n logger.quotes = (str: string) => `\\`${str}\\``\n return logger\n}\n\nfunction print(\n message: string,\n {\n color = 'white',\n withHeader = true,\n withBreakline = false,\n }: LoggerOptions = {},\n) {\n if (!isEnabled) return\n const colorize = pico[color] as Formatter\n const header = withHeader ? `${colorize('ƒ')} ` : ''\n const separator = withBreakline ? '\\n' : ''\n console.log(`${header}${separator}${colorize(message)}`)\n}\n"]}
|
||||
4
node_modules/edge-runtime/dist/cli/repl.d.ts
generated
vendored
Normal file
4
node_modules/edge-runtime/dist/cli/repl.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="node" />
|
||||
import createRepl from 'repl';
|
||||
declare const repl: createRepl.REPLServer;
|
||||
export { repl };
|
||||
30
node_modules/edge-runtime/dist/cli/repl.js
generated
vendored
Normal file
30
node_modules/edge-runtime/dist/cli/repl.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.repl = void 0;
|
||||
const format_1 = require("@edge-runtime/format");
|
||||
const repl_1 = __importDefault(require("repl"));
|
||||
const os_1 = require("os");
|
||||
const path_1 = require("path");
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const format = (0, format_1.createFormat)();
|
||||
const writer = (output) => {
|
||||
return typeof output === 'function' ? output.toString() : format(output);
|
||||
};
|
||||
const repl = repl_1.default.start({ prompt: 'ƒ => ', writer });
|
||||
exports.repl = repl;
|
||||
repl.setupHistory((0, path_1.join)((0, os_1.homedir)(), '.edge_runtime_repl_history'), () => { });
|
||||
Object.getOwnPropertyNames(repl.context).forEach((mod) => delete repl.context[mod]);
|
||||
const runtime = new edge_runtime_1.EdgeRuntime();
|
||||
Object.getOwnPropertyNames(runtime.context)
|
||||
.filter((key) => !key.startsWith('__'))
|
||||
.forEach((key) => Object.assign(repl.context, { [key]: runtime.context[key] }));
|
||||
Object.defineProperty(repl.context, 'EdgeRuntime', {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: runtime.context.EdgeRuntime,
|
||||
});
|
||||
//# sourceMappingURL=repl.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/repl.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/repl.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/cli/repl.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAmD;AACnD,gDAA6B;AAC7B,2BAA4B;AAC5B,+BAA2B;AAE3B,kDAA6C;AAE7C,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAA;AAE7B,MAAM,MAAM,GAA0B,CAAC,MAAM,EAAE,EAAE;IAC/C,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC1E,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,cAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;AAsBjD,oBAAI;AArBb,IAAI,CAAC,YAAY,CAAC,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,4BAA4B,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAE1E,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAC9C,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAClC,CAAA;AAED,MAAM,OAAO,GAAG,IAAI,0BAAW,EAAE,CAAA;AAEjC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;KACxC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KACtC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAC7D,CAAA;AAEH,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE;IACjD,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;CACnC,CAAC,CAAA","sourcesContent":["import { createFormat } from '@edge-runtime/format'\nimport createRepl from 'repl'\nimport { homedir } from 'os'\nimport { join } from 'path'\n\nimport { EdgeRuntime } from '../edge-runtime'\n\nconst format = createFormat()\n\nconst writer: createRepl.REPLWriter = (output) => {\n return typeof output === 'function' ? output.toString() : format(output)\n}\n\nconst repl = createRepl.start({ prompt: 'ƒ => ', writer })\nrepl.setupHistory(join(homedir(), '.edge_runtime_repl_history'), () => {})\n\nObject.getOwnPropertyNames(repl.context).forEach(\n (mod) => delete repl.context[mod],\n)\n\nconst runtime = new EdgeRuntime()\n\nObject.getOwnPropertyNames(runtime.context)\n .filter((key) => !key.startsWith('__'))\n .forEach((key) =>\n Object.assign(repl.context, { [key]: runtime.context[key] }),\n )\n\nObject.defineProperty(repl.context, 'EdgeRuntime', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: runtime.context.EdgeRuntime,\n})\n\nexport { repl }\n"]}
|
||||
1
node_modules/edge-runtime/dist/edge-runtime.d.ts
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/edge-runtime.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { EdgeVM as EdgeRuntime } from '@edge-runtime/vm';
|
||||
6
node_modules/edge-runtime/dist/edge-runtime.js
generated
vendored
Normal file
6
node_modules/edge-runtime/dist/edge-runtime.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EdgeRuntime = void 0;
|
||||
var vm_1 = require("@edge-runtime/vm");
|
||||
Object.defineProperty(exports, "EdgeRuntime", { enumerable: true, get: function () { return vm_1.EdgeVM; } });
|
||||
//# sourceMappingURL=edge-runtime.js.map
|
||||
1
node_modules/edge-runtime/dist/edge-runtime.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/edge-runtime.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"edge-runtime.js","sourceRoot":"","sources":["../src/edge-runtime.ts"],"names":[],"mappings":";;;AAAA,uCAAwD;AAA/C,iGAAA,MAAM,OAAe","sourcesContent":["export { EdgeVM as EdgeRuntime } from '@edge-runtime/vm'\n"]}
|
||||
2
node_modules/edge-runtime/dist/index.d.ts
generated
vendored
Normal file
2
node_modules/edge-runtime/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { consumeUint8ArrayReadableStream, pipeBodyStreamToResponse, createHandler, runServer, } from './server';
|
||||
export { EdgeRuntime } from './edge-runtime';
|
||||
11
node_modules/edge-runtime/dist/index.js
generated
vendored
Normal file
11
node_modules/edge-runtime/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EdgeRuntime = exports.runServer = exports.createHandler = exports.pipeBodyStreamToResponse = exports.consumeUint8ArrayReadableStream = void 0;
|
||||
var server_1 = require("./server");
|
||||
Object.defineProperty(exports, "consumeUint8ArrayReadableStream", { enumerable: true, get: function () { return server_1.consumeUint8ArrayReadableStream; } });
|
||||
Object.defineProperty(exports, "pipeBodyStreamToResponse", { enumerable: true, get: function () { return server_1.pipeBodyStreamToResponse; } });
|
||||
Object.defineProperty(exports, "createHandler", { enumerable: true, get: function () { return server_1.createHandler; } });
|
||||
Object.defineProperty(exports, "runServer", { enumerable: true, get: function () { return server_1.runServer; } });
|
||||
var edge_runtime_1 = require("./edge-runtime");
|
||||
Object.defineProperty(exports, "EdgeRuntime", { enumerable: true, get: function () { return edge_runtime_1.EdgeRuntime; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/edge-runtime/dist/index.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAKiB;AAJf,yHAAA,+BAA+B,OAAA;AAC/B,kHAAA,wBAAwB,OAAA;AACxB,uGAAA,aAAa,OAAA;AACb,mGAAA,SAAS,OAAA;AAGX,+CAA4C;AAAnC,2GAAA,WAAW,OAAA","sourcesContent":["export {\n consumeUint8ArrayReadableStream,\n pipeBodyStreamToResponse,\n createHandler,\n runServer,\n} from './server'\n\nexport { EdgeRuntime } from './edge-runtime'\n"]}
|
||||
35
node_modules/edge-runtime/dist/server/body-streams.d.ts
generated
vendored
Normal file
35
node_modules/edge-runtime/dist/server/body-streams.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { IncomingMessage } from 'http';
|
||||
import type { Writable } from 'stream';
|
||||
type BodyStream = ReadableStream<Uint8Array>;
|
||||
/**
|
||||
* An interface that encapsulates body stream cloning
|
||||
* of an incoming request.
|
||||
*/
|
||||
export declare function getClonableBodyStream<T extends IncomingMessage>(incomingMessage: T, KUint8Array: typeof Uint8Array, KTransformStream: typeof TransformStream): {
|
||||
/**
|
||||
* Replaces the original request body if necessary.
|
||||
* This is done because once we read the body from the original request,
|
||||
* we can't read it again.
|
||||
*/
|
||||
finalize(): void;
|
||||
/**
|
||||
* Clones the body stream
|
||||
* to pass into a middleware
|
||||
*/
|
||||
cloneBodyStream(): BodyStream;
|
||||
};
|
||||
/**
|
||||
* Creates an async iterator from a ReadableStream that ensures that every
|
||||
* emitted chunk is a `Uint8Array`. If there is some invalid chunk it will
|
||||
* throw.
|
||||
*/
|
||||
export declare function consumeUint8ArrayReadableStream(body?: ReadableStream): AsyncGenerator<Uint8Array, void, unknown>;
|
||||
/**
|
||||
* Pipes the chunks of a BodyStream into a Response. This optimizes for
|
||||
* laziness, pauses reading if we experience back-pressure, and handles early
|
||||
* disconnects by the client on the other end of the server response.
|
||||
*/
|
||||
export declare function pipeBodyStreamToResponse(body: BodyStream | null, res: Writable): Promise<void>;
|
||||
export {};
|
||||
161
node_modules/edge-runtime/dist/server/body-streams.js
generated
vendored
Normal file
161
node_modules/edge-runtime/dist/server/body-streams.js
generated
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pipeBodyStreamToResponse = exports.consumeUint8ArrayReadableStream = exports.getClonableBodyStream = void 0;
|
||||
const stream_1 = require("stream");
|
||||
/**
|
||||
* An interface that encapsulates body stream cloning
|
||||
* of an incoming request.
|
||||
*/
|
||||
function getClonableBodyStream(incomingMessage, KUint8Array, KTransformStream) {
|
||||
let bufferedBodyStream = null;
|
||||
return {
|
||||
/**
|
||||
* Replaces the original request body if necessary.
|
||||
* This is done because once we read the body from the original request,
|
||||
* we can't read it again.
|
||||
*/
|
||||
finalize() {
|
||||
if (bufferedBodyStream) {
|
||||
replaceRequestBody(incomingMessage, bodyStreamToNodeStream(bufferedBodyStream));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Clones the body stream
|
||||
* to pass into a middleware
|
||||
*/
|
||||
cloneBodyStream() {
|
||||
const originalStream = bufferedBodyStream !== null && bufferedBodyStream !== void 0 ? bufferedBodyStream : requestToBodyStream(incomingMessage, KUint8Array, KTransformStream);
|
||||
const [stream1, stream2] = originalStream.tee();
|
||||
bufferedBodyStream = stream1;
|
||||
return stream2;
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.getClonableBodyStream = getClonableBodyStream;
|
||||
/**
|
||||
* Creates a ReadableStream from a Node.js HTTP request
|
||||
*/
|
||||
function requestToBodyStream(request, KUint8Array, KTransformStream) {
|
||||
const transform = new KTransformStream({
|
||||
start(controller) {
|
||||
request.on('data', (chunk) => controller.enqueue(new KUint8Array([...new Uint8Array(chunk)])));
|
||||
request.on('end', () => controller.terminate());
|
||||
request.on('error', (err) => controller.error(err));
|
||||
},
|
||||
});
|
||||
return transform.readable;
|
||||
}
|
||||
function bodyStreamToNodeStream(bodyStream) {
|
||||
const reader = bodyStream.getReader();
|
||||
return stream_1.Readable.from((async function* () {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
})());
|
||||
}
|
||||
function replaceRequestBody(base, stream) {
|
||||
for (const key in stream) {
|
||||
let v = stream[key];
|
||||
if (typeof v === 'function') {
|
||||
v = v.bind(stream);
|
||||
}
|
||||
base[key] = v;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
function isUint8ArrayChunk(value) {
|
||||
var _a;
|
||||
return ((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) == 'Uint8Array';
|
||||
}
|
||||
/**
|
||||
* Creates an async iterator from a ReadableStream that ensures that every
|
||||
* emitted chunk is a `Uint8Array`. If there is some invalid chunk it will
|
||||
* throw.
|
||||
*/
|
||||
async function* consumeUint8ArrayReadableStream(body) {
|
||||
const reader = body === null || body === void 0 ? void 0 : body.getReader();
|
||||
if (reader) {
|
||||
let error;
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
if (!isUint8ArrayChunk(value)) {
|
||||
error = new TypeError('This ReadableStream did not return bytes.');
|
||||
break;
|
||||
}
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (error) {
|
||||
reader.cancel(error);
|
||||
throw error;
|
||||
}
|
||||
else {
|
||||
reader.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.consumeUint8ArrayReadableStream = consumeUint8ArrayReadableStream;
|
||||
/**
|
||||
* Pipes the chunks of a BodyStream into a Response. This optimizes for
|
||||
* laziness, pauses reading if we experience back-pressure, and handles early
|
||||
* disconnects by the client on the other end of the server response.
|
||||
*/
|
||||
async function pipeBodyStreamToResponse(body, res) {
|
||||
if (!body)
|
||||
return;
|
||||
// If the client has already disconnected, then we don't need to pipe anything.
|
||||
if (res.destroyed)
|
||||
return body.cancel();
|
||||
// When the server pushes more data than the client reads, then we need to
|
||||
// wait for the client to catch up before writing more data. We register this
|
||||
// generic handler once so that we don't incur constant register/unregister
|
||||
// calls.
|
||||
let drainResolve;
|
||||
res.on('drain', () => drainResolve === null || drainResolve === void 0 ? void 0 : drainResolve());
|
||||
// If the user aborts, then we'll receive a close event before the
|
||||
// body closes. In that case, we want to end the streaming.
|
||||
let open = true;
|
||||
res.on('close', () => {
|
||||
open = false;
|
||||
drainResolve === null || drainResolve === void 0 ? void 0 : drainResolve();
|
||||
});
|
||||
const reader = body.getReader();
|
||||
while (open) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done)
|
||||
break;
|
||||
if (!isUint8ArrayChunk(value)) {
|
||||
const error = new TypeError('This ReadableStream did not return bytes.');
|
||||
reader.cancel(error);
|
||||
throw error;
|
||||
}
|
||||
if (open) {
|
||||
const bufferSpaceAvailable = res.write(value);
|
||||
// If there's no more space in the buffer, then we need to wait on the
|
||||
// client to read data before pushing again.
|
||||
if (!bufferSpaceAvailable) {
|
||||
await new Promise((res) => {
|
||||
drainResolve = res;
|
||||
});
|
||||
}
|
||||
}
|
||||
// If the client disconnected early, then we need to cleanup the stream.
|
||||
// This cannot be joined with the above if-statement, because the client may
|
||||
// have disconnected while waiting for a drain signal.
|
||||
if (!open) {
|
||||
return reader.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.pipeBodyStreamToResponse = pipeBodyStreamToResponse;
|
||||
//# sourceMappingURL=body-streams.js.map
|
||||
1
node_modules/edge-runtime/dist/server/body-streams.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/server/body-streams.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/edge-runtime/dist/server/create-handler.d.ts
generated
vendored
Normal file
26
node_modules/edge-runtime/dist/server/create-handler.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/// <reference types="node" />
|
||||
import type { EdgeRuntime } from '../edge-runtime';
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { Logger } from '../types';
|
||||
import type { EdgeContext } from '@edge-runtime/vm';
|
||||
export interface Options<T extends EdgeContext> {
|
||||
/**
|
||||
* A logger interface. If none is provided there will be no logs.
|
||||
*/
|
||||
logger?: Logger;
|
||||
/**
|
||||
* The runtime where the FetchEvent will be triggered whenever the server
|
||||
* receives a request.
|
||||
*/
|
||||
runtime: EdgeRuntime<T>;
|
||||
}
|
||||
/**
|
||||
* Creates an HHTP handler that can be used to create a Node.js HTTP server.
|
||||
* Whenever a request is handled it will transform it into a `dispatchFetch`
|
||||
* call for the given `EdgeRuntime`. Then it will transform the response
|
||||
* into an HTTP response.
|
||||
*/
|
||||
export declare function createHandler<T extends EdgeContext>(options: Options<T>): {
|
||||
handler: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
||||
waitUntil: () => Promise<unknown[]>;
|
||||
};
|
||||
94
node_modules/edge-runtime/dist/server/create-handler.js
generated
vendored
Normal file
94
node_modules/edge-runtime/dist/server/create-handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createHandler = void 0;
|
||||
const body_streams_1 = require("./body-streams");
|
||||
const pretty_ms_1 = __importDefault(require("pretty-ms"));
|
||||
const time_span_1 = __importDefault(require("time-span"));
|
||||
const http_1 = require("http");
|
||||
/**
|
||||
* Creates an HHTP handler that can be used to create a Node.js HTTP server.
|
||||
* Whenever a request is handled it will transform it into a `dispatchFetch`
|
||||
* call for the given `EdgeRuntime`. Then it will transform the response
|
||||
* into an HTTP response.
|
||||
*/
|
||||
function createHandler(options) {
|
||||
const awaiting = new Set();
|
||||
return {
|
||||
handler: async (req, res) => {
|
||||
var _a, _b;
|
||||
try {
|
||||
const start = (0, time_span_1.default)();
|
||||
const body = req.method !== 'GET' && req.method !== 'HEAD'
|
||||
? (0, body_streams_1.getClonableBodyStream)(req, options.runtime.evaluate('Uint8Array'), options.runtime.context.TransformStream)
|
||||
: undefined;
|
||||
const response = await options.runtime.dispatchFetch(String(getURL(req)), {
|
||||
headers: toRequestInitHeaders(req),
|
||||
method: req.method,
|
||||
body: body === null || body === void 0 ? void 0 : body.cloneBodyStream(),
|
||||
});
|
||||
const waitUntil = response.waitUntil();
|
||||
awaiting.add(waitUntil);
|
||||
waitUntil.finally(() => awaiting.delete(waitUntil));
|
||||
res.statusCode = response.status;
|
||||
res.statusMessage = response.statusText;
|
||||
for (const [key, value] of Object.entries(toNodeHeaders(response.headers))) {
|
||||
if (value !== undefined) {
|
||||
res.setHeader(key, value);
|
||||
}
|
||||
}
|
||||
await (0, body_streams_1.pipeBodyStreamToResponse)(response.body, res);
|
||||
const subject = `${req.socket.remoteAddress} ${req.method} ${req.url}`;
|
||||
const time = `${(_a = (0, pretty_ms_1.default)(start())
|
||||
.match(/[a-zA-Z]+|[0-9]+/g)) === null || _a === void 0 ? void 0 : _a.join(' ')}`;
|
||||
const code = `${res.statusCode} ${http_1.STATUS_CODES[res.statusCode]}`;
|
||||
(_b = options.logger) === null || _b === void 0 ? void 0 : _b.debug(`${subject} → ${code} in ${time}`);
|
||||
res.end();
|
||||
}
|
||||
finally {
|
||||
if (!res.writableEnded) {
|
||||
res.end();
|
||||
}
|
||||
}
|
||||
},
|
||||
waitUntil: () => Promise.all(awaiting),
|
||||
};
|
||||
}
|
||||
exports.createHandler = createHandler;
|
||||
/**
|
||||
* Builds a full URL from the provided incoming message. Note this function
|
||||
* is not safe as one can set has a host anything based on headers. It is
|
||||
* useful to build the fetch request full URL.
|
||||
*/
|
||||
function getURL(req) {
|
||||
var _a;
|
||||
const proto = ((_a = req.socket) === null || _a === void 0 ? void 0 : _a.encrypted) ? 'https' : 'http';
|
||||
return new URL(String(req.url), `${proto}://${String(req.headers.host)}`);
|
||||
}
|
||||
/**
|
||||
* Takes headers from IncomingMessage and transforms them into the signature
|
||||
* accepted by fetch. It simply folds headers into a single value when they
|
||||
* hold an array. For others it just copies the value.
|
||||
*/
|
||||
function toRequestInitHeaders(req) {
|
||||
return Object.keys(req.headers).map((key) => {
|
||||
const value = req.headers[key];
|
||||
return [key, Array.isArray(value) ? value.join(', ') : value !== null && value !== void 0 ? value : ''];
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Transforms WHATWG Headers into a Node Headers shape. Copies all items but
|
||||
* does a special case for Set-Cookie using the [`getSetCookie`](https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie) method.
|
||||
*/
|
||||
function toNodeHeaders(headers) {
|
||||
const result = {};
|
||||
if (headers) {
|
||||
for (const [key, value] of headers.entries()) {
|
||||
result[key] = key === 'set-cookie' ? headers.getSetCookie() : value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=create-handler.js.map
|
||||
1
node_modules/edge-runtime/dist/server/create-handler.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/server/create-handler.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/edge-runtime/dist/server/index.d.ts
generated
vendored
Normal file
3
node_modules/edge-runtime/dist/server/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export { consumeUint8ArrayReadableStream, pipeBodyStreamToResponse, } from './body-streams';
|
||||
export { createHandler } from './create-handler';
|
||||
export { runServer, EdgeRuntimeServer } from './run-server';
|
||||
11
node_modules/edge-runtime/dist/server/index.js
generated
vendored
Normal file
11
node_modules/edge-runtime/dist/server/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runServer = exports.createHandler = exports.pipeBodyStreamToResponse = exports.consumeUint8ArrayReadableStream = void 0;
|
||||
var body_streams_1 = require("./body-streams");
|
||||
Object.defineProperty(exports, "consumeUint8ArrayReadableStream", { enumerable: true, get: function () { return body_streams_1.consumeUint8ArrayReadableStream; } });
|
||||
Object.defineProperty(exports, "pipeBodyStreamToResponse", { enumerable: true, get: function () { return body_streams_1.pipeBodyStreamToResponse; } });
|
||||
var create_handler_1 = require("./create-handler");
|
||||
Object.defineProperty(exports, "createHandler", { enumerable: true, get: function () { return create_handler_1.createHandler; } });
|
||||
var run_server_1 = require("./run-server");
|
||||
Object.defineProperty(exports, "runServer", { enumerable: true, get: function () { return run_server_1.runServer; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/edge-runtime/dist/server/index.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/server/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;AAAA,+CAGuB;AAFrB,+HAAA,+BAA+B,OAAA;AAC/B,wHAAA,wBAAwB,OAAA;AAE1B,mDAAgD;AAAvC,+GAAA,aAAa,OAAA;AACtB,2CAA2D;AAAlD,uGAAA,SAAS,OAAA","sourcesContent":["export {\n consumeUint8ArrayReadableStream,\n pipeBodyStreamToResponse,\n} from './body-streams'\nexport { createHandler } from './create-handler'\nexport { runServer, EdgeRuntimeServer } from './run-server'\n"]}
|
||||
27
node_modules/edge-runtime/dist/server/run-server.d.ts
generated
vendored
Normal file
27
node_modules/edge-runtime/dist/server/run-server.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/// <reference types="node" />
|
||||
import { Options } from './create-handler';
|
||||
import type { EdgeContext } from '@edge-runtime/vm';
|
||||
import type { ListenOptions } from 'net';
|
||||
interface ServerOptions<T extends EdgeContext> extends Options<T> {
|
||||
}
|
||||
export interface EdgeRuntimeServer {
|
||||
/**
|
||||
* The server URL.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Waits for all the current effects and closes the server.
|
||||
*/
|
||||
close: () => Promise<void>;
|
||||
/**
|
||||
* Waits for all current effects returning their result.
|
||||
*/
|
||||
waitUntil: () => Promise<any[]>;
|
||||
}
|
||||
/**
|
||||
* This helper will create a handler based on the given options and then
|
||||
* immediately run a server on the provided port. If there is no port, the
|
||||
* server will use a random one.
|
||||
*/
|
||||
export declare function runServer<T extends EdgeContext>(options: ListenOptions & ServerOptions<T>): Promise<EdgeRuntimeServer>;
|
||||
export {};
|
||||
37
node_modules/edge-runtime/dist/server/run-server.js
generated
vendored
Normal file
37
node_modules/edge-runtime/dist/server/run-server.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runServer = void 0;
|
||||
const create_handler_1 = require("./create-handler");
|
||||
const async_listen_1 = __importDefault(require("async-listen"));
|
||||
const http_1 = __importDefault(require("http"));
|
||||
/**
|
||||
* This helper will create a handler based on the given options and then
|
||||
* immediately run a server on the provided port. If there is no port, the
|
||||
* server will use a random one.
|
||||
*/
|
||||
async function runServer(options) {
|
||||
if (options.port === undefined)
|
||||
options.port = 0;
|
||||
const { handler, waitUntil } = (0, create_handler_1.createHandler)(options);
|
||||
const server = http_1.default.createServer(handler);
|
||||
const url = await (0, async_listen_1.default)(server, options);
|
||||
return {
|
||||
url: String(url),
|
||||
close: async () => {
|
||||
await waitUntil();
|
||||
await new Promise((resolve, reject) => {
|
||||
return server.close((err) => {
|
||||
if (err)
|
||||
reject(err);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
waitUntil,
|
||||
};
|
||||
}
|
||||
exports.runServer = runServer;
|
||||
//# sourceMappingURL=run-server.js.map
|
||||
1
node_modules/edge-runtime/dist/server/run-server.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/server/run-server.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"run-server.js","sourceRoot":"","sources":["../../src/server/run-server.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAyD;AAEzD,gEAAiC;AACjC,gDAAuB;AAoBvB;;;;GAIG;AACI,KAAK,UAAU,SAAS,CAC7B,OAAyC;IAEzC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,GAAG,CAAC,CAAA;IAChD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAA,8BAAa,EAAC,OAAO,CAAC,CAAA;IACrD,MAAM,MAAM,GAAG,cAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;IACzC,MAAM,GAAG,GAAG,MAAM,IAAA,sBAAM,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEzC,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;QAChB,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,SAAS,EAAE,CAAA;YACjB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBAC1B,IAAI,GAAG;wBAAE,MAAM,CAAC,GAAG,CAAC,CAAA;oBACpB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,SAAS;KACV,CAAA;AACH,CAAC;AArBD,8BAqBC","sourcesContent":["import { createHandler, Options } from './create-handler'\nimport type { EdgeContext } from '@edge-runtime/vm'\nimport listen from 'async-listen'\nimport http from 'http'\nimport type { ListenOptions } from 'net'\n\ninterface ServerOptions<T extends EdgeContext> extends Options<T> {}\n\nexport interface EdgeRuntimeServer {\n /**\n * The server URL.\n */\n url: string\n /**\n * Waits for all the current effects and closes the server.\n */\n close: () => Promise<void>\n /**\n * Waits for all current effects returning their result.\n */\n waitUntil: () => Promise<any[]>\n}\n\n/**\n * This helper will create a handler based on the given options and then\n * immediately run a server on the provided port. If there is no port, the\n * server will use a random one.\n */\nexport async function runServer<T extends EdgeContext>(\n options: ListenOptions & ServerOptions<T>,\n): Promise<EdgeRuntimeServer> {\n if (options.port === undefined) options.port = 0\n const { handler, waitUntil } = createHandler(options)\n const server = http.createServer(handler)\n const url = await listen(server, options)\n\n return {\n url: String(url),\n close: async () => {\n await waitUntil()\n await new Promise<void>((resolve, reject) => {\n return server.close((err) => {\n if (err) reject(err)\n resolve()\n })\n })\n },\n waitUntil,\n }\n}\n"]}
|
||||
17
node_modules/edge-runtime/dist/types.d.ts
generated
vendored
Normal file
17
node_modules/edge-runtime/dist/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { Colors } from 'picocolors/types';
|
||||
export interface LoggerOptions {
|
||||
color?: keyof Colors;
|
||||
withHeader?: boolean;
|
||||
withBreakline?: boolean;
|
||||
}
|
||||
export interface Logger {
|
||||
(message: string, opts?: LoggerOptions): void;
|
||||
warn(message: string, opts?: LoggerOptions): void;
|
||||
debug(message: string, opts?: LoggerOptions): void;
|
||||
error(message: string, opts?: LoggerOptions): void;
|
||||
info(message: string, opts?: LoggerOptions): void;
|
||||
quotes(str: string): string;
|
||||
}
|
||||
export interface NodeHeaders {
|
||||
[header: string]: string | string[] | undefined;
|
||||
}
|
||||
3
node_modules/edge-runtime/dist/types.js
generated
vendored
Normal file
3
node_modules/edge-runtime/dist/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/edge-runtime/dist/types.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/types.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Colors } from 'picocolors/types'\n\nexport interface LoggerOptions {\n color?: keyof Colors\n withHeader?: boolean\n withBreakline?: boolean\n}\n\nexport interface Logger {\n (message: string, opts?: LoggerOptions): void\n warn(message: string, opts?: LoggerOptions): void\n debug(message: string, opts?: LoggerOptions): void\n error(message: string, opts?: LoggerOptions): void\n info(message: string, opts?: LoggerOptions): void\n quotes(str: string): string\n}\n\nexport interface NodeHeaders {\n [header: string]: string | string[] | undefined\n}\n"]}
|
||||
25
node_modules/edge-runtime/node_modules/async-listen/README.md
generated
vendored
Normal file
25
node_modules/edge-runtime/node_modules/async-listen/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# async-listen
|
||||
|
||||
Promisify `server.listen` for your HTTP/HTTPS/TCP server.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install async-listen
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import listen from 'async-listen';
|
||||
import { createServer } from 'http';
|
||||
|
||||
async function main() {
|
||||
const port = 3000;
|
||||
const server = createServer();
|
||||
const address = await listen(server, port);
|
||||
console.log(address); // => URL('http://127.0.0.1:3000')
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
```
|
||||
12
node_modules/edge-runtime/node_modules/async-listen/dist/index.d.ts
generated
vendored
Normal file
12
node_modules/edge-runtime/node_modules/async-listen/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as net from 'net';
|
||||
import { EventEmitter } from 'events';
|
||||
import type { OverloadedParameters } from './overloaded-parameters';
|
||||
export interface ServerLike extends EventEmitter {
|
||||
listen: (...args: any[]) => any;
|
||||
address: net.Server['address'];
|
||||
protocol?: string;
|
||||
}
|
||||
export declare function listen<Server extends ServerLike>(server: Server, ...args: OverloadedParameters<Server['listen']>): Promise<URL>;
|
||||
export default listen;
|
||||
50
node_modules/edge-runtime/node_modules/async-listen/dist/index.js
generated
vendored
Normal file
50
node_modules/edge-runtime/node_modules/async-listen/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.listen = void 0;
|
||||
const http = require("http");
|
||||
const https = require("https");
|
||||
const path_1 = require("path");
|
||||
const events_1 = require("events");
|
||||
const getProtocol = (server) => {
|
||||
if (typeof server.protocol === 'string')
|
||||
return server.protocol;
|
||||
if (server instanceof http.Server)
|
||||
return 'http';
|
||||
if (server instanceof https.Server)
|
||||
return 'https';
|
||||
};
|
||||
async function listen(server, ...args) {
|
||||
server.listen(...args, () => { });
|
||||
await (0, events_1.once)(server, 'listening');
|
||||
const addressInfo = server.address();
|
||||
if (!addressInfo) {
|
||||
// `server.address()` returns `null` before the `'listening'`
|
||||
// event has been emitted or after calling `server.close()`.
|
||||
throw new Error('Server not listening');
|
||||
}
|
||||
let host;
|
||||
let protocol = getProtocol(server);
|
||||
if (typeof addressInfo === 'string') {
|
||||
// For a server listening on a pipe or Unix domain socket,
|
||||
// the name is returned as a string.
|
||||
host = encodeURIComponent((0, path_1.resolve)(addressInfo));
|
||||
if (protocol) {
|
||||
protocol += '+unix';
|
||||
}
|
||||
else {
|
||||
protocol = 'unix';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Bound to a TCP port.
|
||||
const { address, port, family } = addressInfo;
|
||||
host = family === 'IPv6' ? `[${address}]` : address;
|
||||
host += `:${port}`;
|
||||
if (!protocol) {
|
||||
protocol = 'tcp';
|
||||
}
|
||||
}
|
||||
return new URL(`${protocol}://${host}`);
|
||||
}
|
||||
exports.listen = listen;
|
||||
exports.default = listen;
|
||||
231
node_modules/edge-runtime/node_modules/async-listen/dist/overloaded-parameters.d.ts
generated
vendored
Normal file
231
node_modules/edge-runtime/node_modules/async-listen/dist/overloaded-parameters.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
export type OverloadedParameters<T> = T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
(...args: infer A19): any;
|
||||
(...args: infer A20): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 | A20 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
(...args: infer A19): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 | A19 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
(...args: infer A18): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 | A18 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
(...args: infer A17): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 | A17 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
(...args: infer A16): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 | A16 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
(...args: infer A15): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 | A15 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
(...args: infer A14): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 | A14 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
(...args: infer A13): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 | A13 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
(...args: infer A12): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 | A12 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
(...args: infer A11): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | A11 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
(...args: infer A10): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
(...args: infer A9): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 | A9 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
(...args: infer A8): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
(...args: infer A7): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 | A7 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
(...args: infer A6): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 | A6 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
(...args: infer A5): any;
|
||||
} ? A1 | A2 | A3 | A4 | A5 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
(...args: infer A4): any;
|
||||
} ? A1 | A2 | A3 | A4 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
(...args: infer A3): any;
|
||||
} ? A1 | A2 | A3 : T extends {
|
||||
(...args: infer A1): any;
|
||||
(...args: infer A2): any;
|
||||
} ? A1 | A2 : T extends {
|
||||
(...args: infer A1): any;
|
||||
} ? A1 : any;
|
||||
2
node_modules/edge-runtime/node_modules/async-listen/dist/overloaded-parameters.js
generated
vendored
Normal file
2
node_modules/edge-runtime/node_modules/async-listen/dist/overloaded-parameters.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
38
node_modules/edge-runtime/node_modules/async-listen/package.json
generated
vendored
Normal file
38
node_modules/edge-runtime/node_modules/async-listen/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "async-listen",
|
||||
"description": "`net.Server#listen()` helper that returns a Promise for async / await",
|
||||
"version": "3.0.1",
|
||||
"main": "./dist/index.js",
|
||||
"repository": "vercel/async-listen",
|
||||
"keywords": [
|
||||
"async",
|
||||
"await",
|
||||
"es6",
|
||||
"http",
|
||||
"listen",
|
||||
"net",
|
||||
"promise",
|
||||
"server"
|
||||
],
|
||||
"packageManager": "pnpm@7.33.3",
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.10",
|
||||
"@types/tap": "^15.0.8",
|
||||
"tap": "^16.3.4",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepublishOnly": "tsc",
|
||||
"test": "tap --no-check-coverage --ts"
|
||||
},
|
||||
"license": "MIT",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
61
node_modules/edge-runtime/package.json
generated
vendored
Normal file
61
node_modules/edge-runtime/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"name": "edge-runtime",
|
||||
"description": "Run any Edge Function from CLI or Node.js module.",
|
||||
"homepage": "https://edge-runtime.vercel.app/packages/runtime",
|
||||
"version": "2.5.9",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"edge-runtime": "dist/cli/index.js"
|
||||
},
|
||||
"repository": {
|
||||
"directory": "packages/runtime",
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vercel/edge-runtime.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vercel/edge-runtime/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"edge",
|
||||
"edge-runtime",
|
||||
"functions",
|
||||
"runtime",
|
||||
"standard",
|
||||
"web"
|
||||
],
|
||||
"dependencies": {
|
||||
"async-listen": "3.0.1",
|
||||
"mri": "1.2.0",
|
||||
"picocolors": "1.0.0",
|
||||
"pretty-ms": "7.0.1",
|
||||
"signal-exit": "4.0.2",
|
||||
"time-span": "4.0.0",
|
||||
"@edge-runtime/format": "2.2.1",
|
||||
"@edge-runtime/ponyfill": "2.4.2",
|
||||
"@edge-runtime/vm": "3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-fetch": "2",
|
||||
"node-fetch": "2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.prod.json",
|
||||
"clean": "pnpm run clean:node && pnpm run clean:build",
|
||||
"clean:build": "rm -rf dist",
|
||||
"clean:node": "rm -rf node_modules",
|
||||
"postversion": "pnpm run build",
|
||||
"prebuild": "pnpm run clean:build",
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue