Skip to content

Commit 314653c

Browse files
committed
-
1 parent 5c3b4c9 commit 314653c

7 files changed

Lines changed: 657 additions & 9 deletions

File tree

build.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
import { existsSync, readdirSync, lstatSync, unlinkSync, rmdirSync, mkdirSync, closeSync, openSync, writeFileSync, copyFileSync, readFileSync } from "fs";
33
import { join } from "path";
4+
import esbuild from 'esbuild'
45

56
const __dirname = import.meta.dirname;
67

@@ -579,7 +580,23 @@ try {
579580
.replaceAll("//<-- SDK_VERSION -->", `sdk = "${sdk}"`)
580581
.replaceAll(/\/\* REMOVE START \*\/[\s\S]*?\/\* REMOVE END \*\//gmi, '')
581582

582-
writeFileSync(`./${exportDir}/c3runtime/plugin.js`, pluginWithPluginInfo);
583+
const pluginTranspiled = await esbuild.build({
584+
stdin: {
585+
contents: pluginWithPluginInfo,
586+
587+
// resolveDir: './src',
588+
loader: 'ts',
589+
},
590+
bundle: true,
591+
format: 'cjs',
592+
write: false,
593+
})
594+
595+
console.log('pluginTranspiled', pluginTranspiled)
596+
597+
const file = pluginTranspiled.outputFiles[0].text;
598+
599+
writeFileSync(`./${exportDir}/c3runtime/plugin.js`, file);
583600

584601
if (config.domSideScripts) {
585602
config.domSideScripts.forEach((script) => {

examples/example.c3p

2.69 KB
Binary file not shown.

mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ _.file = ".env"
66

77
[tasks.build]
88
run = "pnpm run build"
9+
depends = ["validate"]
910

1011
[tasks.validate]
1112
run = "pnpm run validate"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@types/node": "24.1.0",
3434
"c3ide2-types": "1.0.1",
3535
"electron": "35.0.3",
36+
"esbuild": "0.25.10",
3637
"lefthook": "1.11.3",
3738
"steamworks.js": "0.4.0",
3839
"typescript": "5.8.2"

pnpm-lock.yaml

Lines changed: 271 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)