mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
update build to work in general
This commit is contained in:
parent
4a629be2e2
commit
ada31ccf90
8 changed files with 109 additions and 25 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react", // <-- Void added this
|
||||
"esModuleInterop": true,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
|
|
@ -50,6 +51,7 @@
|
|||
"./vs/workbench/contrib/issue/electron-sandbox/issueReporter.js",
|
||||
"./typings",
|
||||
"./vs/**/*.ts",
|
||||
"./vs/**/*.tsx", // <-- Void added this
|
||||
"vscode-dts/vscode.proposed.*.d.ts",
|
||||
"vscode-dts/vscode.d.ts"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
out/
|
||||
dist/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import { ViewPaneContainer } from '../../../../workbench/browser/parts/views/vie
|
|||
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
|
||||
import { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';
|
||||
|
||||
import * as React from './dist/openai.js'
|
||||
console.log('React', React)
|
||||
|
||||
const voidViewIcon = registerIcon('void-view-icon', Codicon.search, localize('voidViewIcon', 'View icon of the Void chat view.'));
|
||||
|
||||
|
|
|
|||
1
void-imports/.gitignore
vendored
Normal file
1
void-imports/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
to_be_built/
|
||||
|
|
@ -1,20 +1,48 @@
|
|||
import tsup from 'tsup'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
tsup.build({
|
||||
entry: [`void-imports.js`],
|
||||
format: ['esm'],
|
||||
sourcemap: false,
|
||||
bundle: true,
|
||||
clean: true,
|
||||
// minify: true, // no need to minify since it all gets bundled later
|
||||
outDir: '../src/vs/workbench/contrib/void/browser/out',
|
||||
dts: false,
|
||||
name: 'void-imports',
|
||||
noExternal: [/.*/], // This bundles everything
|
||||
platform: 'browser', // Important for browser compatibility
|
||||
target: 'es2020',
|
||||
// banner: {
|
||||
// js: '/* eslint-disable */'
|
||||
// }
|
||||
})
|
||||
const buildFiles = (imports, to_be_built_folder) => {
|
||||
// create a file with name importName that imports importName and immediately re-exports it
|
||||
for (const importName of imports) {
|
||||
const content = `\
|
||||
export { default } from '${importName}'
|
||||
export * from '${importName}'
|
||||
`
|
||||
const dir = path.dirname(importName);
|
||||
const file = path.basename(importName);
|
||||
|
||||
const fullPath = path.join(to_be_built_folder, dir, `${file}.ts`);
|
||||
|
||||
// Create all necessary directories before writing the file
|
||||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||||
fs.writeFileSync(fullPath, content, 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
const compileFiles = async (imports, to_be_built_folder, outDir) => {
|
||||
const fileEntries = imports.map((importName) => path.join(to_be_built_folder, `${importName}.ts`))
|
||||
await tsup.build({
|
||||
entry: fileEntries,
|
||||
format: ['esm'],
|
||||
sourcemap: false,
|
||||
bundle: true,
|
||||
clean: true,
|
||||
// minify: true, // no need to minify since it all gets bundled later
|
||||
outDir: path.join(outDir),
|
||||
dts: false,
|
||||
noExternal: [/.*/], // This bundles everything
|
||||
platform: 'browser', // Important for browser compatibility
|
||||
target: 'es2020',
|
||||
})
|
||||
}
|
||||
|
||||
const to_be_built_folder = 'to_be_built'
|
||||
fs.rmSync(to_be_built_folder, { recursive: true, force: true });
|
||||
|
||||
const imports = ['openai', '@anthropic-ai/sdk', 'react', 'react-dom']
|
||||
buildFiles(imports, to_be_built_folder)
|
||||
|
||||
const OUT_DIR = '../src/vs/workbench/contrib/void/browser/dist'
|
||||
compileFiles(imports, to_be_built_folder, OUT_DIR)
|
||||
|
||||
|
|
|
|||
56
void-imports/package-lock.json
generated
56
void-imports/package-lock.json
generated
|
|
@ -8,7 +8,9 @@
|
|||
"name": "void-imports",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^0.32.1",
|
||||
"openai": "^4.71.0"
|
||||
"openai": "^4.71.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "^8.3.5",
|
||||
|
|
@ -1230,6 +1232,12 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lilconfig": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz",
|
||||
|
|
@ -1267,6 +1275,18 @@
|
|||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"loose-envify": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
|
||||
|
|
@ -1531,6 +1551,31 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/react": {
|
||||
"version": "18.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dom": {
|
||||
"version": "18.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0",
|
||||
"scheduler": "^0.23.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz",
|
||||
|
|
@ -1593,6 +1638,15 @@
|
|||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/scheduler": {
|
||||
"version": "0.23.2",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
||||
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
"description": "",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^0.32.1",
|
||||
"openai": "^4.71.0"
|
||||
"openai": "^4.71.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "^8.3.5",
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
|
||||
export { default as openai } from 'openai'
|
||||
export { default as anthropicAiSdk } from '@anthropic-ai/sdk'
|
||||
|
||||
Loading…
Reference in a new issue