upgrade pkg
This commit is contained in:
parent
66c4289a0e
commit
b84b389ee2
|
|
@ -0,0 +1,9 @@
|
|||
import { apiContext } from "service-srv";
|
||||
|
||||
export const _ = {
|
||||
url: "/_flow",
|
||||
async api(opt: { action: "load"; page_id: string }) {
|
||||
const { req, res } = apiContext(this);
|
||||
return "This is flow.ts";
|
||||
},
|
||||
};
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
"@parcel/watcher": "^2.4.1",
|
||||
"@types/lodash.isequal": "^4.5.8",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"esbuild": "^0.21.5",
|
||||
"esbuild-clean-plugin": "^1.0.0",
|
||||
"del": "^7.1.0",
|
||||
"esbuild": "^0.23.1",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"mime-types": "^2.1.35",
|
||||
"msgpackr": "^1.10.0",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import style from "@hyrious/esbuild-plugin-style";
|
|||
import { $ } from "bun";
|
||||
import { dir } from "dir";
|
||||
import { context, formatMessages } from "esbuild";
|
||||
import { cleanPlugin } from "esbuild-clean-plugin";
|
||||
import { existsAsync } from "fs-jetpack";
|
||||
import { appendFile } from "node:fs/promises";
|
||||
import { conns } from "../../../entity/conn";
|
||||
|
|
@ -12,6 +11,7 @@ import { sendWS } from "../../../sync-handler";
|
|||
import { SyncType } from "../../../type";
|
||||
import { code } from "../../code";
|
||||
import { Watcher } from "../watcher";
|
||||
import { cleanPlugin } from "../../utlis/esbuild-clean-plugin";
|
||||
const pending = {} as any;
|
||||
|
||||
export const initFrontEnd = async (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,133 @@
|
|||
import { deleteSync } from "del";
|
||||
import type { BuildOptions, BuildResult, Plugin } from "esbuild";
|
||||
import path from "node:path";
|
||||
|
||||
export type PluginOptions = {
|
||||
dry?: boolean;
|
||||
initialCleanPatterns?: string[];
|
||||
verbose?: boolean;
|
||||
};
|
||||
|
||||
export class CleanPlugin {
|
||||
private previousAssets: string[] = [];
|
||||
|
||||
public constructor(
|
||||
private pluginOptions: PluginOptions,
|
||||
private buildOptions: BuildOptions
|
||||
) {
|
||||
this.pluginOptions = {
|
||||
dry: false,
|
||||
initialCleanPatterns: ["**/*"],
|
||||
verbose: false,
|
||||
...pluginOptions,
|
||||
};
|
||||
}
|
||||
|
||||
public handleBuild(result: BuildResult): void {
|
||||
const { outputs } = result.metafile ?? {};
|
||||
|
||||
if (!outputs) {
|
||||
return;
|
||||
}
|
||||
|
||||
const outputFiles = Object.keys(outputs);
|
||||
const removePatterns = this.previousAssets
|
||||
.filter((asset) => {
|
||||
return !outputFiles.includes(asset);
|
||||
})
|
||||
.map((asset) => {
|
||||
return path.basename(asset);
|
||||
});
|
||||
|
||||
this.previousAssets = outputFiles;
|
||||
|
||||
try {
|
||||
this.removeFiles(removePatterns);
|
||||
} catch (e) {
|
||||
const message = e instanceof Error ? e.message : "unknown error";
|
||||
|
||||
console.error(`esbuild-clean-plugin: ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
public initialClean(): void {
|
||||
const { initialCleanPatterns } = this.pluginOptions;
|
||||
|
||||
if (!initialCleanPatterns) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.removeFiles(initialCleanPatterns);
|
||||
}
|
||||
|
||||
protected removeFiles(patterns: string[]): void {
|
||||
const { outdir } = this.buildOptions;
|
||||
|
||||
if (!outdir) {
|
||||
return;
|
||||
}
|
||||
|
||||
const deletedFiles = deleteSync(patterns, {
|
||||
cwd: path.resolve(process.cwd(), outdir),
|
||||
dryRun: Boolean(this.pluginOptions.dry),
|
||||
});
|
||||
|
||||
this.printStats(deletedFiles);
|
||||
}
|
||||
|
||||
protected printStats(fileNames: string[]): void {
|
||||
const { dry, verbose } = this.pluginOptions;
|
||||
const { outdir } = this.buildOptions;
|
||||
|
||||
if (!verbose || !outdir) {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = dry ? "dry" : "removed";
|
||||
|
||||
fileNames.forEach((fileName) => {
|
||||
fileName = path.resolve(outdir, fileName);
|
||||
|
||||
console.log(`esbuild-clean-plugin: ${message} ${fileName}`);
|
||||
});
|
||||
}
|
||||
|
||||
public validateOptions(): boolean {
|
||||
const { metafile, outdir } = this.buildOptions;
|
||||
|
||||
if (!metafile) {
|
||||
console.warn(
|
||||
'esbuild-clean-plugin: The esbuild "metafile" option was not set, please set it to true. Stopping.'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outdir) {
|
||||
console.warn(
|
||||
'esbuild-clean-plugin: The esbuild "outdir" option was not set, please supply it. Stopping.'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export const cleanPlugin = (pluginOptions: PluginOptions = {}): Plugin => {
|
||||
return {
|
||||
name: "clean",
|
||||
setup(build): void {
|
||||
const plugin = new CleanPlugin(pluginOptions, build.initialOptions);
|
||||
|
||||
if (plugin.validateOptions()) {
|
||||
plugin.initialClean();
|
||||
|
||||
build.onEnd((result) => {
|
||||
plugin.handleBuild(result);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"brotli-wasm": "^3.0.1",
|
||||
"fdir": "^6.2.0",
|
||||
"fdir": "^6.3.0",
|
||||
"react-select": "^5.8.0",
|
||||
"typescript": "^5.5.4"
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"@types/unzipper": "^0.10.8",
|
||||
"acorn-walk": "^8.3.3",
|
||||
"brotli-wasm": "^3.0.1",
|
||||
"esbuild": "^0.21.5",
|
||||
"esbuild": "^0.23.1",
|
||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||
"execa": "^8.0.1",
|
||||
"fs-jetpack": "^5.1.0",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
services:
|
||||
code-server:
|
||||
image: lscr.io/linuxserver/code-server:latest
|
||||
container_name: code-server
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Etc/UTC
|
||||
- HASHED_PASSWORD= #optional
|
||||
- SUDO_PASSWORD=123 #optional
|
||||
- SUDO_PASSWORD_HASH= #optional
|
||||
- DEFAULT_WORKSPACE=/config/workspace #optional
|
||||
volumes:
|
||||
- /Users/riz/Documents/code-config:/config
|
||||
- /Users/riz/Developer/prasi-bun/data/code:/site
|
||||
ports:
|
||||
- 8443:8443
|
||||
restart: unless-stopped
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -192,7 +192,7 @@ const manifest = [
|
|||
"/y-pojo.d28b9ce4.js",
|
||||
"/vi.e93512ab.js"
|
||||
];
|
||||
const version = "eb699147";
|
||||
const version = "8f810dee";
|
||||
(0, _serviceWorker._register)(manifest, version);
|
||||
|
||||
},{"@parcel/service-worker":"et5Hi"}],"et5Hi":[function(require,module,exports) {
|
||||
|
|
@ -566,7 +566,7 @@ function _routerNodeToTable(initialPath, initialNode) {
|
|||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||
parcelHelpers.defineInteropFlag(exports);
|
||||
parcelHelpers.export(exports, "version", ()=>version);
|
||||
const version = "hgr6d4r";
|
||||
const version = "dxtxosl";
|
||||
|
||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"jpDjm"}],"lXNsG":[function(require,module,exports) {
|
||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||
|
|
|
|||
Loading…
Reference in New Issue