Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -1,13 +0,0 @@
|
||||||
name: Build/Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- develop-*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
|
||||||
secrets: inherit
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"preset": [
|
|
||||||
"@lumeweb/node-library-preset"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
templates/vite.config.js
|
|
235
CHANGELOG.md
235
CHANGELOG.md
|
@ -1,235 +0,0 @@
|
||||||
# [0.1.0-develop.44](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.43...v0.1.0-develop.44) (2023-07-29)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add define alias for window to globalThis ([a6251ae](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a6251ae4ea74498cf7709d31c64e9214831609af))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add support for vite define ([ae2b679](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/ae2b6797008d3defdfac6d1e5444cd9df0f68aa2))
|
|
||||||
|
|
||||||
# [0.1.0-develop.43](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.42...v0.1.0-develop.43) (2023-07-12)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* dont symlink vite.config.js ([850a235](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/850a2351b5f0d4dfd5ca700d0a9a36c64883f766))
|
|
||||||
|
|
||||||
# [0.1.0-develop.42](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.41...v0.1.0-develop.42) (2023-07-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* force inlineDynamicImports ([d594632](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/d5946321d08a5ab81539427db6d91f20f0bce1ed))
|
|
||||||
|
|
||||||
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-07-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* update node-fetch dummy export to include Response, FormData and Blob ([a53e888](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a53e8885b4fa04bdd1ab2053433b5b15dbc57076))
|
|
||||||
|
|
||||||
# [0.1.0-develop.40](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.39...v0.1.0-develop.40) (2023-07-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add .prettierignore template ([c73dff7](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/c73dff73267f39ca4624283bdb10c8718c0082cc))
|
|
||||||
|
|
||||||
# [0.1.0-develop.39](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.38...v0.1.0-develop.39) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add buffer as a dep and ensure it is pinned ([f4e12d7](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/f4e12d7695e9fe792014092aed1e39a5adfeadac))
|
|
||||||
|
|
||||||
# [0.1.0-develop.38](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.37...v0.1.0-develop.38) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* always dedupe primary sdk libraries ([4e9c506](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/4e9c506490744f9047d183dc7cad144fe6612a44))
|
|
||||||
|
|
||||||
# [0.1.0-develop.37](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.36...v0.1.0-develop.37) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* always exclude node fetch from bundles ([27c52db](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/27c52db1676c1b15d054578584d320a7c8ad0e5b))
|
|
||||||
|
|
||||||
# [0.1.0-develop.36](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.35...v0.1.0-develop.36) (2023-07-08)
|
|
||||||
|
|
||||||
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add wasm plugin ([5a72c3c](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/5a72c3c946e6ab1a53a0d1f7c3681dc3d8054de3))
|
|
||||||
|
|
||||||
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* override tsconfig.build ([2883344](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/28833448f29e7cbde5cbea3e241ff669134530a8))
|
|
||||||
|
|
||||||
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* path import not needed ([81b9332](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/81b9332cacdc57dedfcd6defcf67c2aa0b60b76f))
|
|
||||||
|
|
||||||
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add templates to npm, and move out of src ([edbcf1c](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/edbcf1ce32269b22877f94899e19fdfc3db060db))
|
|
||||||
|
|
||||||
# [0.1.0-develop.31](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.30...v0.1.0-develop.31) (2023-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add default polyfill config ([f6ba49c](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/f6ba49c45f8516779a15f89b11207081c913c44d))
|
|
||||||
|
|
||||||
# [0.1.0-develop.30](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.29...v0.1.0-develop.30) (2023-07-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* change node-resolve config to assume it is an object entry since we rewrite it in the rollup plugin in browser mode ([398be8f](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/398be8fede84167282c3252ab24e6149bf095f32))
|
|
||||||
* passing browser mode does not work here ([40580f7](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/40580f793f7c4b94f37cf62961bd062b4bb24c55))
|
|
||||||
|
|
||||||
# [0.1.0-develop.29](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.28...v0.1.0-develop.29) (2023-07-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add libkernel, libweb, and libportal to node resolve de-dup explicitly to prevent import problems ([0fb8d6c](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/0fb8d6c73b0567af8856ff2b7f196a57001c5071))
|
|
||||||
|
|
||||||
# [0.1.0-develop.28](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.27...v0.1.0-develop.28) (2023-07-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.27](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.26...v0.1.0-develop.27) (2023-07-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.26](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.25...v0.1.0-develop.26) (2023-07-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.25](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.24...v0.1.0-develop.25) (2023-07-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.24](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.23...v0.1.0-develop.24) (2023-07-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* pass browser to supplementaryConfig ([398bee7](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/398bee7e03284720e62f3550e1ff72d67ab12c0d))
|
|
||||||
|
|
||||||
# [0.1.0-develop.23](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.22...v0.1.0-develop.23) (2023-07-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* ensure plugin-node-resolve uses browser mode ([3b6fec0](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/3b6fec053f4c0d69426c3fde8eb680ea4edc4a50))
|
|
||||||
|
|
||||||
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-07-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* set inlineDynamicImports to true ([a58775a](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a58775aefdd1b7ba5c06b01ee919e3f7ac9f1f90))
|
|
||||||
|
|
||||||
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-07-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-06-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* publish needs to be npmPublish ([a2f2ee9](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a2f2ee991367c5f0c27b143f01bc15ebd365d7d6))
|
|
||||||
|
|
||||||
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-06-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add override for releaserc to disable npm publishing ([a5cf685](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a5cf68538d3eb786581f8db1f5bcad731721c56d))
|
|
||||||
|
|
||||||
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-06-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Reverts
|
|
||||||
|
|
||||||
* Revert "fix: re-order extends" ([dab120c](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/dab120cd2f6928732370a3b23e833a8a1ca06e63))
|
|
||||||
|
|
||||||
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-06-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* re-order extends ([b6f8e36](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/b6f8e3683621cca1fad3158ddd706896a162337b))
|
|
||||||
|
|
||||||
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-06-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* fix plugins list ([21b414b](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/21b414b25bd3988975ab32963be64ffbd3d2a5fc))
|
|
||||||
|
|
||||||
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-06-30)
|
|
||||||
|
|
||||||
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-06-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-06-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-06-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-06-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add presetter-preset-strict as dep ([7d6eb89](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/7d6eb8964ed336ba143cd5f7892df41ae2061d3a))
|
|
||||||
|
|
||||||
|
|
||||||
### Reverts
|
|
||||||
|
|
||||||
* Revert "fix: add presetter-preset-rollup and presetter-preset-strict as peer deps" ([c6b4c4e](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/c6b4c4e2d739b7ec69bb6943db936d9caeea362d))
|
|
||||||
|
|
||||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add presetter-preset-rollup and presetter-preset-strict as peer deps ([4894c5d](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/4894c5d3d33b94d41d537751f65349dc81cfd883))
|
|
||||||
|
|
||||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/compare/v0.0.1...v0.1.0-develop.1) (2023-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add .presetterrc.json ([a4f3331](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/a4f3331a2163180218e5024dcad6b863ee4ae64f))
|
|
||||||
* add npm-shrinkwrap.json ([82281b8](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/82281b8ce8b323ac9bf2afc235ae855e20cb64c2))
|
|
||||||
* add repository to package.json ([c8d2f77](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/c8d2f77cf70b3e5f28b87966614ce49be7174562))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* initial version ([64ba208](https://git.lumeweb.com/LumeWeb/presetter-kernel-module-preset/commit/64ba20821f3b0dab50fc48fd95b3254ece888b36))
|
|
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@lumeweb/presetter-kernel-module-preset",
|
|
||||||
"version": "0.1.0-develop.44",
|
|
||||||
"type": "module",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "gitea@git.lumeweb.com:LumeWeb/presetter-kernel-module-preset.git"
|
|
||||||
},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "presetter bootstrap",
|
|
||||||
"build": "run build",
|
|
||||||
"semantic-release": "semantic-release"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@lumeweb/node-library-preset": "0.2.7",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"presetter": "^4.0.1",
|
|
||||||
"vite": "^4.4.2",
|
|
||||||
"vite-plugin-node-polyfills": "^0.9.0",
|
|
||||||
"vite-plugin-optimizer": "^1.4.2"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"templates"
|
|
||||||
],
|
|
||||||
"overrides": {
|
|
||||||
"buffer": "^6.0.3"
|
|
||||||
}
|
|
||||||
}
|
|
130
src/index.ts
130
src/index.ts
|
@ -1,130 +0,0 @@
|
||||||
import type { PresetAsset } from "presetter-types";
|
|
||||||
import { PresetContext } from "presetter-types";
|
|
||||||
|
|
||||||
import { dirname, resolve } from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
|
|
||||||
import { loadFile, resolveDirective, template } from "presetter";
|
|
||||||
|
|
||||||
const DIR = fileURLToPath(dirname(import.meta.url));
|
|
||||||
|
|
||||||
// paths to the template directory
|
|
||||||
const TEMPLATES = resolve(DIR, "..", "templates");
|
|
||||||
|
|
||||||
/** List of configurable variables */
|
|
||||||
export type Variable = {
|
|
||||||
/** the directory containing all source code (default: source) */
|
|
||||||
source: string;
|
|
||||||
/** the directory containing all the compiled files (default: lib) */
|
|
||||||
output: string;
|
|
||||||
buildSource: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DEFAULT_VARIABLE: Variable = {
|
|
||||||
source: "build",
|
|
||||||
output: "lib",
|
|
||||||
buildSource: "src",
|
|
||||||
};
|
|
||||||
|
|
||||||
function buildOptions(context: PresetContext) {
|
|
||||||
const opts = context.custom.config?.vite as any;
|
|
||||||
if (!opts) {
|
|
||||||
throw new Error("vite options missing!");
|
|
||||||
}
|
|
||||||
|
|
||||||
const define = opts.define;
|
|
||||||
const build = opts.build;
|
|
||||||
const resolve = opts.resolve;
|
|
||||||
const optimize = opts.optimize;
|
|
||||||
const polyfill = opts.polyfill;
|
|
||||||
|
|
||||||
return {
|
|
||||||
viteDefine: resolveDirective(define, context).stringifiedConfig,
|
|
||||||
viteBuild: resolveDirective(build, context).stringifiedConfig,
|
|
||||||
viteResolve: resolveDirective(resolve, context).stringifiedConfig,
|
|
||||||
viteOptimize: resolveDirective(optimize, context).stringifiedConfig,
|
|
||||||
vitePolyfill: resolveDirective(polyfill, context).stringifiedConfig,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the list of templates provided by this preset
|
|
||||||
* @returns list of preset templates
|
|
||||||
*/
|
|
||||||
export default async function (context: PresetContext): Promise<PresetAsset> {
|
|
||||||
const ignores = !context.custom.config?.official
|
|
||||||
? [".github/workflows/ci.yml"]
|
|
||||||
: [];
|
|
||||||
|
|
||||||
return {
|
|
||||||
extends: ["@lumeweb/node-library-preset"],
|
|
||||||
template: {
|
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
"vite.config.js": (context) => {
|
|
||||||
const content = loadFile(resolve(TEMPLATES, "vite.config.js"), "text");
|
|
||||||
const variable = buildOptions(context);
|
|
||||||
|
|
||||||
return template(content, variable);
|
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
},
|
|
||||||
".prettierignore": resolve(TEMPLATES, "prettierignore"),
|
|
||||||
},
|
|
||||||
supplementaryIgnores: ignores,
|
|
||||||
supplementaryConfig: {
|
|
||||||
"release": {
|
|
||||||
plugins: {
|
|
||||||
"3": ["@semantic-release/npm", { npmPublish: false }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"vite": {
|
|
||||||
define: {
|
|
||||||
"window.": "globalThis.",
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
outDir: "{output}",
|
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: "{source}/index.js",
|
|
||||||
name: "main",
|
|
||||||
formats: ["cjs"],
|
|
||||||
fileName: "index",
|
|
||||||
},
|
|
||||||
minify: false,
|
|
||||||
rollupOptions: {
|
|
||||||
output: {
|
|
||||||
inlineDynamicImports: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
dedupe: [
|
|
||||||
"@lumeweb/libportal",
|
|
||||||
"@lumeweb/libweb",
|
|
||||||
"@lumeweb/libkernel",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
optimize: {
|
|
||||||
"node-fetch":
|
|
||||||
"const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};",
|
|
||||||
},
|
|
||||||
polyfill: {
|
|
||||||
exclude: ["fs"],
|
|
||||||
globals: {
|
|
||||||
Buffer: true,
|
|
||||||
global: true,
|
|
||||||
process: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tsconfig.build": {
|
|
||||||
include: ["{buildSource}"],
|
|
||||||
compilerOptions: {
|
|
||||||
outDir: "{source}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
scripts: resolve(TEMPLATES, "scripts.yaml"),
|
|
||||||
variable: DEFAULT_VARIABLE,
|
|
||||||
noSymlinks: ["vite.config.js"],
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
lib
|
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
# replace the `prepare` template from presetter-preset
|
|
||||||
# so that the build procedure will not be triggered upon package installation
|
|
||||||
build: cross-env NODE_ENV=production run-s clean build:typescript:* build:vite
|
|
||||||
build:vite: vite build && mv lib/*.cjs lib/index.js
|
|
||||||
develop: cross-env NODE_ENV=development run-s "vite:rollup -- --watch {@}" --
|
|
||||||
clean:buildOutput: shx rm -rf {source}
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { defineConfig } from "vite";
|
|
||||||
import optimizer from "vite-plugin-optimizer";
|
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
||||||
export default defineConfig({
|
|
||||||
define: {viteDefine},
|
|
||||||
build: {viteBuild},
|
|
||||||
resolve: {viteResolve},
|
|
||||||
plugins: [
|
|
||||||
optimizer({viteOptimize}),
|
|
||||||
nodePolyfills({vitePolyfill}),
|
|
||||||
],
|
|
||||||
});
|
|
Loading…
Reference in New Issue