move shim to new package

This commit is contained in:
Nystik
2026-05-20 20:49:28 +02:00
parent a0b44bde58
commit fe11f30c01
66 changed files with 46 additions and 23 deletions

View File

@@ -1,25 +1,9 @@
const esbuild = require("esbuild");
const path = require("path");
const { version: ignisVersion } = require("./package.json");
Promise.all([
// Build shim-loader.js
esbuild.build({
entryPoints: [path.join(__dirname, "src", "shims", "loader.js")],
bundle: true,
outfile: path.join(__dirname, "dist", "shim-loader.js"),
format: "iife",
platform: "browser",
target: ["chrome90"],
alias: {
path: "path-browserify",
},
define: {
__IGNIS_VERSION__: JSON.stringify(ignisVersion),
},
logLevel: "info",
}),
// Build shim-loader.js (delegated to packages/shim)
require("./packages/shim/build.js"),
// Build ignis-ui.js (delegated to packages/ui)
require("./packages/ui/build.js"),

13
package-lock.json generated
View File

@@ -574,7 +574,6 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.2.0.tgz",
"integrity": "sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 20.19.0"
@@ -2739,7 +2738,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
"integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==",
"dev": true,
"license": "MIT"
},
"node_modules/path-key": {
@@ -4444,7 +4442,16 @@
},
"packages/shim": {
"name": "@ignis/shim",
"version": "0.0.0-internal"
"version": "0.0.0-internal",
"dependencies": {
"@ignis/services": "*",
"@noble/hashes": "^2.2.0",
"pako": "^2.1.0",
"path-browserify": "^1.0.1"
},
"devDependencies": {
"esbuild": "^0.20.0"
}
},
"packages/ui": {
"name": "@ignis/ui",

20
packages/shim/build.js Normal file
View File

@@ -0,0 +1,20 @@
const esbuild = require("esbuild");
const path = require("path");
const { version: ignisVersion } = require("../../package.json");
module.exports = esbuild.build({
entryPoints: [path.join(__dirname, "src", "loader.js")],
bundle: true,
outfile: path.join(__dirname, "dist", "shim-loader.js"),
format: "iife",
platform: "browser",
target: ["chrome90"],
alias: {
path: "path-browserify",
},
define: {
__IGNIS_VERSION__: JSON.stringify(ignisVersion),
},
logLevel: "info",
});

View File

@@ -2,5 +2,17 @@
"name": "@ignis/shim",
"version": "0.0.0-internal",
"private": true,
"main": "src/loader.js"
"main": "src/loader.js",
"scripts": {
"build": "node build.js"
},
"dependencies": {
"@ignis/services": "*",
"@noble/hashes": "^2.2.0",
"pako": "^2.1.0",
"path-browserify": "^1.0.1"
},
"devDependencies": {
"esbuild": "^0.20.0"
}
}

View File

@@ -157,7 +157,7 @@ app.use((req, res, next) => {
});
app.use(express.static(path.join(__dirname, "..", "packages", "ui", "dist")));
app.use(express.static(path.join(__dirname, "..", "dist")));
app.use(express.static(path.join(__dirname, "..", "packages", "shim", "dist")));
app.use(express.static(config.obsidianAssetsPath));