diff --git a/esbuild.config.mjs b/esbuild.config.mjs new file mode 100644 index 0000000..5d87383 --- /dev/null +++ b/esbuild.config.mjs @@ -0,0 +1,28 @@ +import esbuild from "esbuild"; +import process from "process"; +import builtins from 'builtin-modules' + +const banner = +`/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ +`; + +const prod = (process.argv[2] === 'production'); + +esbuild.build({ + banner: { + js: banner, + }, + entryPoints: ['main.ts'], + bundle: true, + external: ['obsidian', 'electron', ...builtins], + format: 'cjs', + watch: !prod, + target: 'es2016', + logLevel: "info", + sourcemap: prod ? false : 'inline', + treeShaking: true, + outfile: 'main.js', +}).catch(() => process.exit(1)); diff --git a/package.json b/package.json index e9d75e2..5c4a8fb 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { "name": "obsidian-pandoc-plugin", - "version": "0.1.0", + "version": "0.3.0", "description": "This is a Pandoc export plugin for Obsidian (https://obsidian.md)", "main": "main.js", "scripts": { - "dev": "rollup --config rollup.config.js -w", - "build": "rollup --config rollup.config.js --environment BUILD:production" + "dev": "node esbuild.config.mjs", + "build": "node esbuild.config.mjs production" }, "keywords": [], - "author": "Oliver Balfour", + "author": "Obsidian Community", "license": "MIT", "devDependencies": { - "@rollup/plugin-commonjs": "^15.1.0", - "@rollup/plugin-node-resolve": "^9.0.0", - "@rollup/plugin-typescript": "^6.0.0", - "@types/node": "^14.14.2", - "obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master", - "rollup": "^2.32.1", - "tslib": "^2.0.3", - "typescript": "^4.0.3" + "@types/node": "^16.11.6", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", + "builtin-modules": "^3.2.0", + "esbuild": "0.13.12", + "obsidian": "^0.12.17", + "tslib": "2.3.1", + "typescript": "4.4.4" }, "dependencies": { "@types/temp": "^0.9.0", diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index c4aa858..0000000 --- a/rollup.config.js +++ /dev/null @@ -1,30 +0,0 @@ -import typescript from '@rollup/plugin-typescript'; -import {nodeResolve} from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; - -const isProd = (process.env.BUILD === 'production'); - -const banner = -`/* -THIS IS A GENERATED/BUNDLED FILE BY ROLLUP -if you want to view the source visit the plugins github repository -*/ -`; - -export default { - input: 'main.ts', - output: { - dir: '.', - sourcemap: 'inline', - sourcemapExcludeSources: isProd, - format: 'cjs', - exports: 'default', - banner, - }, - external: ['obsidian'], - plugins: [ - typescript(), - nodeResolve({browser: true}), - commonjs(), - ] -}; \ No newline at end of file diff --git a/versions.json b/versions.json index 8d3bc92..096a0b3 100644 --- a/versions.json +++ b/versions.json @@ -8,5 +8,6 @@ "0.2.2": "0.12.5", "0.2.3": "0.12.5", "0.2.4": "0.12.5", - "0.2.5": "0.12.5" + "0.2.5": "0.12.5", + "0.3.0": "0.12.5", }