@pumpkin-plugins/build 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/cli.js +8 -21
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ This package is configured for public npm publication as `@pumpkin-plugins/build
|
|
|
10
10
|
publish its packed tarball; see [CI and releases](../../docs/ci-and-releases.md#releases) and the
|
|
11
11
|
[build guide](../../docs/building.md).
|
|
12
12
|
|
|
13
|
+
The builder and migration codemod share the dependency-free
|
|
14
|
+
[`@pumpkin-plugins/wasi-capabilities`](../wasi-capabilities/README.md) package for WASI names and
|
|
15
|
+
interface mapping.
|
|
16
|
+
|
|
13
17
|
<!-- docs:begin reference -->
|
|
14
18
|
<!-- Generated by pumpkin-plugins-docs from package, action, extension, and component docs metadata. Run `pnpm readme`. -->
|
|
15
19
|
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as path9 from "node:path";
|
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { Command } from "@commander-js/extra-typings";
|
|
10
10
|
import { ensurePumpkinWit } from "@pumpkin-plugins/pumpkin-api/wit";
|
|
11
|
+
import { wasiInterfaces } from "@pumpkin-plugins/wasi-capabilities";
|
|
11
12
|
import { CommanderError } from "commander";
|
|
12
13
|
|
|
13
14
|
// src/bundle.ts
|
|
@@ -857,23 +858,6 @@ function isReplaceError(error) {
|
|
|
857
858
|
return typeof error === "object" && error !== null && "code" in error && (error.code === "EEXIST" || error.code === "EPERM" || error.code === "EACCES");
|
|
858
859
|
}
|
|
859
860
|
|
|
860
|
-
// src/capabilities.ts
|
|
861
|
-
var WASI_VERSION = "0.2.3";
|
|
862
|
-
var CAPABILITIES = {
|
|
863
|
-
http: ["http/types", "http/outgoing-handler"],
|
|
864
|
-
filesystem: ["filesystem/types", "filesystem/preopens"],
|
|
865
|
-
sockets: ["sockets/network", "sockets/instance-network", "sockets/tcp", "sockets/tcp-create-socket"],
|
|
866
|
-
udp: ["sockets/network", "sockets/instance-network", "sockets/udp", "sockets/udp-create-socket"]
|
|
867
|
-
};
|
|
868
|
-
var SUPPORT_IMPORTS = ["io/poll", "io/streams", "clocks/monotonic-clock"];
|
|
869
|
-
function isCapability(name) {
|
|
870
|
-
return Object.hasOwn(CAPABILITIES, name);
|
|
871
|
-
}
|
|
872
|
-
function wasiInterfaces(capabilities) {
|
|
873
|
-
if (capabilities.length === 0) return [];
|
|
874
|
-
return [.../* @__PURE__ */ new Set([...capabilities.flatMap((c) => CAPABILITIES[c]), ...SUPPORT_IMPORTS])];
|
|
875
|
-
}
|
|
876
|
-
|
|
877
861
|
// ../minecraft-colors/src/index.ts
|
|
878
862
|
var COLORS = {
|
|
879
863
|
black: "0",
|
|
@@ -1052,6 +1036,7 @@ function formatSelectionOption(option, selection, omittedValue) {
|
|
|
1052
1036
|
// src/plugin-config.ts
|
|
1053
1037
|
import * as fs5 from "node:fs";
|
|
1054
1038
|
import * as path5 from "node:path";
|
|
1039
|
+
import { CAPABILITIES, isCapability } from "@pumpkin-plugins/wasi-capabilities";
|
|
1055
1040
|
function readPluginConfig(pluginDir) {
|
|
1056
1041
|
let pkg;
|
|
1057
1042
|
try {
|
|
@@ -1145,12 +1130,13 @@ function isRecord(value) {
|
|
|
1145
1130
|
|
|
1146
1131
|
// src/update-check.ts
|
|
1147
1132
|
import { createRequire as createRequire3 } from "node:module";
|
|
1148
|
-
import { latestVersion
|
|
1133
|
+
import { latestVersion } from "@badisi/latest-version";
|
|
1149
1134
|
var packageMetadata = createRequire3(import.meta.url)("../package.json");
|
|
1150
1135
|
var packageName = packageMetadata.name;
|
|
1151
1136
|
var repositoryUrl = packageMetadata.repository.url.replace(/^git\+/, "").replace(/\.git$/, "");
|
|
1152
1137
|
var releaseComponent = packageName.split("/").at(-1) ?? packageName;
|
|
1153
1138
|
var requestTimeout = 5e3;
|
|
1139
|
+
var cacheMaxAge = 3 * 60 * 60 * 1e3;
|
|
1154
1140
|
function isBuildUpdateCheckAllowed(args, environment, isTTY) {
|
|
1155
1141
|
return isTTY && !environment.CI && environment.PUMPKIN_DEV_MODE !== "1" && environment.PUMPKIN_PLUGINS_NO_UPDATE_NOTIFIER !== "1" && !args.some((argument) => ["--help", "-h", "--version", "-V", "--no-update-notifier"].includes(argument));
|
|
1156
1142
|
}
|
|
@@ -1158,8 +1144,8 @@ async function startBuildUpdateCheck(args, options) {
|
|
|
1158
1144
|
if (!isBuildUpdateCheckAllowed(args, options.environment, options.isTTY)) return;
|
|
1159
1145
|
try {
|
|
1160
1146
|
const result = await (options.lookup ?? latestVersion)(packageName, {
|
|
1161
|
-
useCache:
|
|
1162
|
-
cacheMaxAge
|
|
1147
|
+
useCache: !args.includes("--no-update-cache"),
|
|
1148
|
+
cacheMaxAge,
|
|
1163
1149
|
requestOptions: { timeout: requestTimeout }
|
|
1164
1150
|
});
|
|
1165
1151
|
const currentVersion = result.local;
|
|
@@ -1509,6 +1495,7 @@ async function writeAtomically(file, bytes, expectedHash, stagingDirectory) {
|
|
|
1509
1495
|
// src/wit.ts
|
|
1510
1496
|
import * as fs8 from "node:fs";
|
|
1511
1497
|
import * as path8 from "node:path";
|
|
1498
|
+
import { WASI_VERSION } from "@pumpkin-plugins/wasi-capabilities";
|
|
1512
1499
|
function injectWasiImports(pluginWit, interfaces) {
|
|
1513
1500
|
const firstExport = /^[ \t]*export /m.exec(pluginWit);
|
|
1514
1501
|
if (!firstExport) throw new BuildError("could not find the exports in plugin.wit; the API layout changed");
|
|
@@ -1613,7 +1600,7 @@ function isInputOutputError(error) {
|
|
|
1613
1600
|
|
|
1614
1601
|
// src/cli.ts
|
|
1615
1602
|
async function run(args, pluginDir) {
|
|
1616
|
-
const command = new Command().name("pumpkin-plugins-build").description("Build the Pumpkin plugin in the current directory.").version(createRequire4(import.meta.url)("../package.json").version).option("--types-only", "Generate guest declarations without building a component").option("--parse-ts", "Use Hermes TypeScript parsing for the component bundle").option("--no-update-notifier", "Skip the npm update check").configureOutput({ outputError: () => {
|
|
1603
|
+
const command = new Command().name("pumpkin-plugins-build").description("Build the Pumpkin plugin in the current directory.").version(createRequire4(import.meta.url)("../package.json").version).option("--types-only", "Generate guest declarations without building a component").option("--parse-ts", "Use Hermes TypeScript parsing for the component bundle").option("--no-update-notifier", "Skip the npm update check").option("--no-update-cache", "Skip the npm update check cache").configureOutput({ outputError: () => {
|
|
1617
1604
|
} }).exitOverride();
|
|
1618
1605
|
try {
|
|
1619
1606
|
command.parse(args, { from: "user" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pumpkin-plugins/build",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Shared build tool for the plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"minecraft",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"contributors": [
|
|
36
36
|
"Filiph Sandström <filfat@hotmail.se> (https://github.com/filiphsps)"
|
|
37
37
|
],
|
|
38
|
+
"sideEffects": false,
|
|
38
39
|
"type": "module",
|
|
39
40
|
"bin": {
|
|
40
41
|
"pumpkin-plugins-build": "dist/cli.js"
|
|
@@ -51,7 +52,8 @@
|
|
|
51
52
|
"@di-framework/componentize-qjs": "0.4.4-di.3",
|
|
52
53
|
"@pumpkin-plugins/minecraft-colors": "0.1.0",
|
|
53
54
|
"@pumpkin-plugins/pumpkin-api": "0.1.0",
|
|
54
|
-
"@pumpkin-plugins/static-hermes-runtime": "0.1.
|
|
55
|
+
"@pumpkin-plugins/static-hermes-runtime": "0.1.1",
|
|
56
|
+
"@pumpkin-plugins/wasi-capabilities": "0.1.0",
|
|
55
57
|
"commander": "15.0.0",
|
|
56
58
|
"esbuild": "0.28.2",
|
|
57
59
|
"typescript": "6.0.3"
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"access": "public"
|
|
70
72
|
},
|
|
71
73
|
"scripts": {
|
|
72
|
-
"build": "esbuild src/cli.ts --bundle --platform=node --format=esm --target=node24 --packages=external --alias:@pumpkin-plugins/minecraft-colors=../minecraft-colors/src/index.ts --
|
|
74
|
+
"build": "esbuild src/cli.ts --bundle --platform=node --format=esm --target=node24 --packages=external --alias:@pumpkin-plugins/minecraft-colors=../minecraft-colors/src/index.ts --outdir=dist",
|
|
73
75
|
"readme": "pumpkin-plugins-docs generate docs.ts",
|
|
74
76
|
"readme:check": "pumpkin-plugins-docs generate docs.ts --check",
|
|
75
77
|
"test": "vitest run",
|