Skip to content

Commit 3ca3f6b

Browse files
authored
Merge pull request #14 from fastly/kats/package-updates
Consistent package.json
2 parents 3b864c1 + 5133267 commit 3ca3f6b

File tree

4 files changed

+27
-38
lines changed

4 files changed

+27
-38
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node
1313
uses: actions/setup-node@v3
1414
with:
15-
node-version: '18'
15+
node-version: '20.11'
1616
- name: Setup Fastly CLI
1717
uses: fastly/compute-actions/setup@v5
1818
- name: Install Dependencies

package.json

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,25 @@
11
{
2-
"author": "oss@fastly.com",
3-
"bugs": {
4-
"url": "https://github.com/fastly/compute-starter-kit-javascript-queue/issues"
5-
},
2+
"type": "module",
3+
"private": true,
64
"dependencies": {
7-
"@fastly/js-compute": "^3.0.0",
5+
"@fastly/js-compute": "^3.33.2",
86
"@upstash/redis": "^1.23.4",
97
"jws": "^4.0.0"
108
},
119
"devDependencies": {
12-
"@fastly/cli": "^10.14.0",
10+
"@fastly/cli": "^11.0.0",
1311
"buffer": "^6.0.3",
1412
"node-polyfill-webpack-plugin": "^2.0.1",
15-
"webpack": "^5.89.0",
13+
"webpack": "^5.98.0",
1614
"webpack-cli": "^5.1.4"
1715
},
18-
"engines": {
19-
"node": "^18.0.0"
20-
},
21-
"homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-queue",
22-
"license": "MIT",
23-
"main": "src/index.js",
24-
"name": "compute-starter-kit-javascript-queue",
25-
"repository": {
26-
"type": "git",
27-
"url": "git+https://github.com/fastly/compute-starter-kit-javascript-queue.git"
28-
},
2916
"scripts": {
3017
"prebuild": "webpack",
31-
"build": "js-compute-runtime bin/index.js bin/main.wasm",
18+
"build": "js-compute-runtime bin/index.cjs bin/main.wasm",
3219
"start": "fastly compute serve",
3320
"deploy": "fastly compute publish"
3421
},
35-
"version": "1.0.0-pre"
22+
"engines": {
23+
"node": ">= 20.11"
24+
}
3625
}

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import { includeBytes } from "fastly:experimental";
66
import * as jws from "jws";
77

8-
import fetchConfig from "./config";
8+
import fetchConfig from "./config.js";
99

10-
import { getQueueCookie, setQueueCookie } from "./cookies";
10+
import { getQueueCookie, setQueueCookie } from "./cookies.js";
1111

1212
import {
1313
getStore,
@@ -16,11 +16,11 @@ import {
1616
incrementQueueCursor,
1717
incrementQueueLength,
1818
incrementAutoPeriod,
19-
} from "./store";
19+
} from "./store.js";
2020

21-
import log from "./logging";
21+
import log from "./logging.js";
2222

23-
import processView from "./views";
23+
import processView from "./views.js";
2424

2525
const textDecoder = new TextDecoder();
2626

webpack.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
const path = require("path");
2-
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
1+
import path from "path";
2+
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
33

4-
module.exports = {
4+
export default {
55
entry: "./src/index.js",
66
optimization: {
77
minimize: true,
88
},
99
target: "webworker",
1010
output: {
11-
filename: "index.js",
12-
path: path.resolve(__dirname, "bin"),
13-
libraryTarget: "this",
11+
filename: 'index.cjs',
12+
path: path.resolve(import.meta.dirname, "bin"),
13+
chunkFormat: 'commonjs',
14+
library: {
15+
type: 'commonjs',
16+
},
1417
},
1518
module: {
1619
// Loaders go here.
@@ -27,11 +30,8 @@ module.exports = {
2730
}),
2831
],
2932
externals: [
30-
({request,}, callback) => {
31-
if (/^fastly:.*$/.test(request)) {
32-
return callback(null, 'commonjs ' + request);
33-
}
34-
callback();
35-
}
33+
// Allow webpack to handle 'fastly:*' namespaced module imports by treating
34+
// them as modules rather than trying to process them as URLs
35+
/^fastly:.*$/,
3636
],
3737
};

0 commit comments

Comments
 (0)