Skip to content

Consistent package.json #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20.11'
- name: Setup Fastly CLI
uses: fastly/compute-actions/setup@v5
- name: Install Dependencies
Expand Down
29 changes: 9 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
{
"author": "oss@fastly.com",
"bugs": {
"url": "https://github.com/fastly/compute-starter-kit-javascript-queue/issues"
},
"type": "module",
"private": true,
"dependencies": {
"@fastly/js-compute": "^3.0.0",
"@fastly/js-compute": "^3.33.2",
"@upstash/redis": "^1.23.4",
"jws": "^4.0.0"
},
"devDependencies": {
"@fastly/cli": "^10.14.0",
"@fastly/cli": "^11.0.0",
"buffer": "^6.0.3",
"node-polyfill-webpack-plugin": "^2.0.1",
"webpack": "^5.89.0",
"webpack": "^5.98.0",
"webpack-cli": "^5.1.4"
},
"engines": {
"node": "^18.0.0"
},
"homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-queue",
"license": "MIT",
"main": "src/index.js",
"name": "compute-starter-kit-javascript-queue",
"repository": {
"type": "git",
"url": "git+https://github.com/fastly/compute-starter-kit-javascript-queue.git"
},
"scripts": {
"prebuild": "webpack",
"build": "js-compute-runtime bin/index.js bin/main.wasm",
"build": "js-compute-runtime bin/index.cjs bin/main.wasm",
"start": "fastly compute serve",
"deploy": "fastly compute publish"
},
"version": "1.0.0-pre"
"engines": {
"node": ">= 20.11"
}
}
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import { includeBytes } from "fastly:experimental";
import * as jws from "jws";

import fetchConfig from "./config";
import fetchConfig from "./config.js";

import { getQueueCookie, setQueueCookie } from "./cookies";
import { getQueueCookie, setQueueCookie } from "./cookies.js";

import {
getStore,
Expand All @@ -16,11 +16,11 @@ import {
incrementQueueCursor,
incrementQueueLength,
incrementAutoPeriod,
} from "./store";
} from "./store.js";

import log from "./logging";
import log from "./logging.js";

import processView from "./views";
import processView from "./views.js";

const textDecoder = new TextDecoder();

Expand Down
24 changes: 12 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
const path = require("path");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
import path from "path";
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";

module.exports = {
export default {
entry: "./src/index.js",
optimization: {
minimize: true,
},
target: "webworker",
output: {
filename: "index.js",
path: path.resolve(__dirname, "bin"),
libraryTarget: "this",
filename: 'index.cjs',
path: path.resolve(import.meta.dirname, "bin"),
chunkFormat: 'commonjs',
library: {
type: 'commonjs',
},
},
module: {
// Loaders go here.
Expand All @@ -27,11 +30,8 @@ module.exports = {
}),
],
externals: [
({request,}, callback) => {
if (/^fastly:.*$/.test(request)) {
return callback(null, 'commonjs ' + request);
}
callback();
}
// Allow webpack to handle 'fastly:*' namespaced module imports by treating
// them as modules rather than trying to process them as URLs
/^fastly:.*$/,
],
};