From 55a76c831443ab9d6fe79adf1fe2d0e698430157 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Wed, 14 Feb 2024 15:10:45 -0500 Subject: [PATCH 01/14] fix: update fifoqueue and github to latest version of Wing (#72) --- fifoqueue/api.w | 4 ++-- fifoqueue/fifo-queue.aws.w | 4 ++-- fifoqueue/package.json | 2 +- github/package.json | 2 +- github/probot/adapter.w | 18 +++++++++--------- github/probot/types.w | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fifoqueue/api.w b/fifoqueue/api.w index 24b1ef77..fac4d631 100644 --- a/fifoqueue/api.w +++ b/fifoqueue/api.w @@ -9,6 +9,6 @@ pub struct PushOptions { pub struct SetConsumerOptions extends cloud.QueueSetConsumerOptions {} pub interface IFifoQueue { - setConsumer(handler: inflight (str): void, options: SetConsumerOptions?); - inflight push(message: str, options: PushOptions); + setConsumer(handler: inflight (str): void, options: SetConsumerOptions?): void; + inflight push(message: str, options: PushOptions): void; } diff --git a/fifoqueue/fifo-queue.aws.w b/fifoqueue/fifo-queue.aws.w index 74caeb05..e0964f4e 100644 --- a/fifoqueue/fifo-queue.aws.w +++ b/fifoqueue/fifo-queue.aws.w @@ -75,5 +75,5 @@ pub class FifoQueue_aws impl api.IFifoQueue { FifoQueue_aws._push(this.url, message, options.groupId); } - extern "./aws.js" static inflight _push(queueUrl: str, message: str, groupId: str); -} \ No newline at end of file + extern "./aws.js" static inflight _push(queueUrl: str, message: str, groupId: str): void; +} diff --git a/fifoqueue/package.json b/fifoqueue/package.json index bd2a091e..aa4a2294 100644 --- a/fifoqueue/package.json +++ b/fifoqueue/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/fifoqueue", - "version": "0.0.2", + "version": "0.0.3", "description": "A wing library to work with FIFO (first-in first-out) Queues", "author": { "name": "Elad Cohen", diff --git a/github/package.json b/github/package.json index a4ae2c0f..a9108de0 100644 --- a/github/package.json +++ b/github/package.json @@ -1,7 +1,7 @@ { "name": "@winglibs/github", "description": "A Wing library for GitHub Probot", - "version": "0.0.4", + "version": "0.0.5", "author": { "name": "Elad Cohen", "email": "eladc@wing.cloud" diff --git a/github/probot/adapter.w b/github/probot/adapter.w index 2511594c..c1d3e207 100644 --- a/github/probot/adapter.w +++ b/github/probot/adapter.w @@ -22,7 +22,7 @@ pub class ProbotAdapter { extern "./probot.js" pub static inflight createProbotAdapter(options: CreateAdapterOptions): probot.ProbotInstance; credentialsSupplier: IProbotAppCredentialsSupplier; - inflight var instance: probot.ProbotInstance?; + inflight var instance: probot.ProbotInstance; new(props: ProbotAdapterProps) { this.credentialsSupplier = props.credentialsSupplier; @@ -37,34 +37,34 @@ pub class ProbotAdapter { } pub inflight handlePullRequstOpened(handler: inflight (probot.PullRequestOpenedContext): void) { - this.instance?.webhooks?.on("pull_request.opened", handler); + this.instance.webhooks?.on("pull_request.opened", handler); } pub inflight handlePullRequstReopened(handler: inflight (probot.PullRequestOpenedContext): void) { - this.instance?.webhooks?.on("pull_request.reopened", handler); + this.instance.webhooks?.on("pull_request.reopened", handler); } pub inflight handlePullRequstSync(handler: inflight (probot.PullRequestSyncContext): void) { - this.instance?.webhooks?.on("pull_request.synchronize", handler); + this.instance.webhooks?.on("pull_request.synchronize", handler); } pub inflight handlePullRequstClosed(handler: inflight (probot.PullRequestClosedContext): void) { - this.instance?.webhooks?.on("pull_request.closed", handler); + this.instance.webhooks?.on("pull_request.closed", handler); } pub inflight handlePush(handler: inflight (probot.PushContext): void) { - this.instance?.webhooks?.on("push", handler); + this.instance.webhooks?.on("push", handler); } pub inflight verifyAndReceive(props: probot.VerifyAndReceieveProps) { - this.instance?.webhooks?.verifyAndReceive(props); + this.instance.webhooks?.verifyAndReceive(props); } pub inflight auth(installationId: num): octokit.OctoKit { - if let kit = this.instance?.auth?.call(this.instance, installationId) { + if let kit = this.instance.auth?.call(this.instance, installationId) { return kit; } else { throw "auth: fail to get octokit"; } } -} \ No newline at end of file +} diff --git a/github/probot/types.w b/github/probot/types.w index f02ed857..ea588f1b 100644 --- a/github/probot/types.w +++ b/github/probot/types.w @@ -72,15 +72,15 @@ pub struct VerifyAndReceieveProps { } pub interface IProbotWebhooks { - inflight on(name: str, handler: inflight (): void); - inflight verifyAndReceive(props: VerifyAndReceieveProps); + inflight on(name: str, handler: inflight (): void): void; + inflight verifyAndReceive(props: VerifyAndReceieveProps): void; } pub interface IProbotAuth { - inflight call(ProbotInstance, installationId: num): octokit.OctoKit; + inflight call(instance: ProbotInstance, installationId: num): octokit.OctoKit; } pub struct ProbotInstance { webhooks: IProbotWebhooks; auth: IProbotAuth; -} \ No newline at end of file +} From 7fae037c37bbc4caffb56e4ec3579cd7549164a8 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Wed, 14 Feb 2024 15:50:24 -0500 Subject: [PATCH 02/14] fix: sagemaker and checks breakages (#78) --- checks/check.w | 4 ++-- checks/package.json | 4 ++-- sagemaker/package.json | 2 +- sagemaker/sagemaker.test.w | 7 ++----- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/checks/check.w b/checks/check.w index 49334705..62b46298 100644 --- a/checks/check.w +++ b/checks/check.w @@ -88,7 +88,7 @@ pub class Check impl ICheck { * Invokes the check and returns it's result */ pub inflight run(): r.CheckResult { - let result = this.invoker.invoke(""); + let result = this.invoker.invoke("")!; return r.CheckResult.fromJson(Json.parse(result)); } @@ -98,4 +98,4 @@ pub class Check impl ICheck { pub inflight latest(): r.CheckResult? { return this.results.latest(this.checkid); } -} \ No newline at end of file +} diff --git a/checks/package.json b/checks/package.json index 95778b5a..ecbc0614 100644 --- a/checks/package.json +++ b/checks/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/checks", - "version": "0.0.6", + "version": "0.0.7", "description": "Cloud checks", "publishConfig": { "access": "public", @@ -21,4 +21,4 @@ "name": "Elad Ben-Israel" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/sagemaker/package.json b/sagemaker/package.json index 5f85806c..645a278b 100644 --- a/sagemaker/package.json +++ b/sagemaker/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/sagemaker", - "version": "0.0.1", + "version": "0.0.2", "description": "The library enables owners of a trained sagemaker model, to access its Endpoints from a winglang inflight code.", "repository": { "type": "git", diff --git a/sagemaker/sagemaker.test.w b/sagemaker/sagemaker.test.w index 7c7bbaad..1f286861 100644 --- a/sagemaker/sagemaker.test.w +++ b/sagemaker/sagemaker.test.w @@ -5,11 +5,8 @@ bring util; let sm = new sageMaker.Endpoint(util.tryEnv("ENDPOINT_NAME") ?? "Example-endopint", util.tryEnv("INFERENCE_NAME") ?? "Example-inference"); -let invokeModel = inflight (input: str) => { - let var s = input; - if input.length == 0 { - s = "Hi There!"; - } +let invokeModel = inflight (input: str?) => { + let var s = input ?? "Hi There!"; let res = sm.invoke( { inputs: "{s}" }, { ContentType: "application/json" }); log(res.Body); }; From e0dbf01acf0bc926ad742c7d0242d5541febc28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Thu, 15 Feb 2024 12:12:22 +0100 Subject: [PATCH 03/14] fix(ngrok): invalid relative path to `ngrok.js` (#79) Gathers the dirname during preflight so it can spawn the `ngrok.js` helper during inflight. --- ngrok/ngrok.w | 6 +++++- ngrok/util.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ngrok/ngrok.w b/ngrok/ngrok.w index cfaaed6e..f8db12d0 100644 --- a/ngrok/ngrok.w +++ b/ngrok/ngrok.w @@ -30,9 +30,10 @@ pub class Tunnel { throw "NGROK_AUTHTOKEN is not defined"; } + let dirname = Tunnel.dirname(); let s = new cloud.Service(inflight () => { try { - let child = Tunnel.spawn("node", Array["./ngrok.js", url, props?.domain]); + let child = Tunnel.spawn("node", Array["{dirname}/ngrok.js", url, props?.domain]); log("ngrok: {child.url()} => {url}"); let url = child.url(); this.state.set("url", url); @@ -63,4 +64,7 @@ pub class Tunnel { extern "./util.js" static inflight spawn(cmd: str, args: Array, opts: Json?): ChildProcess; + + extern "./util.js" + static dirname(): str; } \ No newline at end of file diff --git a/ngrok/util.js b/ngrok/util.js index e7028dd8..365c82e2 100644 --- a/ngrok/util.js +++ b/ngrok/util.js @@ -1,5 +1,7 @@ const { spawn } = require("child_process"); +exports.dirname = () => __dirname; + exports.spawn = async (cmd, args, opts) => { const child = spawn(cmd, args, { stdio: "pipe", ...opts }); return new Promise((resolve, reject) => { From 0179dcc08c00c5f1253ffb4e5ab939304b6090d2 Mon Sep 17 00:00:00 2001 From: eladcon Date: Thu, 15 Feb 2024 15:19:00 +0200 Subject: [PATCH 04/14] chore: update ngrok lib version (#80) --- ngrok/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngrok/package.json b/ngrok/package.json index 1fdd0aa4..c0ee94c8 100644 --- a/ngrok/package.json +++ b/ngrok/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/ngrok", - "version": "0.0.1", + "version": "0.0.2", "description": "ngrok library for Wing", "author": { "name": "Elad Ben-Israel", @@ -15,4 +15,4 @@ "dependencies": { "@ngrok/ngrok": "^0.9.1" } -} \ No newline at end of file +} From 2298c5a150dd4503f144eddf9d9f3198197b54a8 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Thu, 15 Feb 2024 16:19:45 -0500 Subject: [PATCH 05/14] chore: add log statement for test debugging (#81) --- containers/containers.test.w | 1 + containers/package-lock.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/containers/containers.test.w b/containers/containers.test.w index 104b19e6..0b01a385 100644 --- a/containers/containers.test.w +++ b/containers/containers.test.w @@ -35,6 +35,7 @@ let httpGet = inflight (url: str?): str => { test "access public url" { let helloBody = httpGet(hello.publicUrl); + log(helloBody); assert(helloBody.contains(message)); let echoBody = httpGet(echo.publicUrl); diff --git a/containers/package-lock.json b/containers/package-lock.json index 2be6cd76..3e527885 100644 --- a/containers/package-lock.json +++ b/containers/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/containers", - "version": "0.0.19", + "version": "0.0.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/containers", - "version": "0.0.19", + "version": "0.0.20", "license": "MIT", "dependencies": { "@cdktf/provider-aws": "^18.0.5", From ac783e7d6f44d2100a2a77d3b8f982969f6a2653 Mon Sep 17 00:00:00 2001 From: Hasan <45375125+hasanaburayyan@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:13:44 -0500 Subject: [PATCH 06/14] fix(containers): cannot publish over existing version (#83) --- containers/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/package.json b/containers/package.json index 69373395..a36a3b4f 100644 --- a/containers/package.json +++ b/containers/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/containers", - "version": "0.0.20", + "version": "0.0.21", "description": "Container support for Wing", "repository": { "type": "git", From 7d549c111f296b3f958eed091b11aa7b381c27d5 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Sun, 18 Feb 2024 16:39:47 -0500 Subject: [PATCH 07/14] chore: disable container canary tests (#84) These tests are failing intermittently - I couldn't seem to figure out the root cause so this will disable them for now. Opened a separate issue to track this: https://github.com/winglang/wing/issues/5716 Misc: - Updated package lock files --- .github/workflows/bedrock-release.yaml | 2 ++ .github/workflows/canary.yaml | 39 ++++++----------------- .github/workflows/checks-release.yaml | 2 ++ .github/workflows/containers-release.yaml | 2 ++ .github/workflows/fifoqueue-release.yaml | 2 ++ .github/workflows/github-release.yaml | 2 ++ .github/workflows/ngrok-release.yaml | 2 ++ .github/workflows/postgres-release.yaml | 2 ++ .github/workflows/redis-release.yaml | 2 ++ .github/workflows/sagemaker-release.yaml | 2 ++ .github/workflows/websockets-release.yaml | 2 ++ canary.w | 7 ++-- checks/package-lock.json | 4 +-- containers/package-lock.json | 4 +-- fifoqueue/package-lock.json | 4 +-- generate-workflows.main.w | 7 +++- github/package-lock.json | 4 +-- library.w | 5 +-- ngrok/package-lock.json | 4 +-- postgres/package-lock.json | 10 ++++++ redis/package-lock.json | 18 ++++++++++- sagemaker/package-lock.json | 4 +-- test-all.sh | 4 +-- websockets/package-lock.json | 9 ++++++ 24 files changed, 93 insertions(+), 50 deletions(-) diff --git a/.github/workflows/bedrock-release.yaml b/.github/workflows/bedrock-release.yaml index a701cd40..0f05b146 100644 --- a/.github/workflows/bedrock-release.yaml +++ b/.github/workflows/bedrock-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - bedrock/** + paths-ignore: + - bedrock/package-lock.json jobs: build-bedrock: runs-on: ubuntu-latest diff --git a/.github/workflows/canary.yaml b/.github/workflows/canary.yaml index e69e5c3b..8f39d30d 100644 --- a/.github/workflows/canary.yaml +++ b/.github/workflows/canary.yaml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -36,7 +36,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -46,27 +46,6 @@ jobs: - name: Test run: wing test working-directory: checks - canary-containers: - name: Test containers - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - sparse-checkout: containers - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18.x - registry-url: https://registry.npmjs.org - - name: Install winglang - run: npm i -g winglang - - name: Install dependencies - run: npm install --include=dev - working-directory: containers - - name: Test - run: wing test - working-directory: containers canary-fifoqueue: name: Test fifoqueue runs-on: ubuntu-latest @@ -78,7 +57,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -99,7 +78,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -120,7 +99,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -141,7 +120,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -162,7 +141,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -183,7 +162,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang @@ -204,7 +183,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x registry-url: https://registry.npmjs.org - name: Install winglang run: npm i -g winglang diff --git a/.github/workflows/checks-release.yaml b/.github/workflows/checks-release.yaml index b8b6ac5e..0296264a 100644 --- a/.github/workflows/checks-release.yaml +++ b/.github/workflows/checks-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - checks/** + paths-ignore: + - checks/package-lock.json jobs: build-checks: runs-on: ubuntu-latest diff --git a/.github/workflows/containers-release.yaml b/.github/workflows/containers-release.yaml index 70bdc7e0..9f3db2bb 100644 --- a/.github/workflows/containers-release.yaml +++ b/.github/workflows/containers-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - containers/** + paths-ignore: + - containers/package-lock.json jobs: build-containers: runs-on: ubuntu-latest diff --git a/.github/workflows/fifoqueue-release.yaml b/.github/workflows/fifoqueue-release.yaml index 7e890257..b4274a46 100644 --- a/.github/workflows/fifoqueue-release.yaml +++ b/.github/workflows/fifoqueue-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - fifoqueue/** + paths-ignore: + - fifoqueue/package-lock.json jobs: build-fifoqueue: runs-on: ubuntu-latest diff --git a/.github/workflows/github-release.yaml b/.github/workflows/github-release.yaml index 7aea3c70..b2f78f12 100644 --- a/.github/workflows/github-release.yaml +++ b/.github/workflows/github-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - github/** + paths-ignore: + - github/package-lock.json jobs: build-github: runs-on: ubuntu-latest diff --git a/.github/workflows/ngrok-release.yaml b/.github/workflows/ngrok-release.yaml index 3f6b77f4..7dc2296b 100644 --- a/.github/workflows/ngrok-release.yaml +++ b/.github/workflows/ngrok-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - ngrok/** + paths-ignore: + - ngrok/package-lock.json jobs: build-ngrok: runs-on: ubuntu-latest diff --git a/.github/workflows/postgres-release.yaml b/.github/workflows/postgres-release.yaml index b87bdd89..2f7f0deb 100644 --- a/.github/workflows/postgres-release.yaml +++ b/.github/workflows/postgres-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - postgres/** + paths-ignore: + - postgres/package-lock.json jobs: build-postgres: runs-on: ubuntu-latest diff --git a/.github/workflows/redis-release.yaml b/.github/workflows/redis-release.yaml index 21d64019..e09d48e7 100644 --- a/.github/workflows/redis-release.yaml +++ b/.github/workflows/redis-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - redis/** + paths-ignore: + - redis/package-lock.json jobs: build-redis: runs-on: ubuntu-latest diff --git a/.github/workflows/sagemaker-release.yaml b/.github/workflows/sagemaker-release.yaml index 0db46b96..d4c8269e 100644 --- a/.github/workflows/sagemaker-release.yaml +++ b/.github/workflows/sagemaker-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - sagemaker/** + paths-ignore: + - sagemaker/package-lock.json jobs: build-sagemaker: runs-on: ubuntu-latest diff --git a/.github/workflows/websockets-release.yaml b/.github/workflows/websockets-release.yaml index e5a9d2e8..f6416a70 100644 --- a/.github/workflows/websockets-release.yaml +++ b/.github/workflows/websockets-release.yaml @@ -5,6 +5,8 @@ on: - main paths: - websockets/** + paths-ignore: + - websockets/package-lock.json jobs: build-websockets: runs-on: ubuntu-latest diff --git a/canary.w b/canary.w index 2fb8f256..354189bf 100644 --- a/canary.w +++ b/canary.w @@ -1,7 +1,7 @@ bring fs; pub class CanaryWorkflow { - new(workflowdir: str, libs: Array) { + new(workflowdir: str, libs: Array, skipLibs: Array?) { let testLibSteps = (lib: str): Array => { return [ { @@ -15,7 +15,7 @@ pub class CanaryWorkflow { name: "Setup Node.js", uses: "actions/setup-node@v3", with: { - "node-version": "18.x", + "node-version": "20.x", "registry-url": "https://registry.npmjs.org", }, }, @@ -38,6 +38,9 @@ pub class CanaryWorkflow { let jobs = MutJson {}; for lib in libs { + if (skipLibs ?? []).contains(lib) { + continue; + } jobs.set("canary-{lib}", { name: "Test {lib}", "runs-on": "ubuntu-latest", diff --git a/checks/package-lock.json b/checks/package-lock.json index b3546245..f4057063 100644 --- a/checks/package-lock.json +++ b/checks/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/checks", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/checks", - "version": "0.0.6", + "version": "0.0.7", "license": "MIT" }, "node_modules/.pnpm/constructs@10.0.0/node_modules/constructs": { diff --git a/containers/package-lock.json b/containers/package-lock.json index 3e527885..5a1aa38e 100644 --- a/containers/package-lock.json +++ b/containers/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/containers", - "version": "0.0.20", + "version": "0.0.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/containers", - "version": "0.0.20", + "version": "0.0.21", "license": "MIT", "dependencies": { "@cdktf/provider-aws": "^18.0.5", diff --git a/fifoqueue/package-lock.json b/fifoqueue/package-lock.json index 1e9bbc82..5148e430 100644 --- a/fifoqueue/package-lock.json +++ b/fifoqueue/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/fifoqueue", - "version": "0.0.2", + "version": "0.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/fifoqueue", - "version": "0.0.2", + "version": "0.0.3", "license": "MIT", "dependencies": { "@aws-sdk/client-sqs": "^3.460.0", diff --git a/generate-workflows.main.w b/generate-workflows.main.w index 7a7c22b2..9a8bb3b9 100644 --- a/generate-workflows.main.w +++ b/generate-workflows.main.w @@ -26,4 +26,9 @@ for file in fs.readdir(".") { new stale.StaleWorkflow(workflowdir); new mergify.MergifyWorkflow(libs.copy()); new prlint.PullRequestLintWorkflow(workflowdir); -new canary.CanaryWorkflow(workflowdir, libs.copy()); + +let skipCanaryTests = [ + "containers" // https://github.com/winglang/wing/issues/5716 +]; + +new canary.CanaryWorkflow(workflowdir, libs.copy(), skipCanaryTests); diff --git a/github/package-lock.json b/github/package-lock.json index 473924a5..0f37db40 100644 --- a/github/package-lock.json +++ b/github/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/github", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/github", - "version": "0.0.4", + "version": "0.0.5", "license": "MIT", "dependencies": { "@probot/adapter-aws-lambda-serverless": "^3.0.4", diff --git a/library.w b/library.w index 4e62eb04..488a14fe 100644 --- a/library.w +++ b/library.w @@ -113,7 +113,8 @@ pub class Library { on: { push: { branches: ["main"], - paths: ["{libdir}/**"] + paths: ["{libdir}/**"], + "paths-ignore": ["{libdir}/package-lock.json"], } }, jobs: Json.deepCopy(releaseJobs), @@ -128,7 +129,7 @@ pub class Library { name: "{base}-pull", on: { pull_request: { - paths: ["{libdir}/**"] + paths: ["{libdir}/**"], } }, jobs: Json.deepCopy(pullJobs), diff --git a/ngrok/package-lock.json b/ngrok/package-lock.json index 367e2b52..77fdd6fd 100644 --- a/ngrok/package-lock.json +++ b/ngrok/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/ngrok", - "version": "0.0.1", + "version": "0.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/ngrok", - "version": "0.0.1", + "version": "0.0.2", "license": "MIT", "dependencies": { "@ngrok/ngrok": "^0.9.1" diff --git a/postgres/package-lock.json b/postgres/package-lock.json index 7c7fce63..e7745e0d 100644 --- a/postgres/package-lock.json +++ b/postgres/package-lock.json @@ -597,6 +597,15 @@ "@octokit/openapi-types": "^12.11.0" } }, + "node_modules/@opentelemetry/api": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", + "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -9679,6 +9688,7 @@ "version": "2.4.3", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "optional": true, "engines": { "node": ">=10" } diff --git a/redis/package-lock.json b/redis/package-lock.json index 9e511a4a..e019b384 100644 --- a/redis/package-lock.json +++ b/redis/package-lock.json @@ -799,6 +799,15 @@ "@octokit/openapi-types": "^12.11.0" } }, + "node_modules/@opentelemetry/api": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", + "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -9838,6 +9847,7 @@ "version": "2.4.3", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "optional": true, "engines": { "node": ">=10" } @@ -11424,6 +11434,11 @@ "@octokit/openapi-types": "^12.11.0" } }, + "@opentelemetry/api": { + "version": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", + "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", + "peer": true + }, "@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -18009,7 +18024,8 @@ "safe-stable-stringify": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==" + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "optional": true }, "safer-buffer": { "version": "2.1.2", diff --git a/sagemaker/package-lock.json b/sagemaker/package-lock.json index e8469208..cc698a8b 100644 --- a/sagemaker/package-lock.json +++ b/sagemaker/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/sagemaker", - "version": "0.0.1", + "version": "0.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/sagemaker", - "version": "0.0.1", + "version": "0.0.2", "license": "MIT", "dependencies": { "@aws-sdk/client-sagemaker-runtime": "^3.507.0" diff --git a/test-all.sh b/test-all.sh index 9bef4483..beb0e2b5 100755 --- a/test-all.sh +++ b/test-all.sh @@ -9,7 +9,7 @@ for i in $(ls -F); do ( cd $i npm i - wing test **/*.test.w + wing test ) fi -done \ No newline at end of file +done diff --git a/websockets/package-lock.json b/websockets/package-lock.json index 56c676a0..faeb2426 100644 --- a/websockets/package-lock.json +++ b/websockets/package-lock.json @@ -885,6 +885,15 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/@opentelemetry/api": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", + "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", From cb7c8a8868a598c3d17085f8933c092347babd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 09:43:46 +0100 Subject: [PATCH 08/14] feat: `bring vite` (#82) --- .editorconfig | 12 + .github/workflows/vite-pull.yaml | 26 + .github/workflows/vite-release.yaml | 38 + vite/.gitignore | 2 + vite/LICENSE | 21 + vite/README.md | 40 + vite/example/.gitignore | 2 + vite/example/index.html | 11 + vite/package-lock.json | 1251 +++++++++++++++++++++++++++ vite/package.json | 16 + vite/util.cjs | 19 + vite/vite-cli.mjs | 53 ++ vite/vite-plugin.mjs | 75 ++ vite/vite-types.w | 29 + vite/vite.cjs | 51 ++ vite/vite.sim.w | 35 + vite/vite.test.w | 33 + vite/vite.tf-aws.w | 183 ++++ vite/vite.w | 24 + 19 files changed, 1921 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/vite-pull.yaml create mode 100644 .github/workflows/vite-release.yaml create mode 100644 vite/.gitignore create mode 100644 vite/LICENSE create mode 100644 vite/README.md create mode 100644 vite/example/.gitignore create mode 100644 vite/example/index.html create mode 100644 vite/package-lock.json create mode 100644 vite/package.json create mode 100644 vite/util.cjs create mode 100644 vite/vite-cli.mjs create mode 100644 vite/vite-plugin.mjs create mode 100644 vite/vite-types.w create mode 100644 vite/vite.cjs create mode 100644 vite/vite.sim.w create mode 100644 vite/vite.test.w create mode 100644 vite/vite.tf-aws.w create mode 100644 vite/vite.w diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4a7ea303 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/vite-pull.yaml b/.github/workflows/vite-pull.yaml new file mode 100644 index 00000000..e3ad1aef --- /dev/null +++ b/.github/workflows/vite-pull.yaml @@ -0,0 +1,26 @@ +name: vite-pull +on: + pull_request: + paths: + - vite/** +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + sparse-checkout: vite + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + - name: Install winglang + run: npm i -g winglang + - name: Install dependencies + run: npm install + working-directory: vite + - name: Test + run: wing test + working-directory: vite diff --git a/.github/workflows/vite-release.yaml b/.github/workflows/vite-release.yaml new file mode 100644 index 00000000..2d738831 --- /dev/null +++ b/.github/workflows/vite-release.yaml @@ -0,0 +1,38 @@ +name: vite-release +on: + push: + branches: + - main + paths: + - vite/** +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + sparse-checkout: vite + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + - name: Install winglang + run: npm i -g winglang + - name: Install dependencies + run: npm install + working-directory: vite + - name: Test + run: wing test + working-directory: vite + - name: Pack + run: wing pack + working-directory: vite + - name: Publish + run: + npm publish --access=public --registry https://registry.npmjs.org --tag + latest *.tgz + working-directory: vite + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/vite/.gitignore b/vite/.gitignore new file mode 100644 index 00000000..297fdef9 --- /dev/null +++ b/vite/.gitignore @@ -0,0 +1,2 @@ +target/ +node_modules/ diff --git a/vite/LICENSE b/vite/LICENSE new file mode 100644 index 00000000..a875f479 --- /dev/null +++ b/vite/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Wing + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vite/README.md b/vite/README.md new file mode 100644 index 00000000..e46686a0 --- /dev/null +++ b/vite/README.md @@ -0,0 +1,40 @@ +# vite + +`@winglibs/vite` allows using a [Vite](https://vitejs.dev/) project with Wing. + +## Prerequisites + +- [winglang](https://winglang.io). + +## Installation + +```sh +npm i @winglibs/vite +``` + +## Usage + +```js +bring cloud; +bring vite; + +let api = new cloud.Api(); + +let website = new vite.Vite( + // The path to the website root. + root: "../website", + + // Environment variables passed to the Vite project. + // They'll available through the global `wing` object. + publicEnv: { + API_URL: api.url, + }, +); + +// Get the URL of the website. +let url = website.url; +``` + +## License + +This library is licensed under the [MIT License](./LICENSE). diff --git a/vite/example/.gitignore b/vite/example/.gitignore new file mode 100644 index 00000000..96a34942 --- /dev/null +++ b/vite/example/.gitignore @@ -0,0 +1,2 @@ +/.winglibs/ +/dist/ diff --git a/vite/example/index.html b/vite/example/index.html new file mode 100644 index 00000000..3c51c56c --- /dev/null +++ b/vite/example/index.html @@ -0,0 +1,11 @@ + + + + + + Example + + +

Example

+ + diff --git a/vite/package-lock.json b/vite/package-lock.json new file mode 100644 index 00000000..58ead9f9 --- /dev/null +++ b/vite/package-lock.json @@ -0,0 +1,1251 @@ +{ + "name": "@winglibs/vite", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@winglibs/vite", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "@cdktf/provider-aws": "^19.6.0", + "cdktf": "^0.20.3", + "mime-types": "^2.1.35", + "vite": "^5.1.3" + } + }, + "node_modules/@cdktf/provider-aws": { + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/@cdktf/provider-aws/-/provider-aws-19.6.0.tgz", + "integrity": "sha512-OnY3z9PA4ZMVT3P/4QdOF8PeMv06ROfSEGLmLOPINArEnBs1RdU51ZwD3uZH9fX3gFHBMvqdMLneWOw5JrVQnA==", + "engines": { + "node": ">= 18.12.0" + }, + "peerDependencies": { + "cdktf": "^0.20.0", + "constructs": "^10.3.0" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.7.tgz", + "integrity": "sha512-YGSPnndkcLo4PmVl2tKatEn+0mlVMr3yEpOOT0BeMria87PhvoJb5dg5f5Ft9fbCVgtAz4pWMzZVgSEGpDAlww==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.7.tgz", + "integrity": "sha512-YEDcw5IT7hW3sFKZBkCAQaOCJQLONVcD4bOyTXMZz5fr66pTHnAet46XAtbXAkJRfIn2YVhdC6R9g4xa27jQ1w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.7.tgz", + "integrity": "sha512-jhINx8DEjz68cChFvM72YzrqfwJuFbfvSxZAk4bebpngGfNNRm+zRl4rtT9oAX6N9b6gBcFaJHFew5Blf6CvUw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.7.tgz", + "integrity": "sha512-dr81gbmWN//3ZnBIm6YNCl4p3pjnabg1/ZVOgz2fJoUO1a3mq9WQ/1iuEluMs7mCL+Zwv7AY5e3g1hjXqQZ9Iw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.7.tgz", + "integrity": "sha512-Lc0q5HouGlzQEwLkgEKnWcSazqr9l9OdV2HhVasWJzLKeOt0PLhHaUHuzb8s/UIya38DJDoUm74GToZ6Wc7NGQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.7.tgz", + "integrity": "sha512-+y2YsUr0CxDFF7GWiegWjGtTUF6gac2zFasfFkRJPkMAuMy9O7+2EH550VlqVdpEEchWMynkdhC9ZjtnMiHImQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.7.tgz", + "integrity": "sha512-CdXOxIbIzPJmJhrpmJTLx+o35NoiKBIgOvmvT+jeSadYiWJn0vFKsl+0bSG/5lwjNHoIDEyMYc/GAPR9jxusTA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.7.tgz", + "integrity": "sha512-Y+SCmWxsJOdQtjcBxoacn/pGW9HDZpwsoof0ttL+2vGcHokFlfqV666JpfLCSP2xLxFpF1lj7T3Ox3sr95YXww==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.7.tgz", + "integrity": "sha512-inHqdOVCkUhHNvuQPT1oCB7cWz9qQ/Cz46xmVe0b7UXcuIJU3166aqSunsqkgSGMtUCWOZw3+KMwI6otINuC9g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.7.tgz", + "integrity": "sha512-2BbiL7nLS5ZO96bxTQkdO0euGZIUQEUXMTrqLxKUmk/Y5pmrWU84f+CMJpM8+EHaBPfFSPnomEaQiG/+Gmh61g==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.7.tgz", + "integrity": "sha512-BVFQla72KXv3yyTFCQXF7MORvpTo4uTA8FVFgmwVrqbB/4DsBFWilUm1i2Oq6zN36DOZKSVUTb16jbjedhfSHw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.7.tgz", + "integrity": "sha512-DzAYckIaK+pS31Q/rGpvUKu7M+5/t+jI+cdleDgUwbU7KdG2eC3SUbZHlo6Q4P1CfVKZ1lUERRFP8+q0ob9i2w==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.7.tgz", + "integrity": "sha512-JQ1p0SmUteNdUaaiRtyS59GkkfTW0Edo+e0O2sihnY4FoZLz5glpWUQEKMSzMhA430ctkylkS7+vn8ziuhUugQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.7.tgz", + "integrity": "sha512-xGwVJ7eGhkprY/nB7L7MXysHduqjpzUl40+XoYDGC4UPLbnG+gsyS1wQPJ9lFPcxYAaDXbdRXd1ACs9AE9lxuw==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.7.tgz", + "integrity": "sha512-U8Rhki5PVU0L0nvk+E8FjkV8r4Lh4hVEb9duR6Zl21eIEYEwXz8RScj4LZWA2i3V70V4UHVgiqMpszXvG0Yqhg==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.7.tgz", + "integrity": "sha512-ZYZopyLhm4mcoZXjFt25itRlocKlcazDVkB4AhioiL9hOWhDldU9n38g62fhOI4Pth6vp+Mrd5rFKxD0/S+7aQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.7.tgz", + "integrity": "sha512-/yfjlsYmT1O3cum3J6cmGG16Fd5tqKMcg5D+sBYLaOQExheAJhqr8xOAEIuLo8JYkevmjM5zFD9rVs3VBcsjtQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.7.tgz", + "integrity": "sha512-MYDFyV0EW1cTP46IgUJ38OnEY5TaXxjoDmwiTXPjezahQgZd+j3T55Ht8/Q9YXBM0+T9HJygrSRGV5QNF/YVDQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.7.tgz", + "integrity": "sha512-JcPvgzf2NN/y6X3UUSqP6jSS06V0DZAV/8q0PjsZyGSXsIGcG110XsdmuWiHM+pno7/mJF6fjH5/vhUz/vA9fw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.7.tgz", + "integrity": "sha512-ZA0KSYti5w5toax5FpmfcAgu3ZNJxYSRm0AW/Dao5up0YV1hDVof1NvwLomjEN+3/GMtaWDI+CIyJOMTRSTdMw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.7.tgz", + "integrity": "sha512-CTOnijBKc5Jpk6/W9hQMMvJnsSYRYgveN6O75DTACCY18RA2nqka8dTZR+x/JqXCRiKk84+5+bRKXUSbbwsS0A==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.7.tgz", + "integrity": "sha512-gRaP2sk6hc98N734luX4VpF318l3w+ofrtTu9j5L8EQXF+FzQKV6alCOHMVoJJHvVK/mGbwBXfOL1HETQu9IGQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.5.2.tgz", + "integrity": "sha512-ee7BudTwwrglFYSc3UnqInDDjCLWHKrFmGNi4aK7jlEyg4CyPa1DCMrZfsN1O13YT76UFEqXz2CoN7BCGpUlJw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.5.2.tgz", + "integrity": "sha512-xOuhj9HHtn8128ir8veoQsBbAUBasDbHIBniYTEx02pAmu9EXL+ZjJqngnNEy6ZgZ4h1JwL33GMNu3yJL5Mzow==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.5.2.tgz", + "integrity": "sha512-NTGJWoL8bKyqyWFn9/RzSv4hQ4wTbaAv0lHHRwf4OnpiiP4P8W0jiXbm8Nc5BCXKmWAwuvJY82mcIU2TayC20g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.5.2.tgz", + "integrity": "sha512-hlKqj7bpPvU15sZo4za14u185lpMzdwWLMc9raMqPK4wywt0wR23y1CaVQ4oAFXat3b5/gmRntyfpwWTKl+vvA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.5.2.tgz", + "integrity": "sha512-7ZIZx8c3u+pfI0ohQsft/GywrXez0uR6dUP0JhBuCK3sFO5TfdLn/YApnVkvPxuTv3+YKPIZend9Mt7Cz6sS3Q==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.5.2.tgz", + "integrity": "sha512-7Pk/5mO11JW/cH+a8lL/i0ZxmRGrbpYqN0VwO2DHhU+SJWWOH2zE1RAcPaj8KqiwC8DCDIJOSxjV9+9lLb6aeA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.5.2.tgz", + "integrity": "sha512-KrRnuG5phJx756e62wxvWH2e+TK84MP2IVuPwfge+GBvWqIUfVzFRn09TKruuQBXzZp52Vyma7FjMDkwlA9xpg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.5.2.tgz", + "integrity": "sha512-My+53GasPa2D2tU5dXiyHYwrELAUouSfkNlZ3bUKpI7btaztO5vpALEs3mvFjM7aKTvEbc7GQckuXeXIDKQ0fg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.5.2.tgz", + "integrity": "sha512-/f0Q6Sc+Vw54Ws6N8fxaEe4R7at3b8pFyv+O/F2VaQ4hODUJcRUcCBJh6zuqtgQQt7w845VTkGLFgWZkP3tUoQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.5.2.tgz", + "integrity": "sha512-NCKuuZWLht6zj7s6EIFef4BxCRX1GMr83S2W4HPCA0RnJ4iHE4FS1695q6Ewoa6A9nFjJe1//yUu0kgBU07Edw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.5.2.tgz", + "integrity": "sha512-J5zL3riR4AOyU/J3M/i4k/zZ8eP1yT+nTmAKztCXJtnI36jYH0eepvob22mAQ/kLwfsK2TB6dbyVY1F8c/0H5A==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.5.2.tgz", + "integrity": "sha512-pL0RXRHuuGLhvs7ayX/SAHph1hrDPXOM5anyYUQXWJEENxw3nfHkzv8FfVlEVcLyKPAEgDRkd6RKZq2SMqS/yg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/cdktf": { + "version": "0.20.3", + "resolved": "https://registry.npmjs.org/cdktf/-/cdktf-0.20.3.tgz", + "integrity": "sha512-y8F3pjYzbMHy9ZG3yXSSerx2Yv9dr2i2j2842IKT1tpN74CBfuuPrselTNdI6QoaMvlQJQQB2l93cJmL6eIkaw==", + "bundleDependencies": [ + "archiver", + "json-stable-stringify", + "semver" + ], + "dependencies": { + "archiver": "6.0.1", + "json-stable-stringify": "1.1.0", + "semver": "7.5.4" + }, + "peerDependencies": { + "constructs": "^10.0.25" + } + }, + "node_modules/cdktf/node_modules/archiver": { + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^4.0.1", + "async": "^3.2.4", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^3.0.0", + "zip-stream": "^5.0.1" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/cdktf/node_modules/archiver-utils": { + "version": "4.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "glob": "^8.0.0", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash": "^4.17.15", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/cdktf/node_modules/async": { + "version": "3.2.5", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/b4a": { + "version": "1.6.4", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/balanced-match": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/brace-expansion": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/cdktf/node_modules/buffer-crc32": { + "version": "0.2.13", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/cdktf/node_modules/call-bind": { + "version": "1.0.5", + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/compress-commons": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "crc32-stream": "^5.0.0", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/cdktf/node_modules/core-util-is": { + "version": "1.0.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/crc-32": { + "version": "1.2.2", + "inBundle": true, + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/cdktf/node_modules/crc32-stream": { + "version": "5.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/cdktf/node_modules/define-data-property": { + "version": "1.1.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/cdktf/node_modules/fast-fifo": { + "version": "1.3.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/fs.realpath": { + "version": "1.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/function-bind": { + "version": "1.1.2", + "inBundle": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/get-intrinsic": { + "version": "1.2.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/glob": { + "version": "8.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cdktf/node_modules/gopd": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/graceful-fs": { + "version": "4.2.11", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/has-property-descriptors": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/has-proto": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/has-symbols": { + "version": "1.0.3", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/hasown": { + "version": "2.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/cdktf/node_modules/inflight": { + "version": "1.0.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/cdktf/node_modules/inherits": { + "version": "2.0.4", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/isarray": { + "version": "2.0.5", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/json-stable-stringify": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/jsonify": { + "version": "0.0.1", + "inBundle": true, + "license": "Public Domain", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cdktf/node_modules/lazystream": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/cdktf/node_modules/lazystream/node_modules/isarray": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "inBundle": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/cdktf/node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/cdktf/node_modules/lodash": { + "version": "4.17.21", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/lru-cache": { + "version": "6.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cdktf/node_modules/minimatch": { + "version": "5.1.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cdktf/node_modules/normalize-path": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cdktf/node_modules/object-keys": { + "version": "1.1.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/cdktf/node_modules/once": { + "version": "1.4.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/cdktf/node_modules/process-nextick-args": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/queue-tick": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/readable-stream": { + "version": "3.6.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/cdktf/node_modules/readdir-glob": { + "version": "1.1.3", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/cdktf/node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/semver": { + "version": "7.5.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cdktf/node_modules/set-function-length": { + "version": "1.1.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/cdktf/node_modules/streamx": { + "version": "2.15.6", + "inBundle": true, + "license": "MIT", + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, + "node_modules/cdktf/node_modules/string_decoder": { + "version": "1.3.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/cdktf/node_modules/tar-stream": { + "version": "3.1.6", + "inBundle": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/cdktf/node_modules/util-deprecate": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/cdktf/node_modules/wrappy": { + "version": "1.0.2", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/yallist": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/cdktf/node_modules/zip-stream": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^4.0.1", + "compress-commons": "^5.0.1", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/constructs": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/constructs/-/constructs-10.3.0.tgz", + "integrity": "sha512-vbK8i3rIb/xwZxSpTjz3SagHn1qq9BChLEfy5Hf6fB3/2eFbrwt2n9kHwQcS0CPTRBesreeAcsJfMq2229FnbQ==", + "peer": true, + "engines": { + "node": ">= 16.14.0" + } + }, + "node_modules/esbuild": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.7.tgz", + "integrity": "sha512-6brbTZVqxhqgbpqBR5MzErImcpA0SQdoKOkcWK/U30HtQxnokIpG3TX2r0IJqbFUzqLjhU/zC1S5ndgakObVCQ==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.7", + "@esbuild/android-arm64": "0.19.7", + "@esbuild/android-x64": "0.19.7", + "@esbuild/darwin-arm64": "0.19.7", + "@esbuild/darwin-x64": "0.19.7", + "@esbuild/freebsd-arm64": "0.19.7", + "@esbuild/freebsd-x64": "0.19.7", + "@esbuild/linux-arm": "0.19.7", + "@esbuild/linux-arm64": "0.19.7", + "@esbuild/linux-ia32": "0.19.7", + "@esbuild/linux-loong64": "0.19.7", + "@esbuild/linux-mips64el": "0.19.7", + "@esbuild/linux-ppc64": "0.19.7", + "@esbuild/linux-riscv64": "0.19.7", + "@esbuild/linux-s390x": "0.19.7", + "@esbuild/linux-x64": "0.19.7", + "@esbuild/netbsd-x64": "0.19.7", + "@esbuild/openbsd-x64": "0.19.7", + "@esbuild/sunos-x64": "0.19.7", + "@esbuild/win32-arm64": "0.19.7", + "@esbuild/win32-ia32": "0.19.7", + "@esbuild/win32-x64": "0.19.7" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/postcss": { + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.5.2.tgz", + "integrity": "sha512-CRK1uoROBfkcqrZKyaFcqCcZWNsvJ6yVYZkqTlRocZhO2s5yER6Z3f/QaYtO8RGyloPnmhwgzuPQpNGeK210xQ==", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.5.2", + "@rollup/rollup-android-arm64": "4.5.2", + "@rollup/rollup-darwin-arm64": "4.5.2", + "@rollup/rollup-darwin-x64": "4.5.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.5.2", + "@rollup/rollup-linux-arm64-gnu": "4.5.2", + "@rollup/rollup-linux-arm64-musl": "4.5.2", + "@rollup/rollup-linux-x64-gnu": "4.5.2", + "@rollup/rollup-linux-x64-musl": "4.5.2", + "@rollup/rollup-win32-arm64-msvc": "4.5.2", + "@rollup/rollup-win32-ia32-msvc": "4.5.2", + "@rollup/rollup-win32-x64-msvc": "4.5.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/vite": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.3.tgz", + "integrity": "sha512-UfmUD36DKkqhi/F75RrxvPpry+9+tTkrXfMNZD+SboZqBCMsxKtO52XeGzzuh7ioz+Eo/SYDBbdb0Z7vgcDJew==", + "dependencies": { + "esbuild": "^0.19.3", + "postcss": "^8.4.35", + "rollup": "^4.2.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + } + } +} diff --git a/vite/package.json b/vite/package.json new file mode 100644 index 00000000..6c9156b9 --- /dev/null +++ b/vite/package.json @@ -0,0 +1,16 @@ +{ + "name": "@winglibs/vite", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "https://github.com/winglang/winglibs.git", + "directory": "vite" + }, + "license": "MIT", + "dependencies": { + "@cdktf/provider-aws": "^19.6.0", + "cdktf": "^0.20.3", + "mime-types": "^2.1.35", + "vite": "^5.1.3" + } +} diff --git a/vite/util.cjs b/vite/util.cjs new file mode 100644 index 00000000..289c7b60 --- /dev/null +++ b/vite/util.cjs @@ -0,0 +1,19 @@ +const PAYLOAD_PREFIX = "__WINGLIBS_VITE_0WgrTtVXAiskivf2cIM-Z__"; + +exports.stringifyPayload = (payload) => { + return `${PAYLOAD_PREFIX}${JSON.stringify(payload)}`; +}; + +exports.parsePayload = (payload) => { + if (!payload.startsWith(PAYLOAD_PREFIX)) { + return undefined; + } + + return JSON.parse(payload.substring(PAYLOAD_PREFIX.length)); +}; + +const { contentType } = require("mime-types"); +const { extname } = require("node:path"); +exports.contentType = (filename) => { + return contentType(extname(filename)); +}; diff --git a/vite/vite-cli.mjs b/vite/vite-cli.mjs new file mode 100644 index 00000000..ee1c5b89 --- /dev/null +++ b/vite/vite-cli.mjs @@ -0,0 +1,53 @@ +import { parseArgs } from "node:util"; +import { createServer, build, resolveConfig } from "vite"; +import { createRequire } from "node:module"; +import { plugin } from "./vite-plugin.mjs"; +const { stringifyPayload } = createRequire(import.meta.url)("./util.cjs"); + +const args = parseArgs({ + allowPositionals: true, + options: { + options: { + type: "string", + }, + }, +}); + +const options = JSON.parse(args.values.options); + +/** @type {import("vite").InlineConfig} */ +const config = { + plugins: [plugin(options)], + clearScreen: false, +}; + +const command = args.positionals[0]; +if (!command) { + throw new Error("Command is missing"); +} + +if (command === "dev") { + const server = await createServer(config); + + await server.listen(); + + console.log( + stringifyPayload({ + url: server.resolvedUrls.local[0], + }) + ); + + server.openBrowser(); +} else if (command === "build") { + const resolvedConfig = await resolveConfig(config); + console.log( + stringifyPayload({ + outDir: resolvedConfig.build.outDir, + }) + ); + console.log("build start"); + await build(config); + console.log("build finished"); +} else { + throw new Error(`Unknown command: ${command}`); +} diff --git a/vite/vite-plugin.mjs b/vite/vite-plugin.mjs new file mode 100644 index 00000000..f7fd02d3 --- /dev/null +++ b/vite/vite-plugin.mjs @@ -0,0 +1,75 @@ +import { mkdir, writeFile } from "node:fs/promises"; +import { dirname } from "node:path"; + +const PLUGIN_NAME = "@winglibs/vite"; + +/** + * @return {import("vite").Plugin} + */ +export const plugin = (options) => { + /** + * @type {{ + * root?: string; + * }} + */ + const context = {}; + return { + name: PLUGIN_NAME, + configResolved(config) { + context.root = config.root; + }, + transformIndexHtml(html) { + return html.replace( + "", + `\n ` + ); + }, + async buildStart() { + if (!options.generateTypeDefinitions) { + return; + } + + if (!context.root) { + throw new Error("[root] is missing"); + } + + const root = `file://${context.root}/`; + + this.info("Generating type definitions..."); + let dts = [ + `// Generated by \`${PLUGIN_NAME}\`. Do not edit.`, + `/** Holds environment variables generated from Wing. */`, + "interface WingEnv {", + ]; + try { + for (const [key, value] of Object.entries(options.publicEnv)) { + const type = typeof value === "string" ? "string" : "unknown"; + dts.push(`\treadonly ${key}: ${type};`); + } + } catch (error) { + this.error( + error instanceof Error + ? error + : new Error("Unknown error", { cause: error }) + ); + } + dts.push( + "}", + "interface Wing { env: WingEnv; }", + `declare var ${options.publicEnvName}: Wing;`, + "interface Window {", + `\treadonly ${options.publicEnvName}: Wing;`, + "}", + "" + ); + + const dtsFilename = new URL(options.typeDefinitionsFilename, root); + await mkdir(dirname(dtsFilename.pathname), { recursive: true }); + await writeFile(dtsFilename, dts.join("\n")); + }, + }; +}; diff --git a/vite/vite-types.w b/vite/vite-types.w new file mode 100644 index 00000000..6c4e61c6 --- /dev/null +++ b/vite/vite-types.w @@ -0,0 +1,29 @@ +pub struct ViteProps { + /** + * The root directory of the Vite project. + */ + root: str; + + /** + * The variables that will be passed to the browser. + */ + publicEnv: Map?; + + /** + * Whether to generate type definitions or not. + */ + generateTypeDefinitions: bool?; + + /** + * The name of the browser variable that will be used to + * access environment variables passed from the wing program. + * + * @default `wing` + */ + publicEnvName: str?; + + /** + * The name of the file that will be used to generate type definitions. + */ + typeDefinitionsFilename: str?; +} diff --git a/vite/vite.cjs b/vite/vite.cjs new file mode 100644 index 00000000..e484b26f --- /dev/null +++ b/vite/vite.cjs @@ -0,0 +1,51 @@ +const { spawnSync, spawn } = require("node:child_process"); +const { parsePayload } = require("./util.cjs"); + +exports.cliFilename = () => `${__dirname}/vite-cli.mjs`; + +exports.build = (options) => { + const args = [ + options.cliFilename, + "build", + "--options", + JSON.stringify(options), + ]; + + const buffer = spawnSync("node", args, { + cwd: options.root, + env: { + HOME: options.homeEnv, + PATH: options.pathEnv, + }, + }); + const output = buffer.stdout.toString().split("\n"); + console.log(output.slice(1).join("\n")); + return parsePayload(output[0]).outDir; +}; + +exports.dev = async (options) => { + const args = [ + options.cliFilename, + "dev", + "--options", + JSON.stringify(options), + ]; + + const child = spawn("node", args, { + cwd: options.root, + env: { + HOME: options.homeEnv, + PATH: options.pathEnv, + }, + }); + + return new Promise((resolve) => { + child.stdout.on("data", (chunk) => { + const payload = parsePayload(chunk.toString()); + if (payload) { + resolve(payload.url); + child.stdout.removeAllListeners("data"); + } + }); + }); +}; diff --git a/vite/vite.sim.w b/vite/vite.sim.w new file mode 100644 index 00000000..b8bd94bb --- /dev/null +++ b/vite/vite.sim.w @@ -0,0 +1,35 @@ +bring cloud; +bring sim; +bring util; +bring fs; +bring "./vite-types.w" as vite_types; + +pub class Vite_sim { + pub url: str; + + new(props: vite_types.ViteProps) { + let state = new sim.State(); + this.url = state.token("url"); + + let cliFilename = Vite_sim.cliFilename(); + let homeEnv = util.env("HOME"); + let pathEnv = util.env("PATH"); + + new cloud.Service(inflight () => { + let url = Vite_sim.dev({ + root: props.root, + publicEnv: props.publicEnv ?? {}, + generateTypeDefinitions: props.generateTypeDefinitions ?? true, + publicEnvName: props.publicEnvName ?? "wing", + typeDefinitionsFilename: props.typeDefinitionsFilename ?? ".winglibs/wing-env.d.ts", + cliFilename: cliFilename, + homeEnv: homeEnv, + pathEnv: pathEnv, + }); + state.set("url", url); + }); + } + + extern "./vite.cjs" static cliFilename(): str; + extern "./vite.cjs" static inflight dev(options: Json): str; +} diff --git a/vite/vite.test.w b/vite/vite.test.w new file mode 100644 index 00000000..a4097628 --- /dev/null +++ b/vite/vite.test.w @@ -0,0 +1,33 @@ +bring cloud; +bring expect; +bring util; +bring fs; +bring "./vite.w" as vite; + +test "noop" { + assert(true); +} + +if util.env("WING_TARGET") == "tf-aws" { + let api = new cloud.Api(); + + let website = new vite.Vite( + root: "./example", + publicEnv: { + HELLO: "world", + API_URL: api.url, + }, + ); + + test "build() generates an index.html file" { + expect.equal(fs.exists("./example/dist/index.html"), true); + } + + test "build() exposes environment variables to the index.html file" { + let html = fs.readFile("./example/dist/index.html"); + expect.equal(html.contains(Json.stringify({ + HELLO: "world", + API_URL: api.url, + })), true); + } +} diff --git a/vite/vite.tf-aws.w b/vite/vite.tf-aws.w new file mode 100644 index 00000000..aeb71087 --- /dev/null +++ b/vite/vite.tf-aws.w @@ -0,0 +1,183 @@ +bring cloud; +bring util; +bring fs; +bring "cdktf" as cdktf; +bring "@cdktf/provider-aws" as aws; +bring "./vite-types.w" as vite_types; + +class Util { + extern "./util.cjs" pub static contentType(filename: str): str; + pub static listAllFiles(directory: str, handler: (str): void, cwd: str?): void { + let files = fs.readdir(directory); + let cwdLength = (cwd ?? directory).length + 1; + for file in files { + let path = "{directory}/{file}"; + if (fs.isDir(path)) { + Util.listAllFiles(path, handler, cwd ?? directory); + } else { + handler(path.substring(cwdLength)); + } + } + } +} + +pub class Vite_tf_aws { + pub url: str; + + new(props: vite_types.ViteProps) { + let cliFilename = Vite_tf_aws.cliFilename(); + let homeEnv = util.env("HOME"); + let pathEnv = util.env("PATH"); + let outDir = Vite_tf_aws.build({ + root: props.root, + publicEnv: props.publicEnv ?? {}, + generateTypeDefinitions: props.generateTypeDefinitions ?? true, + publicEnvName: props.publicEnvName ?? "wing", + typeDefinitionsFilename: props.typeDefinitionsFilename ?? ".winglibs/wing-env.d.ts", + cliFilename: cliFilename, + homeEnv: homeEnv, + pathEnv: pathEnv, + }); + let distDir = "{props.root}/{outDir}"; + + let bucket = new cloud.Bucket(); + + let terraformBucket: aws.s3Bucket.S3Bucket = unsafeCast(bucket.node.defaultChild); + Util.listAllFiles(distDir, (file) => { + let key = "/{file}"; + let filename = fs.absolute("{distDir}/{file}"); + let var cacheControl = "public, max-age={1m.seconds}"; + if key.startsWith("/assets/") { + cacheControl = "public, max-age={1y.seconds}"; + } + if file == "index.html" { + new aws.s3Object.S3Object( + dependsOn: [terraformBucket], + key: key, + bucket: terraformBucket.bucket, + content: fs.readFile(filename), + contentType: Util.contentType(filename), + cacheControl: cacheControl, + ) as "File{key.replace("/", "--")}"; + } else { + new aws.s3Object.S3Object( + dependsOn: [terraformBucket], + key: key, + bucket: terraformBucket.bucket, + source: filename, + sourceHash: cdktf.Fn.md5(filename), + contentType: Util.contentType(filename), + cacheControl: cacheControl, + ) as "File{key.replace("/", "--")}"; + } + }); + + new aws.s3BucketWebsiteConfiguration.S3BucketWebsiteConfiguration( + bucket: terraformBucket.bucket, + indexDocument: { + suffix: "index.html", + }, + errorDocument: { + key: "index.html", + }, + ); + + let originAccessControl = new aws.cloudfrontOriginAccessControl.CloudfrontOriginAccessControl( + name: "{this.node.path.substring(0, 64 - 4)}-oac", + originAccessControlOriginType: "s3", + signingBehavior: "always", + signingProtocol: "sigv4", + ); + + let distribution = new aws.cloudfrontDistribution.CloudfrontDistribution( + enabled: true, + defaultRootObject: "index.html", + customErrorResponse: [ + { + errorCode: 403, + responseCode: 200, + responsePagePath: "/index.html", + }, + { + errorCode: 404, + responseCode: 200, + responsePagePath: "/index.html", + }, + ], + origin: [ + { + domainName: terraformBucket.bucketRegionalDomainName, + originId: "s3Origin", + originAccessControlId: originAccessControl.id, + }, + ], + defaultCacheBehavior: { + allowedMethods: ["GET", "HEAD"], + cachedMethods: ["GET", "HEAD"], + targetOriginId: "s3Origin", + forwardedValues: { + queryString: false, + cookies: { forward: "none" }, + }, + viewerProtocolPolicy: "redirect-to-https", + compress: true, + minTtl: 5m.seconds, + defaultTtl: 5m.seconds, + maxTtl: 1y.seconds, + }, + priceClass: "PriceClass_100", + restrictions: { + geoRestriction: { + restrictionType: "none", + }, + }, + viewerCertificate: { + cloudfrontDefaultCertificate: true, + }, + orderedCacheBehavior: [ + { + pathPattern: "/assets/*", + allowedMethods: ["GET", "HEAD"], + cachedMethods: ["GET", "HEAD"], + targetOriginId: "s3Origin", + // See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-caching-optimized. + cachePolicyId: "658327ea-f89d-4fab-a63d-7e88639e58f6", + compress: true, + viewerProtocolPolicy: "redirect-to-https", + }, + ], + ); + + let allowDistributionReadOnly = new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument( + statement: [ + { + actions: ["s3:GetObject"], + condition: [ + { + test: "StringEquals", + values: [distribution.arn], + variable: "AWS:SourceArn", + }, + ], + principals: [ + { + identifiers: ["cloudfront.amazonaws.com"], + type: "Service", + }, + ], + resources: ["{terraformBucket.arn}/*"], + }, + ], + ); + + new aws.s3BucketPolicy.S3BucketPolicy({ + bucket: terraformBucket.id, + policy: allowDistributionReadOnly.json, + }); + + this.url = "https://{distribution.domainName}"; + } + + extern "./vite.cjs" static cliFilename(): str; + extern "./vite.cjs" static build(options: Json): str; +} diff --git a/vite/vite.w b/vite/vite.w new file mode 100644 index 00000000..6fe41071 --- /dev/null +++ b/vite/vite.w @@ -0,0 +1,24 @@ +bring cloud; +bring sim; +bring util; +bring fs; +bring "./vite-types.w" as vite_types; +bring "./vite.sim.w" as vite_sim; +bring "./vite.tf-aws.w" as vite_tf_aws; + +pub class Vite { + pub url: str; + + new(props: vite_types.ViteProps) { + let target = util.env("WING_TARGET"); + if target == "sim" { + let implementation = new vite_sim.Vite_sim(props); + this.url = implementation.url; + } elif target == "tf-aws" { + let implementation = new vite_tf_aws.Vite_tf_aws(props); + this.url = implementation.url; + } else { + throw "Unsupported WING_TARGET ${target}"; + } + } +} From 3b387399a01860b22ebc44792cbb3c527006d285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 10:04:29 +0100 Subject: [PATCH 09/14] fix(vite): add description to `package.json` (#85) --- vite/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vite/package.json b/vite/package.json index 6c9156b9..d2a677cd 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,7 @@ { "name": "@winglibs/vite", "version": "0.0.1", + "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", "url": "https://github.com/winglang/winglibs.git", From 12ad576830c1c1ff6b948726f45ddf65ddcd08d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 10:06:44 +0100 Subject: [PATCH 10/14] fix(vite): add author to `package.json` (#86) * fix(vite): add description to `package.json` * fix(vite): add author to `package.json` --- vite/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vite/package.json b/vite/package.json index d2a677cd..03e2e28c 100644 --- a/vite/package.json +++ b/vite/package.json @@ -7,6 +7,10 @@ "url": "https://github.com/winglang/winglibs.git", "directory": "vite" }, + "author": { + "name": "Cristian Pallarés", + "email": "cristianp@wing.cloud" + }, "license": "MIT", "dependencies": { "@cdktf/provider-aws": "^19.6.0", From 6bffa0608b9ab0232185fbb724a2d6658fd14ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 10:15:02 +0100 Subject: [PATCH 11/14] fix(vite): add missing `.cjs` and `.mjs` files to the package tarball (#87) --- vite/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vite/package.json b/vite/package.json index 03e2e28c..73d99134 100644 --- a/vite/package.json +++ b/vite/package.json @@ -12,6 +12,11 @@ "email": "cristianp@wing.cloud" }, "license": "MIT", + "files": [ + "./*.cjs", + "./*.mjs", + "./*.w" + ], "dependencies": { "@cdktf/provider-aws": "^19.6.0", "cdktf": "^0.20.3", From 41bf35e51471ad759f18256f2330f86c7d97b020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 10:16:09 +0100 Subject: [PATCH 12/14] chore(vite): increase package version (#88) --- vite/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite/package.json b/vite/package.json index 73d99134..353e9aa6 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/vite", - "version": "0.0.1", + "version": "0.0.2", "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", From 6fd317da3177a5e2912ea5dec45246c41416c05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 10:35:50 +0100 Subject: [PATCH 13/14] fix(vite): html transformation (#89) * fix(vite): html transformation * fix(vite): html transformation In some cases, such as adding a class to the `` element in the `index.html`, would cause the Vite resource not being able to generate the `wing` environment object. Also, stop opening the browser when Wing is running tests. --- vite/package.json | 2 +- vite/vite-cli.mjs | 4 +++- vite/vite-plugin.mjs | 8 ++++---- vite/vite.sim.w | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vite/package.json b/vite/package.json index 353e9aa6..47285cd5 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/vite", - "version": "0.0.2", + "version": "0.0.3", "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", diff --git a/vite/vite-cli.mjs b/vite/vite-cli.mjs index ee1c5b89..c68cc7cf 100644 --- a/vite/vite-cli.mjs +++ b/vite/vite-cli.mjs @@ -37,7 +37,9 @@ if (command === "dev") { }) ); - server.openBrowser(); + if (options.openBrowser) { + server.openBrowser(); + } } else if (command === "build") { const resolvedConfig = await resolveConfig(config); console.log( diff --git a/vite/vite-plugin.mjs b/vite/vite-plugin.mjs index f7fd02d3..2a8e0d29 100644 --- a/vite/vite-plugin.mjs +++ b/vite/vite-plugin.mjs @@ -20,12 +20,12 @@ export const plugin = (options) => { }, transformIndexHtml(html) { return html.replace( - "", - `\n ` + )})});\n` ); }, async buildStart() { diff --git a/vite/vite.sim.w b/vite/vite.sim.w index b8bd94bb..83a5e0f1 100644 --- a/vite/vite.sim.w +++ b/vite/vite.sim.w @@ -14,6 +14,7 @@ pub class Vite_sim { let cliFilename = Vite_sim.cliFilename(); let homeEnv = util.env("HOME"); let pathEnv = util.env("PATH"); + let openBrowser = util.env("WING_IS_TEST") != "true"; new cloud.Service(inflight () => { let url = Vite_sim.dev({ @@ -25,6 +26,7 @@ pub class Vite_sim { cliFilename: cliFilename, homeEnv: homeEnv, pathEnv: pathEnv, + openBrowser: openBrowser, }); state.set("url", url); }); From 9217b9ac616b5613258dfe6265d9e5acf21f58be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 19 Feb 2024 13:38:54 +0100 Subject: [PATCH 14/14] fix(vite): production build uses development variables (#91) * fix(vite): production build uses development variables Vite bundles for production when `NODE_ENV=production`, which makes variables like `import.meta.env.DEV` equal to `true` even for production environments. * fix package version --- vite/package.json | 2 +- vite/vite.cjs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/vite/package.json b/vite/package.json index 47285cd5..67fa9945 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/vite", - "version": "0.0.3", + "version": "0.0.4", "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", diff --git a/vite/vite.cjs b/vite/vite.cjs index e484b26f..fdb041e7 100644 --- a/vite/vite.cjs +++ b/vite/vite.cjs @@ -16,6 +16,7 @@ exports.build = (options) => { env: { HOME: options.homeEnv, PATH: options.pathEnv, + NODE_ENV: "production", }, }); const output = buffer.stdout.toString().split("\n");