@fastly/compute-js-static-publish 8.0.0 → 8.1.0-beta.1
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/DOCUMENTATION.md +1984 -0
- package/README.md +11 -4
- package/README.short.md +11 -4
- package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/clean.js +12 -7
- package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/delete.js +29 -13
- package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/index.js +6 -1
- package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/list.js +47 -7
- package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +67 -20
- package/build/cli/cli/commands/manage/collections/update-expiration.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/update-expiration.js +10 -11
- package/build/cli/cli/commands/manage/deploy.d.ts +2 -0
- package/build/cli/cli/commands/manage/deploy.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/deploy.js +194 -0
- package/build/cli/cli/commands/manage/dev.d.ts +2 -0
- package/build/cli/cli/commands/manage/dev.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/dev.js +77 -0
- package/build/cli/cli/commands/manage/eject.d.ts +2 -0
- package/build/cli/cli/commands/manage/eject.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/eject.js +155 -0
- package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/index.js +37 -1
- package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/publish-content.js +85 -35
- package/build/cli/cli/commands/manage/status.d.ts +2 -0
- package/build/cli/cli/commands/manage/status.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/status.js +162 -0
- package/build/cli/cli/commands/manage/template/index.d.ts +2 -0
- package/build/cli/cli/commands/manage/template/index.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/template/index.js +42 -0
- package/build/cli/cli/commands/manage/template/init.d.ts +13 -0
- package/build/cli/cli/commands/manage/template/init.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/template/init.js +172 -0
- package/build/cli/cli/commands/manage/upgrade.d.ts +2 -0
- package/build/cli/cli/commands/manage/upgrade.d.ts.map +1 -0
- package/build/cli/cli/commands/manage/upgrade.js +59 -0
- package/build/cli/cli/commands/run-dev-watch.d.ts +8 -0
- package/build/cli/cli/commands/run-dev-watch.d.ts.map +1 -0
- package/build/cli/cli/commands/run-dev-watch.js +41 -0
- package/build/cli/cli/commands/run-template-hook.d.ts +2 -0
- package/build/cli/cli/commands/run-template-hook.d.ts.map +1 -0
- package/build/cli/cli/commands/run-template-hook.js +28 -0
- package/build/cli/cli/commands/scaffold/app-template.d.ts +17 -0
- package/build/cli/cli/commands/scaffold/app-template.d.ts.map +1 -0
- package/build/cli/cli/commands/scaffold/app-template.js +54 -0
- package/build/cli/cli/commands/scaffold/fastly-toml-sections.d.ts +5 -0
- package/build/cli/cli/commands/scaffold/fastly-toml-sections.d.ts.map +1 -0
- package/build/cli/cli/commands/scaffold/fastly-toml-sections.js +154 -0
- package/build/cli/cli/commands/scaffold/generate-app.d.ts +47 -0
- package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -0
- package/build/cli/cli/commands/scaffold/generate-app.js +164 -0
- package/build/cli/cli/commands/scaffold/index.d.ts +6 -0
- package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
- package/build/cli/cli/commands/scaffold/index.js +239 -300
- package/build/cli/cli/commands/scaffold/render.d.ts +7 -0
- package/build/cli/cli/commands/scaffold/render.d.ts.map +1 -0
- package/build/cli/cli/commands/scaffold/render.js +72 -0
- package/build/cli/cli/hono/build.d.ts +43 -0
- package/build/cli/cli/hono/build.d.ts.map +1 -0
- package/build/cli/cli/hono/build.js +297 -0
- package/build/cli/cli/index.js +98 -5
- package/build/cli/cli/managed/app.d.ts +21 -0
- package/build/cli/cli/managed/app.d.ts.map +1 -0
- package/build/cli/cli/managed/app.js +162 -0
- package/build/cli/cli/managed/command-helpers.d.ts +6 -0
- package/build/cli/cli/managed/command-helpers.d.ts.map +1 -0
- package/build/cli/cli/managed/command-helpers.js +81 -0
- package/build/cli/cli/managed/eject.d.ts +6 -0
- package/build/cli/cli/managed/eject.d.ts.map +1 -0
- package/build/cli/cli/managed/eject.js +68 -0
- package/build/cli/cli/managed/fastly-service.d.ts +8 -0
- package/build/cli/cli/managed/fastly-service.d.ts.map +1 -0
- package/build/cli/cli/managed/fastly-service.js +21 -0
- package/build/cli/cli/managed/fingerprint.d.ts +13 -0
- package/build/cli/cli/managed/fingerprint.d.ts.map +1 -0
- package/build/cli/cli/managed/fingerprint.js +60 -0
- package/build/cli/cli/managed/lockfile.d.ts +31 -0
- package/build/cli/cli/managed/lockfile.d.ts.map +1 -0
- package/build/cli/cli/managed/lockfile.js +62 -0
- package/build/cli/cli/managed/project-edit.d.ts +3 -0
- package/build/cli/cli/managed/project-edit.d.ts.map +1 -0
- package/build/cli/cli/managed/project-edit.js +35 -0
- package/build/cli/cli/managed/project-file.d.ts +16 -0
- package/build/cli/cli/managed/project-file.d.ts.map +1 -0
- package/build/cli/cli/managed/project-file.js +119 -0
- package/build/cli/cli/managed/template-init.d.ts +12 -0
- package/build/cli/cli/managed/template-init.d.ts.map +1 -0
- package/build/cli/cli/managed/template-init.js +120 -0
- package/build/cli/cli/managed/version-check.d.ts +25 -0
- package/build/cli/cli/managed/version-check.d.ts.map +1 -0
- package/build/cli/cli/managed/version-check.js +84 -0
- package/build/cli/cli/storage/kv-store-local-provider.d.ts +1 -0
- package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-local-provider.js +6 -3
- package/build/cli/cli/storage/kv-store-provider.d.ts +2 -1
- package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-provider.js +17 -6
- package/build/cli/cli/storage/s3-storage-provider.d.ts +1 -0
- package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/s3-storage-provider.js +8 -2
- package/build/cli/cli/storage/storage-provider.d.ts +4 -0
- package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/storage-provider.js +32 -0
- package/build/cli/cli/util/api-token.d.ts +2 -1
- package/build/cli/cli/util/api-token.d.ts.map +1 -1
- package/build/cli/cli/util/api-token.js +38 -3
- package/build/cli/cli/util/collection-name.d.ts +3 -0
- package/build/cli/cli/util/collection-name.d.ts.map +1 -0
- package/build/cli/cli/util/collection-name.js +24 -0
- package/build/cli/cli/util/collection-selection-flags.d.ts +13 -0
- package/build/cli/cli/util/collection-selection-flags.d.ts.map +1 -0
- package/build/cli/cli/util/collection-selection-flags.js +131 -0
- package/build/cli/cli/util/config.d.ts +13 -0
- package/build/cli/cli/util/config.d.ts.map +1 -1
- package/build/cli/cli/util/config.js +172 -38
- package/build/cli/cli/util/data.d.ts.map +1 -1
- package/build/cli/cli/util/global-options.d.ts +13 -0
- package/build/cli/cli/util/global-options.d.ts.map +1 -0
- package/build/cli/cli/util/global-options.js +53 -0
- package/build/cli/cli/util/kv-store-items.d.ts +1 -0
- package/build/cli/cli/util/kv-store-items.d.ts.map +1 -1
- package/build/cli/cli/util/kv-store-items.js +16 -40
- package/build/cli/cli/util/kv-store-local-server.d.ts +1 -1
- package/build/cli/cli/util/kv-store-local-server.d.ts.map +1 -1
- package/build/cli/cli/util/kv-store-local-server.js +4 -2
- package/build/cli/cli/util/output.d.ts +31 -0
- package/build/cli/cli/util/output.d.ts.map +1 -0
- package/build/cli/cli/util/output.js +139 -0
- package/build/cli/cli/util/package.d.ts +3 -0
- package/build/cli/cli/util/package.d.ts.map +1 -1
- package/build/cli/cli/util/package.js +12 -0
- package/build/cli/cli/util/progress.d.ts +11 -0
- package/build/cli/cli/util/progress.d.ts.map +1 -0
- package/build/cli/cli/util/progress.js +32 -0
- package/build/cli/cli/util/purge.d.ts +15 -3
- package/build/cli/cli/util/purge.d.ts.map +1 -1
- package/build/cli/cli/util/purge.js +23 -10
- package/build/cli/cli/util/resources.d.ts +2 -0
- package/build/cli/cli/util/resources.d.ts.map +1 -0
- package/build/cli/cli/util/resources.js +8 -0
- package/build/cli/cli/util/service-id.d.ts +1 -0
- package/build/cli/cli/util/service-id.d.ts.map +1 -1
- package/build/cli/cli/util/service-id.js +5 -1
- package/build/cli/cli/util/variants.d.ts.map +1 -1
- package/build/cli/models/assets/index.d.ts +6 -0
- package/build/cli/models/assets/index.d.ts.map +1 -1
- package/build/cli/models/assets/index.js +24 -0
- package/build/cli/models/collections/index.d.ts +3 -0
- package/build/cli/models/collections/index.d.ts.map +1 -0
- package/build/cli/models/collections/index.js +15 -0
- package/build/cli/models/compression/index.d.ts +1 -1
- package/build/cli/models/compression/index.d.ts.map +1 -1
- package/build/cli/models/config/collection-selection.d.ts +55 -0
- package/build/cli/models/config/collection-selection.d.ts.map +1 -0
- package/build/cli/models/config/collection-selection.js +238 -0
- package/build/cli/models/config/item-patterns.d.ts +4 -0
- package/build/cli/models/config/item-patterns.d.ts.map +1 -0
- package/build/cli/models/config/item-patterns.js +43 -0
- package/build/cli/models/config/publish-content-config.d.ts +6 -1
- package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
- package/build/cli/models/config/static-publish-project.d.ts +23 -0
- package/build/cli/models/config/static-publish-project.d.ts.map +1 -0
- package/build/cli/models/config/static-publish-project.js +11 -0
- package/build/cli/models/config/static-publish-rc.d.ts +25 -0
- package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
- package/build/cli/models/config/static-publish-rc.js +31 -0
- package/build/cli/models/config/template-settings.d.ts +10 -0
- package/build/cli/models/config/template-settings.d.ts.map +1 -0
- package/build/cli/models/config/template-settings.js +72 -0
- package/build/cli/models/server/index.d.ts.map +1 -1
- package/build/cli/models/server/index.js +6 -2
- package/build/server/hono/extensions.d.ts +48 -0
- package/build/server/hono/extensions.d.ts.map +1 -0
- package/build/server/hono/extensions.js +65 -0
- package/build/server/hono/index.d.ts +30 -0
- package/build/server/hono/index.d.ts.map +1 -0
- package/build/server/hono/index.js +72 -0
- package/build/server/hono/path.d.ts +7 -0
- package/build/server/hono/path.d.ts.map +1 -0
- package/build/server/hono/path.js +32 -0
- package/build/server/models/assets/index.d.ts +6 -0
- package/build/server/models/assets/index.d.ts.map +1 -1
- package/build/server/models/assets/index.js +24 -0
- package/build/server/models/collections/index.d.ts +3 -0
- package/build/server/models/collections/index.d.ts.map +1 -0
- package/build/server/models/collections/index.js +15 -0
- package/build/server/models/compression/index.d.ts +1 -1
- package/build/server/models/compression/index.d.ts.map +1 -1
- package/build/server/models/config/collection-selection.d.ts +55 -0
- package/build/server/models/config/collection-selection.d.ts.map +1 -0
- package/build/server/models/config/collection-selection.js +238 -0
- package/build/server/models/config/item-patterns.d.ts +4 -0
- package/build/server/models/config/item-patterns.d.ts.map +1 -0
- package/build/server/models/config/item-patterns.js +43 -0
- package/build/server/models/config/publish-content-config.d.ts +6 -1
- package/build/server/models/config/publish-content-config.d.ts.map +1 -1
- package/build/server/models/config/static-publish-project.d.ts +23 -0
- package/build/server/models/config/static-publish-project.d.ts.map +1 -0
- package/build/server/models/config/static-publish-project.js +11 -0
- package/build/server/models/config/static-publish-rc.d.ts +25 -0
- package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
- package/build/server/models/config/static-publish-rc.js +31 -0
- package/build/server/models/server/index.d.ts.map +1 -1
- package/build/server/models/server/index.js +6 -2
- package/build/server/server/collection-selection/index.d.ts +11 -0
- package/build/server/server/collection-selection/index.d.ts.map +1 -0
- package/build/server/server/collection-selection/index.js +192 -0
- package/build/server/server/collection-selector/from-cookie.d.ts.map +1 -1
- package/build/server/server/collection-selector/from-cookie.js +6 -8
- package/build/server/server/collection-selector/from-request.d.ts.map +1 -1
- package/build/server/server/index.d.ts +4 -1
- package/build/server/server/index.d.ts.map +1 -1
- package/build/server/server/index.js +3 -1
- package/build/server/server/publisher-server/accept-html.d.ts +2 -0
- package/build/server/server/publisher-server/accept-html.d.ts.map +1 -0
- package/build/server/server/publisher-server/accept-html.js +50 -0
- package/build/server/server/publisher-server/index.d.ts +59 -6
- package/build/server/server/publisher-server/index.d.ts.map +1 -1
- package/build/server/server/publisher-server/index.js +370 -131
- package/build/server/server/publisher-server/response-cache.d.ts +3 -0
- package/build/server/server/publisher-server/response-cache.d.ts.map +1 -1
- package/build/server/server/publisher-server/response-cache.js +24 -1
- package/build/server/server/storage/kv-store-provider.d.ts.map +1 -1
- package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/server/server/storage/storage-provider.d.ts.map +1 -1
- package/build/server/server/util/body-length.d.ts.map +1 -1
- package/build/server/server/util/server-timing.d.ts.map +1 -1
- package/package.json +23 -4
- package/resources/app/fastly.toml.njk +58 -0
- package/resources/app/gitignore.njk +9 -0
- package/resources/app/publish-content.config.from-project.js.njk +9 -0
- package/resources/app/publish-content.config.js.njk +35 -0
- package/resources/app/static-publish.project.js.njk +83 -0
- package/resources/app/static-publish.rc.js.njk +43 -0
- package/resources/template-init/hono/_example.ts +22 -0
- package/resources/template-init/hono/tsconfig.json +17 -0
- package/resources/templates/hono/package-lock.json +4123 -0
- package/resources/templates/hono/package.json +15 -0
- package/resources/templates/hono/scripts/template_postinstall.js +10 -0
- package/resources/templates/hono/scripts/template_prebuild.js +8 -0
- package/resources/templates/hono/scripts/template_watch.js +15 -0
- package/resources/templates/hono/src/hono-extensions.generated.d.ts +5 -0
- package/resources/templates/hono/src/index.ts +53 -0
- package/resources/templates/hono/tsconfig.json +17 -0
- package/resources/templates/plain/package-lock.json +4088 -0
- package/resources/templates/plain/package.json +10 -0
- package/resources/templates/plain/src/index.js +34 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Fastly, Inc.
|
|
3
|
+
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
+
*/
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { isS3StorageConfigRc } from '../../models/config/static-publish-rc.js';
|
|
7
|
+
import { DEFAULT_HONO_EXTENSIONS_DIR } from '../hono/build.js';
|
|
8
|
+
import { getKvStoreConfigFromRc } from '../../models/config/kv-store-config.js';
|
|
9
|
+
import { renderAppResource } from '../commands/scaffold/render.js';
|
|
10
|
+
import { dotRelative } from '../util/files.js';
|
|
11
|
+
// The line in the managed section that deploy replaces with the service ID
|
|
12
|
+
// after the first deploy. resources/app/static-publish.project.js.njk writes it.
|
|
13
|
+
export const SERVICE_ID_PLACEHOLDER_LINE = ' serviceId: undefined,';
|
|
14
|
+
// The text of static-publish.project.js for an app config. projectDir is the
|
|
15
|
+
// directory of the file. The paths in the file are relative to it.
|
|
16
|
+
// appConfigFromProject() gives the same app config back.
|
|
17
|
+
export function renderProjectFile(config, projectDir, staticPublishVersion) {
|
|
18
|
+
const relative = (to) => {
|
|
19
|
+
const result = dotRelative(projectDir, to).split(path.sep).join('/');
|
|
20
|
+
return result === './' ? '.' : result;
|
|
21
|
+
};
|
|
22
|
+
const publicDirPrefix = config.publicDir !== config.rootDir ? config.publicDir.slice(config.rootDir.length).split(path.sep).join('/') : '';
|
|
23
|
+
const staticItems = config.staticDirs.map(dir => {
|
|
24
|
+
const item = dir.slice(config.publicDir.length).split(path.sep).join('/');
|
|
25
|
+
return item.endsWith('/') ? item : item + '/';
|
|
26
|
+
});
|
|
27
|
+
const assetKey = (file) => file != null ? file.slice(config.rootDir.length).split(path.sep).join('/') : false;
|
|
28
|
+
return renderAppResource('static-publish.project.js', {
|
|
29
|
+
storage: config.storage,
|
|
30
|
+
s3EndpointUrl: config.storage.mode === 's3' ? String(new URL(config.storage.endpointUrl)) : undefined,
|
|
31
|
+
publishId: config.publishId,
|
|
32
|
+
defaultCollectionName: config.defaultCollectionName,
|
|
33
|
+
staticPublisherWorkingDir: relative(config.staticPublisherWorkingDir),
|
|
34
|
+
collectionSelection: config.collectionSelection,
|
|
35
|
+
// The extensions folder only if it is not the default, next to this file.
|
|
36
|
+
build: config.build?.hono != null && config.build.hono.extensionsDir !== path.resolve(projectDir, DEFAULT_HONO_EXTENSIONS_DIR) ?
|
|
37
|
+
{ hono: { extensionsDir: relative(config.build.hono.extensionsDir) } } :
|
|
38
|
+
undefined,
|
|
39
|
+
templateOptions: config.templateOptions,
|
|
40
|
+
rootDir: relative(config.rootDir),
|
|
41
|
+
publicDirPrefix,
|
|
42
|
+
staticItems,
|
|
43
|
+
spaFile: assetKey(config.spaFilename),
|
|
44
|
+
notFoundPageFile: assetKey(config.notFoundPageFilename),
|
|
45
|
+
autoExt: config.autoExt,
|
|
46
|
+
autoIndex: config.autoIndex,
|
|
47
|
+
name: config.name,
|
|
48
|
+
description: config.description,
|
|
49
|
+
authors: config.author != null ? [config.author] : [],
|
|
50
|
+
template: config.template.name,
|
|
51
|
+
serviceId: config.serviceId,
|
|
52
|
+
staticPublishVersion,
|
|
53
|
+
fastlyToml: config.fastlyToml,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// The app config of a managed project. The publish settings come from the
|
|
57
|
+
// normalized publishContent section.
|
|
58
|
+
export function appConfigFromProject(rc, publishContent, managed, options) {
|
|
59
|
+
const { projectDir, appDir } = options;
|
|
60
|
+
const server = publishContent.server ?? {};
|
|
61
|
+
const rootDir = path.resolve(projectDir, publishContent.rootDir);
|
|
62
|
+
const publicDir = server.publicDirPrefix ? path.resolve(rootDir, '.' + server.publicDirPrefix) : rootDir;
|
|
63
|
+
// Only the directory items of staticItems map onto --static-dir.
|
|
64
|
+
const staticDirs = (server.staticItems ?? [])
|
|
65
|
+
.filter(item => item.startsWith('/') && item.endsWith('/'))
|
|
66
|
+
.map(item => path.resolve(publicDir, '.' + item));
|
|
67
|
+
const fileOf = (assetKey) => assetKey != null ? path.resolve(rootDir, '.' + assetKey) : undefined;
|
|
68
|
+
let storage;
|
|
69
|
+
if (isS3StorageConfigRc(rc)) {
|
|
70
|
+
let endpointUrl;
|
|
71
|
+
if (rc.s3.endpoint != null) {
|
|
72
|
+
endpointUrl = String(new URL(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(rc.s3.endpoint) ? rc.s3.endpoint : `https://${rc.s3.endpoint}`));
|
|
73
|
+
}
|
|
74
|
+
else if (options.s3EndpointUrl != null) {
|
|
75
|
+
endpointUrl = options.s3EndpointUrl;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
throw new Error('The S3 endpoint of the project is not resolved.');
|
|
79
|
+
}
|
|
80
|
+
storage = { mode: 's3', region: rc.s3.region, bucket: rc.s3.bucket, endpointUrl, endpointGenerated: rc.s3.endpoint == null };
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
storage = { mode: 'kv-store', kvStoreName: getKvStoreConfigFromRc(rc).kvStoreName };
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
appDir,
|
|
87
|
+
name: managed.name,
|
|
88
|
+
author: managed.authors?.[0],
|
|
89
|
+
description: managed.description,
|
|
90
|
+
serviceId: managed.serviceId,
|
|
91
|
+
storage,
|
|
92
|
+
publishId: rc.publishId,
|
|
93
|
+
defaultCollectionName: rc.defaultCollectionName,
|
|
94
|
+
staticPublisherWorkingDir: path.resolve(projectDir, rc.staticPublisherWorkingDir),
|
|
95
|
+
rootDir,
|
|
96
|
+
publicDir,
|
|
97
|
+
staticDirs,
|
|
98
|
+
spaFilename: fileOf(server.spaFile),
|
|
99
|
+
notFoundPageFilename: fileOf(server.notFoundPageFile),
|
|
100
|
+
autoIndex: server.autoIndex ?? [],
|
|
101
|
+
autoExt: server.autoExt ?? [],
|
|
102
|
+
staticPublishVersionSpec: options.staticPublishVersionSpec,
|
|
103
|
+
template: options.template,
|
|
104
|
+
// A managed project has no generatedFrom: its generated rc must not change each day.
|
|
105
|
+
generatedFrom: undefined,
|
|
106
|
+
...(rc.collectionSelection != null ? { collectionSelection: rc.collectionSelection } : {}),
|
|
107
|
+
...(managed.fastlyToml != null ? { fastlyToml: managed.fastlyToml } : {}),
|
|
108
|
+
// The hono template: the extensions folder, relative to the project file
|
|
109
|
+
// (default: next to it). The generated rc gets it relative to the app dir.
|
|
110
|
+
...(options.template.name === 'hono' ?
|
|
111
|
+
{ build: { hono: { extensionsDir: path.resolve(projectDir, rc.build?.hono?.extensionsDir ?? DEFAULT_HONO_EXTENSIONS_DIR) } } } :
|
|
112
|
+
{}),
|
|
113
|
+
// Only the options of the app's template, so that a change to the options
|
|
114
|
+
// of another template does not change the app.
|
|
115
|
+
...(rc.templateOptions?.[options.template.name] != null ?
|
|
116
|
+
{ templateOptions: { [options.template.name]: rc.templateOptions[options.template.name] } } :
|
|
117
|
+
{}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function templateHasInit(templateName: string): boolean;
|
|
2
|
+
export declare function providedVersions(templateName: string, appNodeModulesDir: string | undefined, ownVersion: string): Record<string, string>;
|
|
3
|
+
export type TemplateInitPlan = {
|
|
4
|
+
write: Record<string, string>;
|
|
5
|
+
replace: string[];
|
|
6
|
+
outOfDate: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function planTemplateInit(templateName: string, folderDir: string, provided: Record<string, string>, options: {
|
|
9
|
+
reset: boolean;
|
|
10
|
+
}): TemplateInitPlan;
|
|
11
|
+
export declare function applyTemplateInit(folderDir: string, plan: TemplateInitPlan): void;
|
|
12
|
+
//# sourceMappingURL=template-init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-init.d.ts","sourceRoot":"","sources":["../../../../src/cli/managed/template-init.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE7D;AAwBD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAexI;AAED,MAAM,MAAM,gBAAgB,GAAG;IAE7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAKF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,gBAAgB,CAsDzJ;AAGD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,QAM1E"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Fastly, Inc.
|
|
3
|
+
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
+
*/
|
|
5
|
+
// template init: makes or updates the folder of a template, for example
|
|
6
|
+
// hono-extensions/ of the hono template. The starter files are in
|
|
7
|
+
// resources/template-init/<template>/. The template owns the peer dependencies
|
|
8
|
+
// on the packages that it provides; the customer owns everything else.
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { loadAppTemplate } from '../commands/scaffold/app-template.js';
|
|
12
|
+
import { resourcesDir } from '../util/resources.js';
|
|
13
|
+
import { pinnedVersion } from './lockfile.js';
|
|
14
|
+
const THIS_PACKAGE = '@fastly/compute-js-static-publish';
|
|
15
|
+
// The templates that have a folder for template init.
|
|
16
|
+
export function templateHasInit(templateName) {
|
|
17
|
+
return fs.existsSync(path.resolve(resourcesDir, 'template-init', templateName));
|
|
18
|
+
}
|
|
19
|
+
// The starter files of a template, keyed by the path relative to its folder.
|
|
20
|
+
function starterFiles(templateName) {
|
|
21
|
+
const dir = path.resolve(resourcesDir, 'template-init', templateName);
|
|
22
|
+
const files = {};
|
|
23
|
+
const walk = (sub) => {
|
|
24
|
+
for (const entry of fs.readdirSync(path.resolve(dir, sub), { withFileTypes: true })) {
|
|
25
|
+
const rel = sub === '' ? entry.name : `${sub}/${entry.name}`;
|
|
26
|
+
if (entry.isDirectory()) {
|
|
27
|
+
walk(rel);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
files[rel] = fs.readFileSync(path.resolve(dir, rel), 'utf-8');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
walk('');
|
|
35
|
+
return files;
|
|
36
|
+
}
|
|
37
|
+
// The packages that the app of a template provides to the code in the
|
|
38
|
+
// template's folder, with their versions: the dependencies of the template, and
|
|
39
|
+
// this package. A version comes from the app's node_modules if it is installed
|
|
40
|
+
// there, else from the template's lockfile.
|
|
41
|
+
export function providedVersions(templateName, appNodeModulesDir, ownVersion) {
|
|
42
|
+
const result = {};
|
|
43
|
+
for (const name of Object.keys(loadAppTemplate(templateName).dependencies).sort()) {
|
|
44
|
+
let version;
|
|
45
|
+
const installed = appNodeModulesDir != null ? path.resolve(appNodeModulesDir, name, 'package.json') : undefined;
|
|
46
|
+
if (installed != null && fs.existsSync(installed)) {
|
|
47
|
+
version = JSON.parse(fs.readFileSync(installed, 'utf-8')).version;
|
|
48
|
+
}
|
|
49
|
+
version ??= pinnedVersion(templateName, name);
|
|
50
|
+
if (version != null) {
|
|
51
|
+
result[name] = version;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
result[THIS_PACKAGE] = ownVersion;
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
// What template init does for a folder. It never changes a module of the
|
|
58
|
+
// customer: only package.json (the peer dependencies on the provided packages,
|
|
59
|
+
// merged), and the starter files that are missing (or all of them, with reset).
|
|
60
|
+
export function planTemplateInit(templateName, folderDir, provided, options) {
|
|
61
|
+
const write = {};
|
|
62
|
+
const replace = [];
|
|
63
|
+
const outOfDate = [];
|
|
64
|
+
// package.json: the template owns the peer dependencies on the provided packages.
|
|
65
|
+
const packageJsonPath = path.resolve(folderDir, 'package.json');
|
|
66
|
+
const existing = fs.existsSync(packageJsonPath) ? JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) : null;
|
|
67
|
+
const peerDependencies = { ...existing?.peerDependencies };
|
|
68
|
+
for (const [name, version] of Object.entries(provided)) {
|
|
69
|
+
const range = `^${version}`;
|
|
70
|
+
if (peerDependencies[name] !== range) {
|
|
71
|
+
if (existing != null) {
|
|
72
|
+
outOfDate.push(`package.json: peerDependencies.${name} is ${peerDependencies[name] ?? 'missing'}, but the app provides ${version}.`);
|
|
73
|
+
}
|
|
74
|
+
peerDependencies[name] = range;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const typescriptRange = loadAppTemplate(templateName).devDependencies.typescript;
|
|
78
|
+
const packageJson = {
|
|
79
|
+
name: `${templateName}-extensions`,
|
|
80
|
+
private: true,
|
|
81
|
+
type: 'module',
|
|
82
|
+
...existing,
|
|
83
|
+
peerDependencies,
|
|
84
|
+
devDependencies: {
|
|
85
|
+
...(typescriptRange != null ? { typescript: typescriptRange } : {}),
|
|
86
|
+
...existing?.devDependencies,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
if (existing == null) {
|
|
90
|
+
outOfDate.push('package.json is missing.');
|
|
91
|
+
}
|
|
92
|
+
const packageJsonText = JSON.stringify(packageJson, undefined, 2) + '\n';
|
|
93
|
+
if (existing == null || fs.readFileSync(packageJsonPath, 'utf-8') !== packageJsonText) {
|
|
94
|
+
write['package.json'] = packageJsonText;
|
|
95
|
+
}
|
|
96
|
+
// The starter files: written if missing, or all of them with reset.
|
|
97
|
+
for (const [file, content] of Object.entries(starterFiles(templateName))) {
|
|
98
|
+
const filePath = path.resolve(folderDir, file);
|
|
99
|
+
if (!fs.existsSync(filePath)) {
|
|
100
|
+
write[file] = content;
|
|
101
|
+
// The examples are optional. tsconfig.json is needed by the editor.
|
|
102
|
+
if (file === 'tsconfig.json') {
|
|
103
|
+
outOfDate.push('tsconfig.json is missing.');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (options.reset && fs.readFileSync(filePath, 'utf-8') !== content) {
|
|
107
|
+
write[file] = content;
|
|
108
|
+
replace.push(file);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { write, replace, outOfDate };
|
|
112
|
+
}
|
|
113
|
+
// Writes the files of a plan into the folder.
|
|
114
|
+
export function applyTemplateInit(folderDir, plan) {
|
|
115
|
+
for (const [file, content] of Object.entries(plan.write)) {
|
|
116
|
+
const filePath = path.resolve(folderDir, file);
|
|
117
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
118
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function compareVersions(a: string, b: string): -1 | 0 | 1 | null;
|
|
2
|
+
export type VersionCheck = {
|
|
3
|
+
result: 'same';
|
|
4
|
+
recorded: string;
|
|
5
|
+
running: string;
|
|
6
|
+
} | {
|
|
7
|
+
result: 'newer-cli';
|
|
8
|
+
recorded: string;
|
|
9
|
+
running: string;
|
|
10
|
+
} | {
|
|
11
|
+
result: 'older-cli';
|
|
12
|
+
recorded: string;
|
|
13
|
+
running: string;
|
|
14
|
+
} | {
|
|
15
|
+
result: 'missing';
|
|
16
|
+
recorded: undefined;
|
|
17
|
+
running: string;
|
|
18
|
+
} | {
|
|
19
|
+
result: 'invalid';
|
|
20
|
+
recorded: string;
|
|
21
|
+
running: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function checkProjectVersion(recorded: string | undefined, running: string): VersionCheck;
|
|
24
|
+
export declare function versionCheckError(check: VersionCheck, autoUpgrade: boolean): string | null;
|
|
25
|
+
//# sourceMappingURL=version-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../../../src/cli/managed/version-check.ts"],"names":[],"mappings":"AAwBA,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAuCvE;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAS/F;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgB1F"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Fastly, Inc.
|
|
3
|
+
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
+
*/
|
|
5
|
+
function parseVersion(version) {
|
|
6
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.*)?$/.exec(version.trim());
|
|
7
|
+
if (match == null) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
core: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
12
|
+
prerelease: match[4] != null ? match[4].split('.').map(x => /^\d+$/.test(x) ? Number(x) : x) : [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
// Semver order: -1 if a < b, 0 if the same, 1 if a > b. null if one of them
|
|
16
|
+
// is not a version.
|
|
17
|
+
export function compareVersions(a, b) {
|
|
18
|
+
const va = parseVersion(a);
|
|
19
|
+
const vb = parseVersion(b);
|
|
20
|
+
if (va == null || vb == null) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
for (let i = 0; i < 3; i++) {
|
|
24
|
+
if (va.core[i] !== vb.core[i]) {
|
|
25
|
+
return va.core[i] < vb.core[i] ? -1 : 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// A version without a prerelease is after the same version with one.
|
|
29
|
+
if (va.prerelease.length === 0 || vb.prerelease.length === 0) {
|
|
30
|
+
return va.prerelease.length === vb.prerelease.length ? 0 : va.prerelease.length === 0 ? 1 : -1;
|
|
31
|
+
}
|
|
32
|
+
for (let i = 0; i < Math.max(va.prerelease.length, vb.prerelease.length); i++) {
|
|
33
|
+
const x = va.prerelease[i];
|
|
34
|
+
const y = vb.prerelease[i];
|
|
35
|
+
if (x === undefined) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
if (y === undefined) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
if (x === y) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (typeof x === 'number' && typeof y === 'number') {
|
|
45
|
+
return x < y ? -1 : 1;
|
|
46
|
+
}
|
|
47
|
+
if (typeof x === 'number') {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
if (typeof y === 'number') {
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
return x < y ? -1 : 1;
|
|
54
|
+
}
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
export function checkProjectVersion(recorded, running) {
|
|
58
|
+
if (recorded == null || recorded.trim() === '') {
|
|
59
|
+
return { result: 'missing', recorded: undefined, running };
|
|
60
|
+
}
|
|
61
|
+
const order = compareVersions(running, recorded);
|
|
62
|
+
if (order == null) {
|
|
63
|
+
return { result: 'invalid', recorded, running };
|
|
64
|
+
}
|
|
65
|
+
return { result: order === 0 ? 'same' : order > 0 ? 'newer-cli' : 'older-cli', recorded, running };
|
|
66
|
+
}
|
|
67
|
+
// The message for a check that stops dev and deploy, or null if they can continue.
|
|
68
|
+
export function versionCheckError(check, autoUpgrade) {
|
|
69
|
+
switch (check.result) {
|
|
70
|
+
case 'same':
|
|
71
|
+
return null;
|
|
72
|
+
case 'newer-cli':
|
|
73
|
+
return autoUpgrade ? null :
|
|
74
|
+
`This project uses ${check.recorded} of @fastly/compute-js-static-publish. You are running ${check.running}. ` +
|
|
75
|
+
`Run 'upgrade' to move the project to ${check.running}, or use --auto-upgrade.`;
|
|
76
|
+
case 'older-cli':
|
|
77
|
+
return `This project uses ${check.recorded} of @fastly/compute-js-static-publish, which is newer than the version that runs (${check.running}). ` +
|
|
78
|
+
`Run the CLI at ${check.recorded} or later. An older version never deploys over an app that a newer version made.`;
|
|
79
|
+
case 'missing':
|
|
80
|
+
return `managed.staticPublishVersion is missing in the project file. Run 'upgrade' to set it to ${check.running}.`;
|
|
81
|
+
case 'invalid':
|
|
82
|
+
return `managed.staticPublishVersion '${check.recorded}' is not a version. Run 'upgrade' to set it to ${check.running}.`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -14,5 +14,6 @@ export declare class KvStoreLocalProvider implements StorageProvider {
|
|
|
14
14
|
key: string;
|
|
15
15
|
}>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
|
|
16
16
|
calculateNumChunks(size: number): number;
|
|
17
|
+
calculateChunkSizes(size: number): number[];
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=kv-store-local-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kv-store-local-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-local-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kv-store-local-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-local-provider.ts"],"names":[],"mappings":"AA2BA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,kBAAkB,EAAE,sBAkBhC,CAAC;AAEF,qBAAa,oBAAqB,YAAW,eAAe;IAC1D,YACE,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EAItB;IAED,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAEzB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAM9D;IAEK,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAc/D;IAEK,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAcnE;IAEK,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAoBf;IAEK,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnD;IAEK,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,QAAQ,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7F;IAEK,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,CAAC,EAAE,MAAM,EACtB,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC,CAUf;IAED,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1C;CACF"}
|
|
@@ -6,7 +6,7 @@ import fs from 'node:fs';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { isKvStoreConfigRc, } from '../../models/config/static-publish-rc.js';
|
|
8
8
|
import { getKvStoreConfigFromRc, } from '../../models/config/kv-store-config.js';
|
|
9
|
-
import { applyKVStoreEntriesChunks, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
|
|
9
|
+
import { applyKVStoreEntriesChunks, chunkSizes, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
|
|
10
10
|
import { getLocalKvStoreEntry, getLocalKVStoreKeys, localKvStoreDeleteEntry, localKvStoreSubmitEntry, writeKVStoreEntriesForLocal, } from '../util/kv-store-local-server.js';
|
|
11
11
|
import { concurrentParallel } from '../util/retryable.js';
|
|
12
12
|
import { kvStoreEntryToStorageEntry, } from './kv-store-provider.js';
|
|
@@ -31,14 +31,14 @@ export class KvStoreLocalProvider {
|
|
|
31
31
|
return await getLocalKVStoreKeys(this.storeFile, prefix);
|
|
32
32
|
}
|
|
33
33
|
async getStorageEntry(key) {
|
|
34
|
-
const kvStoreEntry = await getLocalKvStoreEntry(this.storeFile, key);
|
|
34
|
+
const kvStoreEntry = await getLocalKvStoreEntry(this.storeFile, key, false, this.computeAppDir);
|
|
35
35
|
if (kvStoreEntry == null) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
return kvStoreEntryToStorageEntry(kvStoreEntry);
|
|
39
39
|
}
|
|
40
40
|
async getStorageEntryInfo(key) {
|
|
41
|
-
const kvStoreEntry = await getLocalKvStoreEntry(this.storeFile, key, true);
|
|
41
|
+
const kvStoreEntry = await getLocalKvStoreEntry(this.storeFile, key, true, this.computeAppDir);
|
|
42
42
|
if (kvStoreEntry == null) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
@@ -78,4 +78,7 @@ export class KvStoreLocalProvider {
|
|
|
78
78
|
calculateNumChunks(size) {
|
|
79
79
|
return Math.ceil(size / KV_STORE_CHUNK_SIZE);
|
|
80
80
|
}
|
|
81
|
+
calculateChunkSizes(size) {
|
|
82
|
+
return chunkSizes(size, KV_STORE_CHUNK_SIZE);
|
|
83
|
+
}
|
|
81
84
|
}
|
|
@@ -12,11 +12,12 @@ export declare class KvStoreProvider implements StorageProvider {
|
|
|
12
12
|
submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
|
|
13
13
|
deleteStorageEntry(key: string): Promise<void>;
|
|
14
14
|
applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
|
|
15
|
-
uploadEntries(entries: StorageProviderBatchEntry[]): Promise<void>;
|
|
15
|
+
uploadEntries(entries: StorageProviderBatchEntry[], verbose?: boolean): Promise<void>;
|
|
16
16
|
doConcurrentParallel<TObject extends {
|
|
17
17
|
key: string;
|
|
18
18
|
}>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
|
|
19
19
|
calculateNumChunks(size: number): number;
|
|
20
|
+
calculateChunkSizes(size: number): number[];
|
|
20
21
|
}
|
|
21
22
|
export declare function kvStoreEntryToStorageEntry(kvStoreEntry: KvStoreEntryInfo): StorageEntry;
|
|
22
23
|
export declare function parseKvStoreMetadata(metadata: string): Record<string, string> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kv-store-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-provider.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"kv-store-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-provider.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,kBAAkB,EAAE,sBAsBhC,CAAC;AAEF,qBAAa,eAAgB,YAAW,eAAe;IACrD,YACE,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EAIvB;IAED,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IAEd,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAQ9D;IAEK,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAa/D;IAEK,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAenE;IAEK,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAUf;IAEK,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnD;IAEK,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB5F;IAEK,aAAa,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CjG;IAEK,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,GAAE,MAAW,EAC1B,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC,CAmBf;IAED,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1C;CAEF;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,gBAAgB,gBA6B/B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,iCAiCpD"}
|
|
@@ -7,8 +7,9 @@ import { isKvStoreConfigRc, } from '../../models/config/static-publish-rc.js';
|
|
|
7
7
|
import { getKvStoreConfigFromRc, } from '../../models/config/kv-store-config.js';
|
|
8
8
|
import { FetchError, loadApiToken, } from '../util/api-token.js';
|
|
9
9
|
import { rootRelative, } from '../util/files.js';
|
|
10
|
+
import { ProgressLog } from '../util/progress.js';
|
|
10
11
|
import { getKvStoreEntry, getKVStoreKeys, kvStoreDeleteEntry, kvStoreSubmitEntry, kvStoreSubmitBatch, } from '../util/kv-store.js';
|
|
11
|
-
import { applyKVStoreEntriesChunks, packNdjsonBatches, ndjsonLineForBatchEntry, entriesToUpload, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
|
|
12
|
+
import { applyKVStoreEntriesChunks, chunkSizes, packNdjsonBatches, ndjsonLineForBatchEntry, entriesToUpload, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
|
|
12
13
|
import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
|
|
13
14
|
export const buildStoreProvider = (config, context) => {
|
|
14
15
|
if (isKvStoreConfigRc(config) && !context.localMode) {
|
|
@@ -55,7 +56,7 @@ export class KvStoreProvider {
|
|
|
55
56
|
await kvStoreDeleteEntry(this.fastlyApiContext, this.kvStoreName, key);
|
|
56
57
|
}
|
|
57
58
|
async applyBatch(batch, options = {}) {
|
|
58
|
-
const { existingKeys } = options;
|
|
59
|
+
const { existingKeys, verbose = false } = options;
|
|
59
60
|
console.log(`🍪 Chunking large files...`);
|
|
60
61
|
await applyKVStoreEntriesChunks(batch.storageProviderBatchEntries, KV_STORE_CHUNK_SIZE);
|
|
61
62
|
console.log(`✅ Large files have been chunked.`);
|
|
@@ -65,15 +66,16 @@ export class KvStoreProvider {
|
|
|
65
66
|
console.log(` | ${batch.storageProviderBatchEntries.length - toWrite.length} chunk(s) already present in the KV Store.`);
|
|
66
67
|
}
|
|
67
68
|
console.log(`📤 Uploading ${toWrite.length} entries to KV Store.`);
|
|
68
|
-
await this.uploadEntries(toWrite);
|
|
69
|
+
await this.uploadEntries(toWrite, verbose);
|
|
69
70
|
console.log(`✅ Uploaded entries to KV Store.`);
|
|
70
71
|
}
|
|
71
|
-
async uploadEntries(entries) {
|
|
72
|
+
async uploadEntries(entries, verbose = false) {
|
|
72
73
|
const { batches, oversized } = packNdjsonBatches(entries);
|
|
74
|
+
const progress = new ProgressLog('Entries uploaded', verbose, entries.length);
|
|
73
75
|
await this.doConcurrentParallel(oversized, async ({ filePath, metadataJson }, key) => {
|
|
74
76
|
const fileBytes = fs.readFileSync(filePath);
|
|
75
77
|
await kvStoreSubmitEntry(this.fastlyApiContext, this.kvStoreName, key, fileBytes, metadataJson != null ? JSON.stringify(metadataJson) : undefined);
|
|
76
|
-
|
|
78
|
+
progress.add(1, () => ` 🌐 Submitted large asset "${rootRelative(filePath)}" to KV Store with key "${key}".`);
|
|
77
79
|
}, 12, true);
|
|
78
80
|
await this.doConcurrentParallel(batches, async (batch, key) => {
|
|
79
81
|
const lines = batch.entries.map(ndjsonLineForBatchEntry);
|
|
@@ -82,12 +84,13 @@ export class KvStoreProvider {
|
|
|
82
84
|
// Keep only the entries that failed. The retry submits only these entries.
|
|
83
85
|
const failedKeys = new Set(failures.map(f => f.key));
|
|
84
86
|
const submittedCount = batch.entries.length;
|
|
87
|
+
progress.add(submittedCount - failures.length, () => ` 🌐 Submitted ${submittedCount - failures.length} of ${submittedCount} entries to KV Store ("${key}").`);
|
|
85
88
|
batch.entries = batch.entries.filter(entry => failedKeys.has(entry.key));
|
|
86
89
|
const shown = failures.slice(0, 5).map(f => `${f.key} (${f.code ?? 'unknown'}: ${f.reason ?? 'unknown'})`).join(', ');
|
|
87
90
|
const more = failures.length > 5 ? `, and ${failures.length - 5} more` : '';
|
|
88
91
|
throw makeRetryable(new Error(`${failures.length} of ${submittedCount} entries failed: ${shown}${more}`));
|
|
89
92
|
}
|
|
90
|
-
|
|
93
|
+
progress.add(batch.entries.length, () => ` 🌐 Submitted ${batch.entries.length} entries to KV Store ("${key}").`);
|
|
91
94
|
}, 12, true);
|
|
92
95
|
}
|
|
93
96
|
async doConcurrentParallel(objects, fn, maxConcurrent = 12, throwOnError = false) {
|
|
@@ -107,6 +110,9 @@ export class KvStoreProvider {
|
|
|
107
110
|
calculateNumChunks(size) {
|
|
108
111
|
return Math.ceil(size / KV_STORE_CHUNK_SIZE);
|
|
109
112
|
}
|
|
113
|
+
calculateChunkSizes(size) {
|
|
114
|
+
return chunkSizes(size, KV_STORE_CHUNK_SIZE);
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
117
|
export function kvStoreEntryToStorageEntry(kvStoreEntry) {
|
|
112
118
|
const storageEntry = {};
|
|
@@ -119,6 +125,11 @@ export function kvStoreEntryToStorageEntry(kvStoreEntry) {
|
|
|
119
125
|
storageEntry.metadata = metadata;
|
|
120
126
|
}
|
|
121
127
|
}
|
|
128
|
+
// The API gives the size of the value in this header, also for a HEAD request.
|
|
129
|
+
const storedContentLength = kvStoreEntry.response.headers.get('stored-content-length');
|
|
130
|
+
if (storedContentLength != null) {
|
|
131
|
+
storageEntry.size = Number(storedContentLength);
|
|
132
|
+
}
|
|
122
133
|
if (kvStoreEntry.generation != null) {
|
|
123
134
|
storageEntry.providerMetadata = {
|
|
124
135
|
generation: kvStoreEntry.generation,
|
|
@@ -26,6 +26,7 @@ export declare class S3StorageProvider implements StorageProvider {
|
|
|
26
26
|
key: string;
|
|
27
27
|
}>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
|
|
28
28
|
calculateNumChunks(_size: number): number;
|
|
29
|
+
calculateChunkSizes(size: number): number[];
|
|
29
30
|
}
|
|
30
31
|
export {};
|
|
31
32
|
//# sourceMappingURL=s3-storage-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAQA,OAAO,EAUL,QAAQ,EAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AASxB,OAAO,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E,MAAW,EAC1B,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf;IAED,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExC;IAED,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1C;CAEF"}
|
|
@@ -12,6 +12,7 @@ import { entriesToUpload } from '../util/kv-store-items.js';
|
|
|
12
12
|
import { loadS3Credentials, } from '../util/s3-credentials.js';
|
|
13
13
|
import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
|
|
14
14
|
import { rootRelative, } from '../util/files.js';
|
|
15
|
+
import { ProgressLog } from '../util/progress.js';
|
|
15
16
|
// The number of objects to upload at the same time. S3 accepts many parallel
|
|
16
17
|
// requests, and each request mostly waits for the network. In a test with small
|
|
17
18
|
// objects, 64 was approximately 4 times faster than 12.
|
|
@@ -156,6 +157,7 @@ export class S3StorageProvider {
|
|
|
156
157
|
}
|
|
157
158
|
return {
|
|
158
159
|
metadata: response.Metadata,
|
|
160
|
+
size: response.ContentLength,
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
163
|
async submitStorageEntry(key, _filePath, data, metadata) {
|
|
@@ -177,17 +179,18 @@ export class S3StorageProvider {
|
|
|
177
179
|
await this.sendS3ClientCommand(command);
|
|
178
180
|
}
|
|
179
181
|
async applyBatch(batch, options = {}) {
|
|
180
|
-
const { existingKeys } = options;
|
|
182
|
+
const { existingKeys, verbose = false } = options;
|
|
181
183
|
let toWrite = batch.storageProviderBatchEntries;
|
|
182
184
|
if (existingKeys != null) {
|
|
183
185
|
toWrite = entriesToUpload(toWrite, existingKeys);
|
|
184
186
|
}
|
|
185
187
|
console.log(`📤 Uploading ${toWrite.length} entries to S3 storage (${this.uploadConcurrency} at a time).`);
|
|
188
|
+
const progress = new ProgressLog('Entries uploaded', verbose, toWrite.length);
|
|
186
189
|
await this.doConcurrentParallel(toWrite, async ({ filePath, metadataJson }, key) => {
|
|
187
190
|
// const fileStream = fs.createReadStream(filePath);
|
|
188
191
|
const fileData = fs.readFileSync(filePath);
|
|
189
192
|
await this.submitStorageEntry(key, filePath, fileData, metadataJson);
|
|
190
|
-
|
|
193
|
+
progress.add(1, () => ` 🌐 Submitted asset "${rootRelative(filePath)}" to S3 storage with key "${key}".`);
|
|
191
194
|
}, this.uploadConcurrency, true);
|
|
192
195
|
console.log(`✅ Uploaded entries to S3 storage.`);
|
|
193
196
|
}
|
|
@@ -205,4 +208,7 @@ export class S3StorageProvider {
|
|
|
205
208
|
calculateNumChunks(_size) {
|
|
206
209
|
return 1;
|
|
207
210
|
}
|
|
211
|
+
calculateChunkSizes(size) {
|
|
212
|
+
return [size];
|
|
213
|
+
}
|
|
208
214
|
}
|
|
@@ -3,6 +3,7 @@ export interface StorageEntry {
|
|
|
3
3
|
data?: ReadableStream<Uint8Array>;
|
|
4
4
|
metadata?: Record<string, string>;
|
|
5
5
|
providerMetadata?: Record<string, string>;
|
|
6
|
+
size?: number;
|
|
6
7
|
}
|
|
7
8
|
export interface StorageProvider {
|
|
8
9
|
getStorageKeys(prefix?: string): Promise<string[] | null>;
|
|
@@ -15,6 +16,7 @@ export interface StorageProvider {
|
|
|
15
16
|
key: string;
|
|
16
17
|
}>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
|
|
17
18
|
calculateNumChunks(size: number): number;
|
|
19
|
+
calculateChunkSizes(size: number): number[];
|
|
18
20
|
}
|
|
19
21
|
export type StorageProviderBatchEntry = {
|
|
20
22
|
size: number;
|
|
@@ -24,6 +26,7 @@ export type StorageProviderBatchEntry = {
|
|
|
24
26
|
};
|
|
25
27
|
export type ApplyBatchOptions = {
|
|
26
28
|
existingKeys?: Set<string>;
|
|
29
|
+
verbose?: boolean;
|
|
27
30
|
};
|
|
28
31
|
export declare class StorageProviderBatch {
|
|
29
32
|
constructor();
|
|
@@ -42,4 +45,5 @@ export type StorageProviderBuilder = (config: StaticPublishRc, context: StorageP
|
|
|
42
45
|
export declare function getStorageKeysByHexPrefix(storageProvider: StorageProvider, prefix: string): Promise<string[] | null>;
|
|
43
46
|
export declare function registerStorageProviderBuilder(builder: StorageProviderBuilder): void;
|
|
44
47
|
export declare function loadStorageProviderFromStaticPublishRc(config: StaticPublishRc, context: StorageProviderBuilderContext): Promise<StorageProvider>;
|
|
48
|
+
export declare function isVariantInStorage(storageProvider: StorageProvider, existingKeys: Set<string>, variantKey: string, size: number, numChunks: number): Promise<boolean>;
|
|
45
49
|
//# sourceMappingURL=storage-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC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