copy plugin sources

This commit is contained in:
Jonas Kruckenberg
2022-12-14 18:43:39 +01:00
parent c15990d4e2
commit eb3495fb72
145 changed files with 16069 additions and 22 deletions
+51
View File
@@ -0,0 +1,51 @@
import { builtinModules } from "module";
import typescript from "@rollup/plugin-typescript";
import resolve from "@rollup/plugin-node-resolve";
// import terser from "@rollup/plugin-terser";
/**
* Create a base rollup config
* @param {Record<string,any>} pkg Imported package.json
* @param {string[]} external Imported package.json
* @returns {import('rollup').RollupOptions}
*/
export function createConfig({ pkg, external = [] }) {
return [
{
input: "index.ts",
external: Object.keys(pkg.dependencies || {})
.concat(Object.keys(pkg.peerDependencies || {}))
.concat(builtinModules)
.concat(external),
onwarn: (warning) => {
throw Object.assign(new Error(), warning);
},
strictDeprecations: true,
output: {
file: pkg.module,
format: "es",
sourcemap: true,
},
plugins: [typescript({ sourceMap: true })],
},
{
input: "index.ts",
onwarn: (warning) => {
throw Object.assign(new Error(), warning);
},
strictDeprecations: true,
output: {
file: pkg.browser,
format: "es",
sourcemap: true,
entryFileNames: "[name].min.js",
},
plugins: [
resolve(),
// terser(),
typescript({ sourceMap: true }),
],
},
];
}
+15
View File
@@ -0,0 +1,15 @@
[package]
name = "tauri-plugin-{{name}}"
version = "0.1.0"
edition.workspace = true
authors.workspace = true
license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde.workspace = true
serde_json.workspace = true
tauri.workspace = true
log.workspace = true
thiserror.workspace = true
View File
+29
View File
@@ -0,0 +1,29 @@
{
"name": "tauri-plugin-{{name}}-api",
"version": "0.0.0",
"license": "MIT or APACHE-2.0",
"type": "module",
"browser": "dist/index.min.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"browser": "./dist/index.min.js"
},
"scripts": {
"build": "rollup -c"
},
"files": [
"dist",
"!dist/**/*.map",
"README.md",
"LICENSE"
],
"devDependencies": {
"tslib": "^2.4.1"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0"
}
}
@@ -0,0 +1,10 @@
import { readFileSync } from "fs";
import { createConfig } from "../../../shared/rollup.config.mjs";
export default createConfig({
pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8")
),
external: [/^@tauri-apps\/api/],
});
+1
View File
@@ -0,0 +1 @@
../../../shared/tsconfig.json
View File
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"include": ["*.ts", "types/**/*"]
}