Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 094699c6a218caa1c0ed5dcfb8f75598bc1f503c
Merge: 21bfe2a5b 5ea9d8e
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Dec 6 00:36:04 2024 +0000

    Merge remote-tracking branch 'origin/main' into penalosa/extension-scaffolding

commit 21bfe2a5b2f43c4d505cde795a2958964c4a8b0a
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Dec 6 00:36:00 2024 +0000

    main

commit 5ea9d8e
Author: emily-shen <69125074+emily-shen@users.noreply.github.com>
Date:   Thu Dec 5 19:01:47 2024 +0000

    remove stray await (#7453)

commit 9ede45b
Author: Pete Bacon Darwin <pete@bacondarwin.com>
Date:   Thu Dec 5 18:45:35 2024 +0000

    fix: relax validation of unsafe configuration to allow an empty object (#7461)

    The types, the default and the code in general support an empty object for this config setting.

    So it makes sense to avoid erroring when validating the config.

commit 55ec38a
Author: James Ross <james@jross.me>
Date:   Thu Dec 5 17:26:12 2024 +0000

    chore: bump vitest in templates (#7384)

    * chore: bump vitest in templates

    * chore: pin to vitest 2.1.5

    This works around vitest-dev/vitest#6992 being an issue with Vite 6

    * Create eighty-lies-sort.md

    * chore: update to vitest 2.1.8

    * Bump package vitest version to 2.1.8

commit f2045be
Author: Pete Bacon Darwin <pete@bacondarwin.com>
Date:   Thu Dec 5 17:06:31 2024 +0000

    refactor: Ensure that unstable type exports are all prefixed with `Unstable_` rather than just `Unstable` (#7454)

commit bc0a980
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Oct 3 18:10:07 2024 +0100

    fix buikd

commit 76afe01
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Oct 3 17:58:21 2024 +0100

    packaging & icon

commit cc00903
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Oct 3 17:30:21 2024 +0100

    support new workers

commit 472b15d
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Oct 3 17:27:18 2024 +0100

    lockfile

commit adb2f57
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Mon Sep 23 13:45:06 2024 +0100

    WIP types

commit 72f2f99
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 18:18:16 2024 +0100

    import -> require

commit 853e030
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 18:04:30 2024 +0100

    better comment

commit 7dc9c53
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 18:00:15 2024 +0100

    better comment

commit b8c8e32
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 17:52:58 2024 +0100

    build wrangler

commit 6fd3a45
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 17:35:42 2024 +0100

    vsce deps

commit 5e0df56
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Sep 6 17:12:11 2024 +0100

    fix types

commit 9e8960d
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Mon Sep 2 12:03:39 2024 +0100

    sdk

commit 7ec1eed
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Aug 30 22:33:20 2024 +0100

    api

commit c6462ec
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Aug 9 20:51:13 2024 +0100

    fix build

commit 1bc79d4
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Aug 9 20:44:17 2024 +0100

    fix lint

commit f544b2a
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Aug 9 20:36:21 2024 +0100

    Resource provisioning

commit eb48c7c
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Fri Aug 30 20:33:39 2024 +0100

    a bit more

commit d2eef9f
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 19:00:55 2024 +0100

    add caching

commit 85aebb2
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 18:59:38 2024 +0100

    path

commit fd031f6
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 18:56:55 2024 +0100

    json

commit 5c2836e
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 18:51:45 2024 +0100

    version number

commit 1999b27
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 18:41:24 2024 +0100

    update lockfile

commit c67eba1
Author: Samuel Macleod <smacleod@cloudflare.com>
Date:   Thu Aug 29 18:31:43 2024 +0100

    first pass
  • Loading branch information
penalosa committed Dec 6, 2024
1 parent 5ea9d8e commit f0fc7bd
Show file tree
Hide file tree
Showing 113 changed files with 1,477 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/prereleases/1-versions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { getPackagesForPrerelease, setPackage } from "./0-packages.mjs";

function getPrereleaseVersion() {
const sha = execSync("git rev-parse --short HEAD", { encoding: "utf8" });
return `0.0.0-${sha.trim()}`;
// Prefix with a `v` to ensure the version is always alphanumeric rather than just numeric (which can cause issues with some tools e.g vsce)
return `0.0.0-v${sha.trim()}`;
}

/**
Expand Down
20 changes: 14 additions & 6 deletions .github/prereleases/2-build-pack-upload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ function packPackage(pkg) {

/**
* @param {~Package} pkg
* @param {string} tarballPath
* @param {string} artifactPath
*/
async function uploadPackageTarball(pkg, tarballPath) {
async function uploadPackageArtifact(pkg, artifactPath) {
const name = getPrereleaseArtifactName(pkg.json.name);
console.log(`Uploading ${tarballPath} as ${name}...`);
await artifact.uploadArtifact(name, [tarballPath], pkg.path);
console.log(`Uploading ${artifactPath} as ${name}...`);
await artifact.uploadArtifact(name, [artifactPath], pkg.path);
}

{
Expand All @@ -60,7 +60,15 @@ async function uploadPackageTarball(pkg, tarballPath) {
pkgs.forEach(setPackage);

for (const pkg of pkgs) {
const tarballPath = packPackage(pkg);
await uploadPackageTarball(pkg, tarballPath);
if (pkg.json["workers-sdk"].type === "extension") {
const filePath = path.join(
pkg.path,
`${pkg.json.name}-${pkg.json.version}.vsix`
);
await uploadPackageArtifact(pkg, filePath);
} else {
const tarballPath = packPackage(pkg);
await uploadPackageArtifact(pkg, tarballPath);
}
}
}
7 changes: 5 additions & 2 deletions .github/prereleases/3-comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ npx ${url} dev path/to/script.js
*/
function buildAdditionalArtifactReport(pkg) {
const name = pkg.json.name;
const type = pkg.json["workers-sdk"].type;
const url = getPrereleaseArtifactUrl(name);
if (name === "create-cloudflare") {
if (type === "cli") {
return `\`\`\`sh\nnpx ${url} --no-auto-update\n\`\`\``;
} else if (type === "extension") {
return `\`\`\`sh\nwget ${url} -O ./${name}.${pkg.json.version}.vsix && code --install-extension ./${name}.${pkg.json.version}.vsix\n\`\`\``;
} else {
return `\`\`\`sh\nnpm install ${url}\n\`\`\``;
}
Expand All @@ -68,7 +71,7 @@ function buildReport(pkgs) {
const additionalReports = pkgs.map(buildAdditionalArtifactReport);

return `${wranglerReport}
<details><summary>Additional artifacts:</summary>
${additionalReports.join("\n\n")}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/create-pullrequest-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:

- name: Install Dependencies
uses: ./.github/actions/install-dependencies
with:
turbo-api: ${{ secrets.TURBO_API }}
turbo-team: ${{ secrets.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}

- name: Build Miniflare
# `extract-runtime-versions.mjs` needs to be able to resolve `miniflare`, but we want to have the correct
Expand Down
5 changes: 5 additions & 0 deletions fixtures/pages-nodejs-v2-compat/worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Generated by Wrangler on Thu Aug 29 2024 19:37:32 GMT+0100 (British Summer Time)
// by running `wrangler types --x-include-runtime`

interface Env {
}
7 changes: 7 additions & 0 deletions fixtures/worker-ts/worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Generated by Wrangler on Fri Aug 30 2024 21:11:19 GMT+0100 (British Summer Time)
// by running `wrangler types --x-include-runtime`

interface Env {
SOME: KVNamespace;
HELLO: "WORLD";
}
30 changes: 30 additions & 0 deletions packages/cloudflare-workers-bindings-extension/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "import",
"format": [ "camelCase", "PascalCase" ]
}
],
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions packages/cloudflare-workers-bindings-extension/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"]
}
21 changes: 21 additions & 0 deletions packages/cloudflare-workers-bindings-extension/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
64 changes: 64 additions & 0 deletions packages/cloudflare-workers-bindings-extension/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"dependsOn": [
"npm: watch:tsc",
"npm: watch:esbuild"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "watch:esbuild",
"group": "build",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"label": "npm: watch:esbuild",
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"type": "npm",
"script": "watch:tsc",
"group": "build",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"label": "npm: watch:tsc",
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
14 changes: 14 additions & 0 deletions packages/cloudflare-workers-bindings-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
esbuild.js
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/.vscode-test.*
9 changes: 9 additions & 0 deletions packages/cloudflare-workers-bindings-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "cloudflare-workers-bindings-extension" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
1 change: 1 addition & 0 deletions packages/cloudflare-workers-bindings-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# cloudflare-workers-bindings-extension README
56 changes: 56 additions & 0 deletions packages/cloudflare-workers-bindings-extension/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const esbuild = require("esbuild");

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};

async function main() {
const ctx = await esbuild.context({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

main().catch(e => {
console.error(e);
process.exit(1);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f0fc7bd

Please sign in to comment.