summaryrefslogtreecommitdiff
path: root/.config/coc/extensions/node_modules/coc-html/esbuild.js
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@simplelittledream.com>2022-07-16 18:13:16 -0400
committerJacob McDonnell <jacob@simplelittledream.com>2022-07-16 18:13:16 -0400
commit8fad9a5ecddc88d57a531e4b0084544984f23d25 (patch)
tree84954bc8219942aa56bc899330ccd0007bbe0ef0 /.config/coc/extensions/node_modules/coc-html/esbuild.js
parent2887af7fcfb4d618dd13cf66ec2fbdbd84c7527c (diff)
Added profile and other missing configs
Diffstat (limited to '.config/coc/extensions/node_modules/coc-html/esbuild.js')
-rw-r--r--.config/coc/extensions/node_modules/coc-html/esbuild.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/.config/coc/extensions/node_modules/coc-html/esbuild.js b/.config/coc/extensions/node_modules/coc-html/esbuild.js
new file mode 100644
index 0000000..bf2f6cb
--- /dev/null
+++ b/.config/coc/extensions/node_modules/coc-html/esbuild.js
@@ -0,0 +1,50 @@
+const path = require('path')
+
+let entryPlugin = {
+ name: 'entry',
+ setup(build) {
+ build.onResolve({filter: /^(index|server)\.ts$/}, args => {
+ return {
+ path: args.path,
+ namespace: 'entry-ns'
+ }
+ })
+ build.onLoad({filter: /.*/, namespace: 'entry-ns'}, args => {
+ let contents = ''
+ if (args.path == 'index.ts') {
+ contents = `
+ import {activate} from './src/index'
+ export {activate}
+ `
+ } else if (args.path == 'server.ts') {
+ contents = `require('./server/node/htmlServerMain.ts')`
+ } else {
+ throw new Error('Bad path')
+ }
+ return {
+ contents,
+ resolveDir: __dirname
+ }
+ })
+ }
+}
+
+async function start() {
+ await require('esbuild').build({
+ entryPoints: ['index.ts', 'server.ts'],
+ define: {'process.env.NODE_ENV': JSON.stringify("production")},
+ bundle: true,
+ platform: 'node',
+ target: 'node12.16',
+ mainFields: ['module', 'main'],
+ minify: true,
+ sourcemap: true,
+ external: ['coc.nvim', 'typescript'],
+ outdir: path.resolve(__dirname, 'lib'),
+ plugins: [entryPlugin]
+ })
+}
+
+start().catch(e => {
+ console.error(e)
+})