@fastly/compute-js-static-publish 8.1.0-beta.7 → 8.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -2
- package/DOCUMENTATION.md +112 -70
- package/MIGRATING.md +45 -15
- package/README.md +6 -5
- package/README.short.md +6 -5
- package/build/cli/cli/commands/manage/clean.js +1 -1
- package/build/cli/cli/commands/manage/collections/delete.js +1 -1
- package/build/cli/cli/commands/manage/collections/index.js +1 -1
- package/build/cli/cli/commands/manage/collections/list.js +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +1 -1
- package/build/cli/cli/commands/manage/collections/update-expiration.js +1 -1
- package/build/cli/cli/commands/manage/index.js +2 -2
- package/build/cli/cli/commands/manage/publish-content.js +1 -1
- package/build/cli/cli/commands/manage/status.js +1 -1
- package/build/cli/cli/commands/manage/template/index.js +1 -1
- package/build/cli/cli/commands/manage/template/init.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/template/init.js +11 -4
- package/build/cli/cli/commands/scaffold/app-template.js +1 -1
- package/build/cli/cli/commands/scaffold/generate-app.d.ts +1 -1
- package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -1
- package/build/cli/cli/commands/scaffold/generate-app.js +1 -1
- package/build/cli/cli/commands/scaffold/index.js +5 -5
- package/build/cli/cli/hono/build.d.ts +21 -14
- package/build/cli/cli/hono/build.d.ts.map +1 -1
- package/build/cli/cli/hono/build.js +119 -76
- package/build/cli/cli/managed/app.js +4 -4
- package/build/cli/cli/managed/command-helpers.js +6 -6
- package/build/cli/cli/managed/project-file.js +6 -6
- package/build/cli/cli/managed/template-init.js +3 -3
- package/build/cli/cli/storage/kv-store-local-provider.d.ts +2 -2
- package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-local-provider.js +2 -14
- package/build/cli/cli/storage/kv-store-provider.d.ts +2 -2
- package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-provider.js +2 -1
- package/build/cli/cli/storage/s3-storage-provider.d.ts +2 -2
- package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/s3-storage-provider.js +4 -3
- package/build/cli/cli/storage/storage-provider.d.ts +3 -1
- package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/storage-provider.js +16 -0
- package/build/cli/cli/util/kv-store.d.ts +1 -1
- package/build/cli/cli/util/kv-store.d.ts.map +1 -1
- package/build/cli/models/config/static-publish-rc.d.ts +4 -3
- package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
- package/build/cli/models/config/template-settings.d.ts.map +1 -1
- package/build/cli/models/config/template-settings.js +34 -9
- package/build/server/hono/compose.d.ts +51 -0
- package/build/server/hono/compose.d.ts.map +1 -0
- package/build/server/hono/compose.js +93 -0
- package/build/server/hono/index.d.ts +1 -1
- package/build/server/hono/index.d.ts.map +1 -1
- package/build/server/hono/index.js +1 -1
- package/build/server/models/config/static-publish-rc.d.ts +4 -3
- package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
- package/build/server/server/index.d.ts +1 -1
- package/build/server/server/index.d.ts.map +1 -1
- package/build/server/server/publisher-server/index.d.ts.map +1 -1
- package/build/server/server/publisher-server/index.js +6 -1
- package/build/server/server/storage/kv-store-provider.d.ts.map +1 -1
- package/build/server/server/storage/kv-store-provider.js +1 -0
- package/build/server/server/storage/s3-storage-provider.d.ts +2 -2
- package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/server/server/storage/s3-storage-provider.js +5 -2
- package/build/server/server/storage/storage-provider.d.ts +12 -1
- package/build/server/server/storage/storage-provider.d.ts.map +1 -1
- package/package.json +2 -2
- package/resources/template-init/hono/_example.ts +14 -13
- package/resources/templates/hono/package-lock.json +40 -40
- package/resources/templates/hono/package.json +2 -2
- package/resources/templates/hono/scripts/template_postinstall.js +5 -5
- package/resources/templates/hono/scripts/template_prebuild.js +6 -6
- package/resources/templates/hono/scripts/template_watch.js +5 -4
- package/resources/templates/hono/src/hono-compose.generated.d.ts +5 -0
- package/resources/templates/hono/src/index.ts +14 -14
- package/resources/templates/plain/package-lock.json +40 -40
- package/resources/templates/plain/package.json +2 -2
- package/build/server/hono/extensions.d.ts +0 -50
- package/build/server/hono/extensions.d.ts.map +0 -1
- package/build/server/hono/extensions.js +0 -70
- package/resources/templates/hono/src/hono-extensions.generated.d.ts +0 -5
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This CLI tool helps you:
|
|
|
6
6
|
|
|
7
7
|
- ✅ Deploy static sites to Fastly Compute with zero backend
|
|
8
8
|
- 📦 Store files in Fastly KV Store efficiently
|
|
9
|
-
- 🎁 Since v8: Support for S3-compatible storage such as Fastly Object Storage
|
|
9
|
+
- 🎁 Since v8: Support for S3-compatible storage such as Fastly Object Storage
|
|
10
10
|
- 🗂 Publish to named collections (`live`, `preview-42`, etc.)
|
|
11
11
|
- 🔄 Switch between collections at runtime
|
|
12
12
|
- 🧹 Clean up old or expired assets
|
|
@@ -21,7 +21,7 @@ Create a directory for your project, place your static files in `./public`, then
|
|
|
21
21
|
npx @fastly/compute-js-static-publish@beta --root-dir=./public --kv-store-name=site-content
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**Since v8:** S3-compatible storage (such as Fastly Object Storage) is also supported
|
|
24
|
+
**Since v8:** S3-compatible storage (such as Fastly Object Storage) is also supported. To use this mode, type:
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
|
|
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3
|
|
|
29
29
|
|
|
30
30
|
If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
|
|
31
31
|
|
|
32
|
-
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage
|
|
32
|
+
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage) section in the full documentation.
|
|
33
33
|
|
|
34
34
|
**New in 8.1:** a managed project has only one file in your repo, `static-publish.project.js`, and the CLI generates the app. Add `--template=hono` for a Hono app:
|
|
35
35
|
|
|
@@ -82,15 +82,16 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
|
|
|
82
82
|
- **Managed projects:** keep only `static-publish.project.js` in your repo. The CLI generates the app, and `dev`, `deploy`, `status`, `upgrade`, and `eject` work with it. ([Managed and ejected apps](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#managed-and-ejected-apps))
|
|
83
83
|
- **Previews:** serve another collection for a request, selected by host, path, query, cookie, or header. ([Previews](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-previews-collection-selection))
|
|
84
84
|
- **Hidden files:** publish files that the server does not serve for a request, for your own code to read. Deploy your app with 8.1 before you publish hidden files: an app built with 8.0 does not serve a collection that has hidden files. ([Hidden files](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#hidden-files))
|
|
85
|
-
- **Hono:** the `hono` template (`--template=hono`), with your own middleware and routes in `hono-
|
|
85
|
+
- **Hono:** the `hono` template (`--template=hono`), with your own middleware and routes as plugin modules in `hono-compose/`, and examples for GRIP streaming and OAuth login. For your own Hono app, `@fastly/compute-js-static-publish/hono` replaces `@fastly/hono-compute-js-static-publish`. ([Using Hono](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-hono))
|
|
86
86
|
- **CI:** `--json` output, exit codes, error codes, `--project-dir`, and `--non-interactive`. ([Using the CLI in CI](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-the-cli-in-ci))
|
|
87
|
+
- **Streaming response cache:** on a cache miss, the file goes to the visitor and into the cache at the same time, so the visitor does not wait for the whole file, and the request uses less memory. Apps from the `plain` and `hono` templates do this; in your own code, use `serveRequestStreaming()` and pass `fillPromise` to `event.waitUntil()`. It needs `@fastly/js-compute` 4.2 or later on a Fastly service. ([Streaming the response into the cache](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#streaming-the-response-into-the-cache))
|
|
87
88
|
|
|
88
89
|
Before you upgrade, read [CHANGELOG.md](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/CHANGELOG.md). These changes can break something:
|
|
89
90
|
|
|
90
91
|
- The name of a new collection must be a DNS label: lowercase `a-z`, `0-9`, and `-`, from 1 to 63 characters, with no `-` at the start or the end. A collection that exists continues to work with another name, with a warning.
|
|
91
92
|
- A usage or config error exits with `2`. Before, every error exited with `1`.
|
|
92
93
|
- `collectionSelector.fromCookie()`: the activate and reset paths redirect with `308`. Before, they used `302`.
|
|
93
|
-
- `PublisherServer`: the fields `serverTiming`, `settingsCached`, and `assetEntryMapCache` are read-only (deprecated).
|
|
94
|
+
- `PublisherServer`: the fields `serverTiming`, `settingsCached`, and `assetEntryMapCache` are read-only (deprecated). An assignment to them throws a `TypeError` (and is a TypeScript error).
|
|
94
95
|
|
|
95
96
|
## Features
|
|
96
97
|
|
package/README.short.md
CHANGED
|
@@ -6,7 +6,7 @@ This CLI tool helps you:
|
|
|
6
6
|
|
|
7
7
|
- ✅ Deploy static sites to Fastly Compute with zero backend
|
|
8
8
|
- 📦 Store files in Fastly KV Store efficiently
|
|
9
|
-
- 🎁 Since v8: Support for S3-compatible storage such as Fastly Object Storage
|
|
9
|
+
- 🎁 Since v8: Support for S3-compatible storage such as Fastly Object Storage
|
|
10
10
|
- 🗂 Publish to named collections (`live`, `preview-42`, etc.)
|
|
11
11
|
- 🔄 Switch between collections at runtime
|
|
12
12
|
- 🧹 Clean up old or expired assets
|
|
@@ -21,7 +21,7 @@ Create a directory for your project, place your static files in `./public`, then
|
|
|
21
21
|
npx @fastly/compute-js-static-publish@beta --root-dir=./public --kv-store-name=site-content
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**Since v8:** S3-compatible storage (such as Fastly Object Storage) is also supported
|
|
24
|
+
**Since v8:** S3-compatible storage (such as Fastly Object Storage) is also supported. To use this mode, type:
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
|
|
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@beta --root-dir=./public --storage-mode=s3
|
|
|
29
29
|
|
|
30
30
|
If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
|
|
31
31
|
|
|
32
|
-
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage
|
|
32
|
+
For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-s3-compatible-storage) section in the full documentation.
|
|
33
33
|
|
|
34
34
|
**New in 8.1:** a managed project has only one file in your repo, `static-publish.project.js`, and the CLI generates the app. Add `--template=hono` for a Hono app:
|
|
35
35
|
|
|
@@ -82,15 +82,16 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
|
|
|
82
82
|
- **Managed projects:** keep only `static-publish.project.js` in your repo. The CLI generates the app, and `dev`, `deploy`, `status`, `upgrade`, and `eject` work with it. ([Managed and ejected apps](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#managed-and-ejected-apps))
|
|
83
83
|
- **Previews:** serve another collection for a request, selected by host, path, query, cookie, or header. ([Previews](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-previews-collection-selection))
|
|
84
84
|
- **Hidden files:** publish files that the server does not serve for a request, for your own code to read. Deploy your app with 8.1 before you publish hidden files: an app built with 8.0 does not serve a collection that has hidden files. ([Hidden files](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#hidden-files))
|
|
85
|
-
- **Hono:** the `hono` template (`--template=hono`), with your own middleware and routes in `hono-
|
|
85
|
+
- **Hono:** the `hono` template (`--template=hono`), with your own middleware and routes as plugin modules in `hono-compose/`, and examples for GRIP streaming and OAuth login. For your own Hono app, `@fastly/compute-js-static-publish/hono` replaces `@fastly/hono-compute-js-static-publish`. ([Using Hono](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-hono))
|
|
86
86
|
- **CI:** `--json` output, exit codes, error codes, `--project-dir`, and `--non-interactive`. ([Using the CLI in CI](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#-using-the-cli-in-ci))
|
|
87
|
+
- **Streaming response cache:** on a cache miss, the file goes to the visitor and into the cache at the same time, so the visitor does not wait for the whole file, and the request uses less memory. Apps from the `plain` and `hono` templates do this; in your own code, use `serveRequestStreaming()` and pass `fillPromise` to `event.waitUntil()`. It needs `@fastly/js-compute` 4.2 or later on a Fastly service. ([Streaming the response into the cache](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/README.md#streaming-the-response-into-the-cache))
|
|
87
88
|
|
|
88
89
|
Before you upgrade, read [CHANGELOG.md](https://github.com/fastly/compute-js-static-publish/blob/beta/8.1/CHANGELOG.md). These changes can break something:
|
|
89
90
|
|
|
90
91
|
- The name of a new collection must be a DNS label: lowercase `a-z`, `0-9`, and `-`, from 1 to 63 characters, with no `-` at the start or the end. A collection that exists continues to work with another name, with a warning.
|
|
91
92
|
- A usage or config error exits with `2`. Before, every error exited with `1`.
|
|
92
93
|
- `collectionSelector.fromCookie()`: the activate and reset paths redirect with `308`. Before, they used `302`.
|
|
93
|
-
- `PublisherServer`: the fields `serverTiming`, `settingsCached`, and `assetEntryMapCache` are read-only (deprecated).
|
|
94
|
+
- `PublisherServer`: the fields `serverTiming`, `settingsCached`, and `assetEntryMapCache` are read-only (deprecated). An assignment to them throws a `TypeError` (and is a TypeScript error).
|
|
94
95
|
|
|
95
96
|
## Features
|
|
96
97
|
|
|
@@ -39,7 +39,7 @@ KV Store Options:
|
|
|
39
39
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
40
40
|
environment variable.
|
|
41
41
|
|
|
42
|
-
S3 Storage Options
|
|
42
|
+
S3 Storage Options:
|
|
43
43
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
44
44
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
45
45
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -48,7 +48,7 @@ Purge Options:
|
|
|
48
48
|
comma-separated list of both. Can be repeated.
|
|
49
49
|
Default: production
|
|
50
50
|
|
|
51
|
-
S3 Storage Options
|
|
51
|
+
S3 Storage Options:
|
|
52
52
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
53
53
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
54
54
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -35,7 +35,7 @@ KV Store Options:
|
|
|
35
35
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
36
36
|
environment variable.
|
|
37
37
|
|
|
38
|
-
S3 Storage Options
|
|
38
|
+
S3 Storage Options:
|
|
39
39
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
40
40
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
41
41
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -28,7 +28,7 @@ KV Store Options:
|
|
|
28
28
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
29
29
|
environment variable.
|
|
30
30
|
|
|
31
|
-
S3 Storage Options
|
|
31
|
+
S3 Storage Options:
|
|
32
32
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
33
33
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
34
34
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -67,7 +67,7 @@ Purge Options:
|
|
|
67
67
|
comma-separated list of both. Can be repeated.
|
|
68
68
|
Default: production
|
|
69
69
|
|
|
70
|
-
S3 Storage Options
|
|
70
|
+
S3 Storage Options:
|
|
71
71
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
72
72
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
73
73
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -47,7 +47,7 @@ KV Store Options:
|
|
|
47
47
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
48
48
|
environment variable.
|
|
49
49
|
|
|
50
|
-
S3 Storage Options
|
|
50
|
+
S3 Storage Options:
|
|
51
51
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
52
52
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
53
53
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -38,7 +38,7 @@ Available Commands:
|
|
|
38
38
|
upgrade Move a managed project to the version of this CLI
|
|
39
39
|
eject Convert a managed project into an ejected app
|
|
40
40
|
template init Make or update the folder of the app's template
|
|
41
|
-
(for the hono template: hono-
|
|
41
|
+
(for the hono template: hono-compose/)
|
|
42
42
|
|
|
43
43
|
KV Store Options:
|
|
44
44
|
--local Instead of working with the Fastly KV Store, operate on
|
|
@@ -50,7 +50,7 @@ KV Store Options:
|
|
|
50
50
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
51
51
|
environment variable.
|
|
52
52
|
|
|
53
|
-
S3 Storage Options
|
|
53
|
+
S3 Storage Options:
|
|
54
54
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
55
55
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
56
56
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -91,7 +91,7 @@ KV Store Options:
|
|
|
91
91
|
|
|
92
92
|
--kv-overwrite Alias for --overwrite-existing.
|
|
93
93
|
|
|
94
|
-
S3 Storage Options
|
|
94
|
+
S3 Storage Options:
|
|
95
95
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
96
96
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
97
97
|
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
@@ -130,7 +130,7 @@ export async function action(actionArgs) {
|
|
|
130
130
|
const baseUrl = domain != null ? `https://${domain}` : 'https://<service domain>';
|
|
131
131
|
const previewUrls = project.rc.collectionSelection != null ? previewUrlTemplates(baseUrl, project.rc.collectionSelection) : [];
|
|
132
132
|
// The packages that the template provides to its folder (for example to the
|
|
133
|
-
//
|
|
133
|
+
// plugin modules in hono-compose/), with the versions of the generated app.
|
|
134
134
|
const templateName = project.managed.template ?? DEFAULT_APP_TEMPLATE_NAME;
|
|
135
135
|
const providedPackages = providedVersions(templateName, path.resolve(MANAGED_APP_DIR, 'node_modules'), running);
|
|
136
136
|
console.log(`Mode : managed`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/template/init.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAyCtF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAGnC,OAAO,EAAE,MAAM,CAAC;IAEhB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AASF,wBAAsB,eAAe,CAAC,MAAM,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/template/init.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAyCtF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAGnC,OAAO,EAAE,MAAM,CAAC;IAEhB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AASF,wBAAsB,eAAe,CAAC,MAAM,EAAE,qBAAqB,iBA4DlE;AAED,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAsEhD"}
|
|
@@ -7,7 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import readline from 'node:readline/promises';
|
|
8
8
|
import { MANAGED_APP_DIR, PROJECT_FILE_NAME, RC_FILE_NAME } from '../../../../models/config/static-publish-project.js';
|
|
9
9
|
import { DEFAULT_APP_TEMPLATE_NAME } from '../../scaffold/app-template.js';
|
|
10
|
-
import {
|
|
10
|
+
import { DEFAULT_PLUGINS_DIR } from '../../../hono/build.js';
|
|
11
11
|
import { loadManagedProject } from '../../../managed/command-helpers.js';
|
|
12
12
|
import { applyTemplateInit, planTemplateInit, providedVersions, templateHasInit } from '../../../managed/template-init.js';
|
|
13
13
|
import { parseCommandLine } from '../../../util/args.js';
|
|
@@ -23,14 +23,14 @@ Usage:
|
|
|
23
23
|
|
|
24
24
|
Description:
|
|
25
25
|
Makes or updates the folder of the app's template: for the hono template,
|
|
26
|
-
the
|
|
26
|
+
the folder of the plugins (build.hono.composeDir, default ./hono-compose).
|
|
27
27
|
The template is managed.template in ${PROJECT_FILE_NAME}, or
|
|
28
28
|
generatedFrom.template in ${RC_FILE_NAME}.
|
|
29
29
|
|
|
30
30
|
A new folder gets package.json, tsconfig.json, .gitignore, and an inactive
|
|
31
31
|
example. In a folder that exists, it updates only the peer dependencies on
|
|
32
32
|
the packages that the app provides, and adds the starter files that are
|
|
33
|
-
missing. It never changes your
|
|
33
|
+
missing. It never changes your plugins. Then run npm install in the folder.
|
|
34
34
|
|
|
35
35
|
Options:
|
|
36
36
|
--reset Also write the starter files again (tsconfig.json,
|
|
@@ -47,7 +47,7 @@ Global Options:
|
|
|
47
47
|
// The folder of a template.
|
|
48
48
|
function templateFolderDir(templateName, rc, baseDir) {
|
|
49
49
|
// Only the hono template has a folder.
|
|
50
|
-
return path.resolve(baseDir, rc.build?.hono?.
|
|
50
|
+
return path.resolve(baseDir, rc.build?.hono?.composeDir ?? DEFAULT_PLUGINS_DIR);
|
|
51
51
|
}
|
|
52
52
|
// template init for a template and a folder. scaffold also runs it.
|
|
53
53
|
export async function runTemplateInit(params) {
|
|
@@ -58,6 +58,13 @@ export async function runTemplateInit(params) {
|
|
|
58
58
|
}
|
|
59
59
|
const folderDir = templateFolderDir(templateName, rc, baseDir);
|
|
60
60
|
const folderName = rootRelative(folderDir);
|
|
61
|
+
// The name of the folder in earlier betas of 8.1. A new empty folder would
|
|
62
|
+
// hide the plugins in the old one, so template init stops. Removed in v9.
|
|
63
|
+
const oldDir = path.resolve(path.dirname(folderDir), 'hono-extensions');
|
|
64
|
+
if (templateName === 'hono' && !fs.existsSync(folderDir) && fs.existsSync(oldDir) && fs.readdirSync(oldDir).length > 0) {
|
|
65
|
+
fail('config-invalid', `The folder hono-extensions/ is now hono-compose/. Rename it (${rootRelative(oldDir)}), then run template init again.`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
61
68
|
const provided = providedVersions(templateName, appNodeModulesDir, getOwnVersion());
|
|
62
69
|
const plan = planTemplateInit(templateName, folderDir, provided, { reset });
|
|
63
70
|
if (check) {
|
|
@@ -9,7 +9,7 @@ import { resourcesDir } from '../../util/resources.js';
|
|
|
9
9
|
// that it adds to the .gitignore of the app.
|
|
10
10
|
const APP_TEMPLATES = {
|
|
11
11
|
plain: { supports: { collectionSelection: true }, gitignore: [] },
|
|
12
|
-
hono: { supports: { collectionSelection: true }, gitignore: ['/src/hono-
|
|
12
|
+
hono: { supports: { collectionSelection: true }, gitignore: ['/src/hono-compose.generated.js'] },
|
|
13
13
|
};
|
|
14
14
|
export const APP_TEMPLATE_NAMES = Object.keys(APP_TEMPLATES);
|
|
15
15
|
export const DEFAULT_APP_TEMPLATE_NAME = 'plain';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/generate-app.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAGpH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EACH;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACzC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9J,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,OAAO,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Selection,
|
|
120
120
|
build: build?.hono != null ?
|
|
121
|
-
{ hono: {
|
|
121
|
+
{ hono: { composeDir: dotRelative(computeJsDir, build.hono.composeDir).split(path.sep).join('/') } } :
|
|
122
122
|
undefined,
|
|
123
123
|
templateOptions,
|
|
124
124
|
});
|
|
@@ -38,7 +38,7 @@ Description:
|
|
|
38
38
|
|
|
39
39
|
Options:
|
|
40
40
|
--storage-mode <mode> Storage mode for content storage.
|
|
41
|
-
Can be "kv-store" or "s3"
|
|
41
|
+
Can be "kv-store" or "s3".
|
|
42
42
|
(default: kv-store)
|
|
43
43
|
If --storage-mode=kv-store, then:
|
|
44
44
|
--kv-store-name <name> (required) Name of the KV Store.
|
|
@@ -706,7 +706,7 @@ export async function action(actionArgs) {
|
|
|
706
706
|
console.log('KV Store Name :', kvStoreName);
|
|
707
707
|
}
|
|
708
708
|
else if (storageMode === 's3') {
|
|
709
|
-
console.log('Storage Name : S3 (or compatible) storage
|
|
709
|
+
console.log('Storage Name : S3 (or compatible) storage');
|
|
710
710
|
console.log('S3 Region :', s3Region);
|
|
711
711
|
console.log('S3 Bucket :', s3Bucket);
|
|
712
712
|
console.log('S3 Endpoint :', String(s3EndpointUrl));
|
|
@@ -753,9 +753,9 @@ export async function action(actionArgs) {
|
|
|
753
753
|
autoExt,
|
|
754
754
|
staticPublishVersionSpec: findComputeJsStaticPublisherVersion(packageJson),
|
|
755
755
|
template: loadAppTemplate(options.template),
|
|
756
|
-
// The hono template: the
|
|
756
|
+
// The hono template: the folder of the plugins is in the directory where
|
|
757
757
|
// scaffold runs (next to the app, or next to the project file).
|
|
758
|
-
...(options.template === 'hono' ? { build: { hono: {
|
|
758
|
+
...(options.template === 'hono' ? { build: { hono: { composeDir: path.resolve('hono-compose') } } } : {}),
|
|
759
759
|
generatedFrom: {
|
|
760
760
|
template: options.template,
|
|
761
761
|
staticPublishVersion: getOwnVersion(),
|
|
@@ -786,7 +786,7 @@ export async function action(actionArgs) {
|
|
|
786
786
|
console.log(`npm --prefix ${COMPUTE_JS_DIR} install`);
|
|
787
787
|
child_process.spawnSync('npm', ['--prefix', COMPUTE_JS_DIR, 'install'], { stdio: 'inherit' });
|
|
788
788
|
console.log('');
|
|
789
|
-
// The folder of the template (for the hono template: hono-
|
|
789
|
+
// The folder of the template (for the hono template: hono-compose/, next
|
|
790
790
|
// to the app). It is in the directory where scaffold runs.
|
|
791
791
|
if (templateHasInit(options.template)) {
|
|
792
792
|
await runTemplateInit({
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export type
|
|
1
|
+
export declare const PLUGINS_MANIFEST = "src/hono-compose.generated.js";
|
|
2
|
+
export declare const DEFAULT_PLUGINS_DIR = "./hono-compose";
|
|
3
|
+
export type PluginFile = {
|
|
4
4
|
name: string;
|
|
5
5
|
file: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
7
|
+
export declare function listPlugins(composeDir: string): PluginFile[];
|
|
8
|
+
export declare function pluginsExternals(appDir: string): string[];
|
|
9
9
|
type Rc = {
|
|
10
10
|
build?: {
|
|
11
11
|
hono?: {
|
|
12
|
-
|
|
12
|
+
composeDir?: string;
|
|
13
|
+
extensionsDir?: unknown;
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
16
|
templateOptions?: {
|
|
16
17
|
hono?: {
|
|
17
|
-
|
|
18
|
+
compose?: {
|
|
19
|
+
plugins?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
extensions?: unknown;
|
|
18
22
|
};
|
|
19
23
|
};
|
|
20
24
|
};
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
25
|
+
export declare function pluginsDir(appDir: string, rc: Rc): string;
|
|
26
|
+
export declare function writePluginsStub(options: {
|
|
23
27
|
appDir: string;
|
|
24
28
|
}): boolean;
|
|
25
|
-
export declare function checkProvidedVersions(appDir: string,
|
|
29
|
+
export declare function checkProvidedVersions(appDir: string, composeDir: string): string[];
|
|
26
30
|
type Esbuild = {
|
|
27
31
|
build: (options: any) => Promise<{
|
|
28
32
|
outputFiles?: {
|
|
@@ -30,14 +34,17 @@ type Esbuild = {
|
|
|
30
34
|
}[];
|
|
31
35
|
}>;
|
|
32
36
|
};
|
|
33
|
-
export type
|
|
37
|
+
export type BundlePluginsOptions = {
|
|
34
38
|
appDir: string;
|
|
35
39
|
esbuild: Esbuild;
|
|
36
40
|
};
|
|
37
|
-
export declare function
|
|
38
|
-
export type
|
|
41
|
+
export declare function bundlePlugins(options: BundlePluginsOptions): Promise<boolean>;
|
|
42
|
+
export type PluginsWatcher = {
|
|
39
43
|
close: () => void;
|
|
40
44
|
};
|
|
41
|
-
export declare function
|
|
45
|
+
export declare function watchPlugins(options: BundlePluginsOptions): Promise<PluginsWatcher>;
|
|
46
|
+
export declare function bundleHonoExtensions(..._args: unknown[]): never;
|
|
47
|
+
export declare function watchHonoExtensions(..._args: unknown[]): never;
|
|
48
|
+
export declare function writeHonoExtensionsStub(..._args: unknown[]): never;
|
|
42
49
|
export {};
|
|
43
50
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/hono/build.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/hono/build.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,gBAAgB,kCAAkC,CAAC;AAIhE,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAUpD,MAAM,MAAM,UAAU,GAAG;IAGvB,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CA4B5D;AAUD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzD;AAED,K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