@fastly/compute-js-static-publish 5.2.0 → 5.2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Static Publisher for JavaScript on Compute@Edge
1
+ # Static Publisher for JavaScript on Fastly Compute
2
2
 
3
- Using a static site generator to build your website? Do you simply need to serve some static files? With `compute-js-static-publish`, now you can deploy and serve everything from Fastly's blazing-fast [Compute@Edge](https://developer.fastly.com/learning/compute/).
3
+ Using a static site generator to build your website? Do you simply need to serve some static files? With `compute-js-static-publish`, now you can deploy and serve everything from Fastly's blazing-fast [Compute](https://developer.fastly.com/learning/compute/).
4
4
 
5
5
  ## Prerequisites
6
6
 
@@ -18,11 +18,11 @@ Assuming the root of your output directory is `./public`,
18
18
  npx @fastly/compute-js-static-publish@latest --root-dir=./public
19
19
  ```
20
20
 
21
- This will generate a Compute@Edge application at `./compute-js`. It will add a default `./src/index.js` file that instantiates the [`PublisherServer`](#publisherserver) class and runs it to serve the static files from your project.
21
+ This will generate a Compute application at `./compute-js`. It will add a default `./src/index.js` file that instantiates the [`PublisherServer`](#publisherserver) class and runs it to serve the static files from your project.
22
22
 
23
- > This process creates a `./static-publish.rc.js` to hold your configuration. This, as well as the other files created in your new Compute@Edge program at `./compute-js`, can be committed to source control (except for the ones we specify in `.gitignore`!)
23
+ > This process creates a `./static-publish.rc.js` to hold your configuration. This, as well as the other files created in your new Compute program at `./compute-js`, can be committed to source control (except for the ones we specify in `.gitignore`!)
24
24
 
25
- Now, each time you build this Compute@Edge project, `compute-js-static-publish` will re-scan your `./public` directory and regenerate `/src/statics-metadata.js` and `/src/statics.js`. These files hold references to your project's public files.
25
+ Now, each time you build this Compute project, `compute-js-static-publish` will re-scan your `./public` directory and regenerate `/src/statics-metadata.js` and `/src/statics.js`. These files hold references to your project's public files.
26
26
 
27
27
  ### 2. Test your application using [Fastly's local development server](https://developer.fastly.com/learning/compute/testing/#running-a-local-testing-server)
28
28
 
@@ -36,7 +36,7 @@ This will serve your application using the default `PublisherServer()`.
36
36
 
37
37
  However, you can modify `/src/index.js` to add your own processing as you need. This file will not be overwritten after it is created.
38
38
 
39
- ### 3. When you're ready to go live, [deploy your Compute@Edge service](https://developer.fastly.com/reference/cli/compute/publish/)
39
+ ### 3. When you're ready to go live, [deploy your Compute service](https://developer.fastly.com/reference/cli/compute/publish/)
40
40
 
41
41
  ```shell
42
42
  fastly compute publish
@@ -51,7 +51,7 @@ fastly compute publish
51
51
  - Support for `If-None-Match` and `If-Modified-Since` request headers.
52
52
  - Optionally use Webpack as a module bundler.
53
53
  - Selectively serve files from Fastly's [KV Store](#kv-store), or embedded into your Wasm module.
54
- - Supports loading JavaScript files as code into your Compute@Edge application.
54
+ - Supports loading JavaScript files as code into your Compute application.
55
55
  - Presets for several static site generators.
56
56
 
57
57
  Some of these features are new! If you wish to update to this version, you may need to re-scaffold your application, or follow the steps outlined in [MIGRATING.md](./MIGRATING.md).
@@ -64,13 +64,13 @@ running as part of your build process.
64
64
  The files you have configured to be included (`--root-dir`) are enumerated and prepared. Their contents are included into
65
65
  your Wasm binary (or made available via [KV Store](#kv-store), if so configured). This process is called "publishing".
66
66
 
67
- Once the files are published, they are available to the other source files in the Compute@Edge application. For example,
67
+ Once the files are published, they are available to the other source files in the Compute application. For example,
68
68
  the stock application runs the [PublisherServer](#publisherserver) class to serve these files.
69
69
 
70
70
  For more advanced uses, such as accessing the contents of these file in your application, see the
71
71
  [Using the packaged objects in your own application](#using-published-assets-in-your-own-application) section below.
72
72
 
73
- Publishing is meant to run each time before building your Compute@Edge application into a Wasm file.
73
+ Publishing is meant to run each time before building your Compute application into a Wasm file.
74
74
  If the files in `--root-dir` have changed, then a new set of files will be published.
75
75
 
76
76
  ### Content Compression
@@ -98,21 +98,21 @@ npx @fastly/compute-js-static-publish \
98
98
 
99
99
  If you provide options, they override the defaults described below.
100
100
 
101
- Any configuration options will be written to a `static-publish.rc.js` file, and used each time you build your Compute@Edge
101
+ Any configuration options will be written to a `static-publish.rc.js` file, and used each time you build your Compute
102
102
  application.
103
103
 
104
- On subsequent builds of your Compute@Edge application, `compute-js-static-publish` will run with a special flag, `build-static`,
104
+ On subsequent builds of your Compute application, `compute-js-static-publish` will run with a special flag, `build-static`,
105
105
  reading from stored configuration, then scanning the `--public-dir` directory to recreate `./src/statics.js`.
106
106
 
107
107
  Any relative file and directory paths passed at the command line are handled as relative to the current directory.
108
108
 
109
109
  ### Publishing options:
110
110
 
111
- | Option | Default | Description |
112
- |------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113
- | `preset` | (None) | Apply default options from a specified preset. See ["Frameworks and Static Site Generators"](#usage-with-frameworks-and-static-site-generators). |
114
- | `output` | `./compute-js` | The directory in which to create the Compute@Edge application. |
115
- | `root-dir` | (None) | **Required**. The root of the directory that contains the files to include in the publishing. All files you wish to include must reside under this root. |
111
+ | Option | Default | Description |
112
+ |------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
113
+ | `preset` | (None) | Apply default options from a specified preset. See ["Frameworks and Static Site Generators"](#usage-with-frameworks-and-static-site-generators). |
114
+ | `output` | `./compute-js` | The directory in which to create the Compute application. |
115
+ | `root-dir` | (None) | **Required**. The root of the directory that contains the files to include in the publishing. All files you wish to include must reside under this root. |
116
116
 
117
117
  ### Server options:
118
118
 
@@ -135,15 +135,15 @@ Note that the files referenced by `--spa` and `--not-found-page` do not necessar
135
135
 
136
136
  ### Fastly service options
137
137
 
138
- These arguments are used to populate the `fastly.toml` and `package.json` files of your Compute@Edge application.
138
+ These arguments are used to populate the `fastly.toml` and `package.json` files of your Compute application.
139
139
 
140
- | Option | Default | Description |
141
- |-----------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
142
- | `name` | `name` from `package.json`, or `compute-js-static-site` | The name of your Compute@Edge application. |
143
- | `description` | `description` from `package.json`, or `Compute@Edge static site` | The description of your Compute@Edge application. |
144
- | `author` | `author` from `package.json`, or `you@example.com` | The author of your Compute@Edge application. |
145
- | `service-id` | (None) | The ID of an existing Fastly WASM service for your Compute@Edge application. |
146
- | `kv-store-name` | (None) | The name of an existing [Fastly KV Store](https://developer.fastly.com/learning/concepts/data-stores/#kv-stores) to hold the content assets. In addition to already existing, it must be linked to the service specified by `--service-id`. |
140
+ | Option | Default | Description |
141
+ |-----------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
142
+ | `name` | `name` from `package.json`, or `compute-js-static-site` | The name of your Compute application. |
143
+ | `description` | `description` from `package.json`, or `Compute static site` | The description of your Compute application. |
144
+ | `author` | `author` from `package.json`, or `you@example.com` | The author of your Compute application. |
145
+ | `service-id` | (None) | The ID of an existing Fastly WASM service for your Compute application. |
146
+ | `kv-store-name` | (None) | The name of an existing [Fastly KV Store](https://developer.fastly.com/learning/concepts/data-stores/#kv-stores) to hold the content assets. In addition to already existing, it must be linked to the service specified by `--service-id`. |
147
147
 
148
148
  ## Usage with frameworks and static site generators
149
149
 
@@ -164,7 +164,7 @@ These arguments are used to populate the `fastly.toml` and `package.json` files
164
164
  You may still override any of these options individually.
165
165
 
166
166
  *1 - For Next.js, consider using `@fastly/next-compute-js`, a Next.js server implementation that allows you to run
167
- your Next.js application on Compute@Edge.
167
+ your Next.js application on Compute.
168
168
 
169
169
  *2 - Astro support does not support SSR.
170
170
 
@@ -211,7 +211,7 @@ For `compression`, the following values are allowed:
211
211
 
212
212
  ## Associating your project with a Fastly Service
213
213
 
214
- The project created by this tool is a Fastly Compute@Edge JavaScript application, complete with a `fastly.toml` file that
214
+ The project created by this tool is a Fastly Compute JavaScript application, complete with a `fastly.toml` file that
215
215
  describes your project to the Fastly CLI.
216
216
 
217
217
  To deploy your project to production, you deploy it to a [Fastly service](https://developer.fastly.com/reference/glossary#term-service)
@@ -222,7 +222,7 @@ you to create a Fastly service in your account for you (afterwards saving the ne
222
222
 
223
223
  Alternatively, you may deploy to a service that already exists. You can create this service using the
224
224
  [Fastly CLI](https://developer.fastly.com/reference/cli/service/create/) or the [Fastly web app](https://manage.fastly.com/).
225
- Note that since this is a Compute@Edge application, the service must be created as a Wasm service.
225
+ Note that since this is a Compute application, the service must be created as a Wasm service.
226
226
 
227
227
  Before deploying your application, specify the service by setting the `service_id` value in the `fastly.toml` file to the
228
228
  ID of the service. The `fastly compute publish` will deploy to the service identified by this value.
@@ -410,11 +410,11 @@ This process also makes metadata available about each of the files that are incl
410
410
  modified date, the file hash, and so on.
411
411
 
412
412
  The [`PublisherServer` class](#publisherserver) used by the default scaffolded application is a simple application of this content
413
- and metadata. By importing `./statics.js` into your Compute@Edge application, you can just as easily access this
413
+ and metadata. By importing `./statics.js` into your Compute application, you can just as easily access this
414
414
  information about the assets that were included during publishing.
415
415
 
416
416
  > IMPORTANT: Use a static `import` statement, rather than using `await import()` to load `./statics.js`, in order to
417
- ensure that its top-level code runs during the initialization phase of your Compute@Edge application.
417
+ ensure that its top-level code runs during the initialization phase of your Compute application.
418
418
 
419
419
  #### Assets
420
420
 
@@ -528,9 +528,9 @@ helloModule.hello(); // Will print "Hello, World!"
528
528
  #### Metadata
529
529
 
530
530
  In some use cases, you may have a use case where you need to know about the files that were included during publishing,
531
- but not in the context of Compute@Edge. (e.g., a tool that runs in Node.js that performs some maintenance task on assets).
531
+ but not in the context of Compute. (e.g., a tool that runs in Node.js that performs some maintenance task on assets).
532
532
 
533
- You cannot import `./statics.js` from a Node.js application, as it holds dependencies on Compute@Edge.
533
+ You cannot import `./statics.js` from a Node.js application, as it holds dependencies on Compute.
534
534
 
535
535
  Instead, you can import `./statics-metadata.js`, a companion file that is generated in the same directory. This file
536
536
  exposes plain JavaScript objects that contain the metadata about your content assets that were included in the final
@@ -1,7 +1,7 @@
1
- // This program creates a Compute@Edge JavaScript application
1
+ // This program creates a Fastly Compute JavaScript application
2
2
  // in a subfolder named compute-js.
3
3
  // This project can be served using fastly compute serve
4
- // or deployed to a Compute@Edge service using fastly compute publish.
4
+ // or deployed to a Compute service using fastly compute publish.
5
5
  import * as child_process from "child_process";
6
6
  import * as path from "path";
7
7
  import * as fs from "fs";
@@ -17,7 +17,7 @@ const defaultOptions = {
17
17
  autoExt: ['.html', '.htm'],
18
18
  author: 'you@example.com',
19
19
  name: 'compute-js-static-site',
20
- description: 'Compute@Edge static site',
20
+ description: 'Fastly Compute static site',
21
21
  serviceId: undefined,
22
22
  kvStoreName: undefined,
23
23
  };
@@ -391,7 +391,7 @@ export function initApp(commandLineValues) {
391
391
  console.log('Creating project with Webpack.');
392
392
  console.log('');
393
393
  }
394
- console.log("Initializing Compute@Edge Application in " + computeJsDir + "...");
394
+ console.log("Initializing Compute Application in " + computeJsDir + "...");
395
395
  fs.mkdirSync(computeJsDir);
396
396
  fs.mkdirSync(path.resolve(computeJsDir, './src'));
397
397
  // .gitignore
@@ -450,7 +450,7 @@ export function initApp(commandLineValues) {
450
450
  // fastly.toml
451
451
  // language=toml
452
452
  const fastlyTomlContent = `\
453
- # This file describes a Fastly Compute@Edge package. To learn more visit:
453
+ # This file describes a Fastly Compute package. To learn more visit:
454
454
  # https://developer.fastly.com/reference/fastly-toml/
455
455
 
456
456
  authors = [ "${author}" ]
@@ -550,18 +550,18 @@ ${useWebpack ? 'module.exports =' : 'export default'} config;
550
550
  const indexJsSrcPath = path.resolve(__dirname, '../../../resources/index.js');
551
551
  const indexJsPath = path.resolve(computeJsDir, './src/index.js');
552
552
  fs.copyFileSync(indexJsSrcPath, indexJsPath);
553
- console.log("🚀 Compute@Edge application created!");
553
+ console.log("🚀 Compute application created!");
554
554
  console.log('Installing dependencies...');
555
555
  console.log(`npm --prefix ${COMPUTE_JS_DIR} install`);
556
556
  child_process.spawnSync('npm', ['--prefix', COMPUTE_JS_DIR, 'install'], { stdio: 'inherit' });
557
557
  console.log('');
558
558
  console.log('');
559
- console.log('To run your Compute@Edge application locally:');
559
+ console.log('To run your Compute application locally:');
560
560
  console.log('');
561
561
  console.log(' cd ' + COMPUTE_JS_DIR);
562
562
  console.log(' fastly compute serve');
563
563
  console.log('');
564
- console.log('To build and deploy to your Compute@Edge service:');
564
+ console.log('To build and deploy to your Compute service:');
565
565
  console.log('');
566
566
  console.log(' cd ' + COMPUTE_JS_DIR);
567
567
  console.log(' fastly compute publish');
@@ -70,7 +70,7 @@ const optionDefinitions = [
70
70
  { name: 'clean-kv-store', type: Boolean, },
71
71
  ];
72
72
  const commandLineValues = commandLineArgs(optionDefinitions);
73
- console.log("Fastly Compute@Edge JavaScript Static Publisher");
73
+ console.log("Fastly Compute JavaScript Static Publisher");
74
74
  let mode = 'init-app';
75
75
  if (commandLineValues['build-static']) {
76
76
  mode = 'build-static';
@@ -4,7 +4,7 @@ export class AstroPreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './dist',
6
6
  name: 'my-astro-app',
7
- description: 'Compute@Edge static site from Astro',
7
+ description: 'Fastly Compute static site from Astro',
8
8
  };
9
9
  }
10
10
  check(packageJson) {
@@ -5,7 +5,7 @@ export class CreateReactAppPreset {
5
5
  rootDir: './build',
6
6
  staticDirs: ['[public-dir]/static'],
7
7
  name: 'my-create-react-app',
8
- description: 'Compute@Edge static site from create-react-app',
8
+ description: 'Fastly Compute static site from create-react-app',
9
9
  };
10
10
  }
11
11
  check(packageJson) {
@@ -4,7 +4,7 @@ export class DocusaurusPreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './build',
6
6
  name: 'my-docusaurus-app',
7
- description: 'Compute@Edge static site from docusaurus',
7
+ description: 'Fastly Compute static site from docusaurus',
8
8
  };
9
9
  }
10
10
  check() {
@@ -4,7 +4,7 @@ export class GatsbyPreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './public',
6
6
  name: 'my-gatsby-app',
7
- description: 'Compute@Edge static site from Gatsby',
7
+ description: 'Fastly Compute static site from Gatsby',
8
8
  };
9
9
  }
10
10
  check() {
@@ -4,7 +4,7 @@ export class NextJsPreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './out',
6
6
  name: 'my-next-app',
7
- description: 'Compute@Edge static site from Next.js',
7
+ description: 'Fastly Compute static site from Next.js',
8
8
  };
9
9
  }
10
10
  check() {
@@ -4,7 +4,7 @@ export class SvelteKitPreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './dist',
6
6
  name: 'my-sveltekit-app',
7
- description: 'Compute@Edge static site from SvelteKit',
7
+ description: 'Fastly Compute static site from SvelteKit',
8
8
  };
9
9
  }
10
10
  check() {
@@ -4,7 +4,7 @@ export class VitePreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './dist',
6
6
  name: 'my-vite-app',
7
- description: 'Compute@Edge static site from Vite',
7
+ description: 'Fastly Compute static site from Vite',
8
8
  };
9
9
  }
10
10
  check() {
@@ -4,7 +4,7 @@ export class VuePreset {
4
4
  this.defaultOptions = {
5
5
  rootDir: './dist',
6
6
  name: 'my-vue-app',
7
- description: 'Compute@Edge static site from Vue (create-vue)',
7
+ description: 'Fastly Compute static site from Vue (create-vue)',
8
8
  };
9
9
  }
10
10
  check(packageJson) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "5.2.0",
5
- "description": "Static Publisher for Compute@Edge JavaScript",
4
+ "version": "5.2.1",
5
+ "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "./build/index.js",
7
7
  "types": "./build/index.d.ts",
8
8
  "scripts": {