refactor: Import version, bugs URL and repo URL directly from package.json (#1004)

This commit is contained in:
absidue
2025-09-11 20:49:48 +02:00
committed by GitHub
parent 95976de115
commit 46c2f6c6c1
14 changed files with 18 additions and 68 deletions

View File

@@ -18,15 +18,11 @@ import fs from 'fs/promises';
import CustomEvent from './polyfills/node-custom-event.js';
import { fileURLToPath } from 'url';
import evaluate from './jsruntime/jinter.js';
import { $INLINE_JSON } from 'ts-transformer-inline-file';
const meta_url = import.meta.url;
const is_cjs = !meta_url;
const __dirname__ = is_cjs ? __dirname : path.dirname(fileURLToPath(meta_url));
const { homepage, version, bugs } = $INLINE_JSON('../../package.json');
const repo_url = homepage?.split('#')[0];
class Cache implements ICache {
#persistent_directory: string;
#persistent: boolean;
@@ -100,11 +96,6 @@ class Cache implements ICache {
Platform.load({
runtime: 'node',
info: {
version: version,
bugs_url: bugs?.url || `${repo_url}/issues`,
repo_url
},
server: true,
Cache: Cache,
sha1Hash: async (data: string) => {