upgrade pkg

This commit is contained in:
Rizky 2024-09-10 06:01:31 +07:00
parent 66c4289a0e
commit b84b389ee2
12 changed files with 170 additions and 10 deletions

9
app/srv/api/flow.ts Normal file
View File

@ -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";
},
};

View File

@ -9,8 +9,8 @@
"@parcel/watcher": "^2.4.1", "@parcel/watcher": "^2.4.1",
"@types/lodash.isequal": "^4.5.8", "@types/lodash.isequal": "^4.5.8",
"@types/mime-types": "^2.1.4", "@types/mime-types": "^2.1.4",
"esbuild": "^0.21.5", "del": "^7.1.0",
"esbuild-clean-plugin": "^1.0.0", "esbuild": "^0.23.1",
"lodash.isequal": "^4.5.0", "lodash.isequal": "^4.5.0",
"mime-types": "^2.1.35", "mime-types": "^2.1.35",
"msgpackr": "^1.10.0", "msgpackr": "^1.10.0",

View File

@ -3,7 +3,6 @@ import style from "@hyrious/esbuild-plugin-style";
import { $ } from "bun"; import { $ } from "bun";
import { dir } from "dir"; import { dir } from "dir";
import { context, formatMessages } from "esbuild"; import { context, formatMessages } from "esbuild";
import { cleanPlugin } from "esbuild-clean-plugin";
import { existsAsync } from "fs-jetpack"; import { existsAsync } from "fs-jetpack";
import { appendFile } from "node:fs/promises"; import { appendFile } from "node:fs/promises";
import { conns } from "../../../entity/conn"; import { conns } from "../../../entity/conn";
@ -12,6 +11,7 @@ import { sendWS } from "../../../sync-handler";
import { SyncType } from "../../../type"; import { SyncType } from "../../../type";
import { code } from "../../code"; import { code } from "../../code";
import { Watcher } from "../watcher"; import { Watcher } from "../watcher";
import { cleanPlugin } from "../../utlis/esbuild-clean-plugin";
const pending = {} as any; const pending = {} as any;
export const initFrontEnd = async ( export const initFrontEnd = async (

View File

@ -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);
});
}
},
};
};

BIN
bun.lockb

Binary file not shown.

BIN
dockerzip

Binary file not shown.

View File

@ -20,8 +20,8 @@
], ],
"dependencies": { "dependencies": {
"brotli-wasm": "^3.0.1", "brotli-wasm": "^3.0.1",
"fdir": "^6.2.0", "fdir": "^6.3.0",
"react-select": "^5.8.0", "react-select": "^5.8.0",
"typescript": "^5.5.4" "typescript": "^5.6.2"
} }
} }

View File

@ -10,7 +10,7 @@
"@types/unzipper": "^0.10.8", "@types/unzipper": "^0.10.8",
"acorn-walk": "^8.3.3", "acorn-walk": "^8.3.3",
"brotli-wasm": "^3.0.1", "brotli-wasm": "^3.0.1",
"esbuild": "^0.21.5", "esbuild": "^0.23.1",
"esbuild-plugin-polyfill-node": "^0.3.0", "esbuild-plugin-polyfill-node": "^0.3.0",
"execa": "^8.0.1", "execa": "^8.0.1",
"fs-jetpack": "^5.1.0", "fs-jetpack": "^5.1.0",

View File

@ -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

View File

@ -192,7 +192,7 @@ const manifest = [
"/y-pojo.d28b9ce4.js", "/y-pojo.d28b9ce4.js",
"/vi.e93512ab.js" "/vi.e93512ab.js"
]; ];
const version = "eb699147"; const version = "8f810dee";
(0, _serviceWorker._register)(manifest, version); (0, _serviceWorker._register)(manifest, version);
},{"@parcel/service-worker":"et5Hi"}],"et5Hi":[function(require,module,exports) { },{"@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"); var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports); parcelHelpers.defineInteropFlag(exports);
parcelHelpers.export(exports, "version", ()=>version); parcelHelpers.export(exports, "version", ()=>version);
const version = "hgr6d4r"; const version = "dxtxosl";
},{"@parcel/transformer-js/src/esmodule-helpers.js":"jpDjm"}],"lXNsG":[function(require,module,exports) { },{"@parcel/transformer-js/src/esmodule-helpers.js":"jpDjm"}],"lXNsG":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");