@mpgd/cli 0.49.0 → 0.50.0
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/dist/asset-pack-build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { existsSync, linkSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
|
-
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
4
|
import { deflateRawSync } from 'node:zlib';
|
|
5
5
|
import { PHASER_PACK_DELIVERY_FORMAT, PHASER_PACK_DELIVERY_VERSION, phaserPackMediaTypeForPath, validatePhaserPackBuildConfig, validatePhaserPackDeliveryManifest, } from '@mpgd/phaser-assets/pack-format';
|
|
6
6
|
import { createDeterministicZip } from './asset-pack-zip.js';
|
|
@@ -92,7 +92,7 @@ function readSourceFile(rootPath, entryPath) {
|
|
|
92
92
|
}
|
|
93
93
|
const relativeToRoot = relative(realpathSync(rootPath), realpathSync(current));
|
|
94
94
|
// Exact '..' components only: names like '..dots' stay inside the root.
|
|
95
|
-
if (relativeToRoot === '..' || relativeToRoot.startsWith(
|
|
95
|
+
if (relativeToRoot === '..' || relativeToRoot.startsWith(`..${sep}`) || isAbsolute(relativeToRoot)) {
|
|
96
96
|
throw new Error(`Pack source path escapes the source root: ${entryPath}`);
|
|
97
97
|
}
|
|
98
98
|
const data = readFileSync(current);
|
|
@@ -185,7 +185,7 @@ export function buildAssetPacks(options) {
|
|
|
185
185
|
if (isAbsolute(step)) {
|
|
186
186
|
return false;
|
|
187
187
|
}
|
|
188
|
-
return step === '' || (step !== '..' && !step.startsWith(
|
|
188
|
+
return step === '' || (step !== '..' && !step.startsWith(`..${sep}`));
|
|
189
189
|
};
|
|
190
190
|
if (overlaps(realOutPath, realRootPath) || overlaps(realRootPath, realOutPath)) {
|
|
191
191
|
throw new Error(`Output directory must be outside the pack source root: ${outPath} vs ${rootPath}`);
|
package/dist/index.js
CHANGED
|
@@ -2923,9 +2923,6 @@ function liteTemplateGameManifest(content) {
|
|
|
2923
2923
|
function createGameApp(input) {
|
|
2924
2924
|
const appDir = resolveAppDirectory(input.directory);
|
|
2925
2925
|
const gameName = path.basename(appDir);
|
|
2926
|
-
if (input.template === 'lite' && !input.workspace) {
|
|
2927
|
-
throw new Error('The lite template requires --workspace until @mpgd/lite-shell is published.');
|
|
2928
|
-
}
|
|
2929
2926
|
assertValidGameName(gameName);
|
|
2930
2927
|
const packageName = input.packageName ?? gameName;
|
|
2931
2928
|
assertValidPackageName(packageName);
|
|
@@ -16,7 +16,7 @@ import { createHash as createHash3 } from "node:crypto";
|
|
|
16
16
|
import { createReadStream } from "node:fs";
|
|
17
17
|
import { copyFile, lstat as lstat2, mkdir, mkdtemp, readdir, readFile, realpath as realpath2, rename, rm, writeFile } from "node:fs/promises";
|
|
18
18
|
import { tmpdir } from "node:os";
|
|
19
|
-
import { dirname as dirname2, isAbsolute as isAbsolute3, join as join3, relative as relative3, resolve as resolve3, sep as
|
|
19
|
+
import { dirname as dirname2, isAbsolute as isAbsolute3, join as join3, relative as relative3, resolve as resolve3, sep as sep3 } from "node:path";
|
|
20
20
|
|
|
21
21
|
// node_modules/.cache/mpgd-native-build/packages/phaser-assets/src/pack-format.js
|
|
22
22
|
var PHASER_PACK_DELIVERY_FORMAT = "mpgd-asset-packs";
|
|
@@ -588,7 +588,7 @@ function resolveAssetPackLocations(policy, packs) {
|
|
|
588
588
|
// node_modules/.cache/mpgd-native-build/packages/cli/src/asset-pack-build.js
|
|
589
589
|
import { createHash } from "node:crypto";
|
|
590
590
|
import { existsSync, linkSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
591
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
591
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
592
592
|
import { deflateRawSync as deflateRawSync2 } from "node:zlib";
|
|
593
593
|
|
|
594
594
|
// node_modules/.cache/mpgd-native-build/packages/cli/src/asset-pack-zip.js
|
|
@@ -749,7 +749,7 @@ function readSourceFile(rootPath, entryPath) {
|
|
|
749
749
|
throw new Error(`Pack source path is not a regular file: ${entryPath}`);
|
|
750
750
|
}
|
|
751
751
|
const relativeToRoot = relative(realpathSync(rootPath), realpathSync(current));
|
|
752
|
-
if (relativeToRoot === ".." || relativeToRoot.startsWith(
|
|
752
|
+
if (relativeToRoot === ".." || relativeToRoot.startsWith(`..${sep}`) || isAbsolute(relativeToRoot)) {
|
|
753
753
|
throw new Error(`Pack source path escapes the source root: ${entryPath}`);
|
|
754
754
|
}
|
|
755
755
|
const data = readFileSync(current);
|
|
@@ -831,7 +831,7 @@ function buildAssetPacks(options) {
|
|
|
831
831
|
if (isAbsolute(step)) {
|
|
832
832
|
return false;
|
|
833
833
|
}
|
|
834
|
-
return step === "" || step !== ".." && !step.startsWith(
|
|
834
|
+
return step === "" || step !== ".." && !step.startsWith(`..${sep}`);
|
|
835
835
|
};
|
|
836
836
|
if (overlaps(realOutPath, realRootPath) || overlaps(realRootPath, realOutPath)) {
|
|
837
837
|
throw new Error(`Output directory must be outside the pack source root: ${outPath} vs ${rootPath}`);
|
|
@@ -1032,7 +1032,7 @@ function buildAssetPacks(options) {
|
|
|
1032
1032
|
import { createHash as createHash2 } from "node:crypto";
|
|
1033
1033
|
import { constants } from "node:fs";
|
|
1034
1034
|
import { lstat, open, opendir, realpath, stat } from "node:fs/promises";
|
|
1035
|
-
import { isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, sep } from "node:path";
|
|
1035
|
+
import { isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
1036
1036
|
|
|
1037
1037
|
// node_modules/.cache/mpgd-native-build/packages/phaser-assets/src/archive-errors.js
|
|
1038
1038
|
var ZipDecodeError = class extends Error {
|
|
@@ -1627,7 +1627,7 @@ var resolveArtifactPath = async (root, realRoot, artifactPath, deadline) => {
|
|
|
1627
1627
|
throw new Error(`Artifact path is not a regular file: ${artifactPath}`);
|
|
1628
1628
|
}
|
|
1629
1629
|
const rel = relative2(realRoot, await deadline.race(realpath(current)));
|
|
1630
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
1630
|
+
if (rel === ".." || rel.startsWith(`..${sep2}`) || isAbsolute2(rel)) {
|
|
1631
1631
|
throw new Error(`Artifact path escapes the root: ${artifactPath}`);
|
|
1632
1632
|
}
|
|
1633
1633
|
return { path: current, dev: stat2.dev, ino: stat2.ino };
|
|
@@ -2278,7 +2278,7 @@ async function fileDigest(path10) {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
function inside(parent, child) {
|
|
2280
2280
|
const step = relative3(parent, child);
|
|
2281
|
-
return step === "" || !isAbsolute3(step) && step !== ".." && !step.startsWith(`..${
|
|
2281
|
+
return step === "" || !isAbsolute3(step) && step !== ".." && !step.startsWith(`..${sep3}`);
|
|
2282
2282
|
}
|
|
2283
2283
|
async function noSymlink(path10) {
|
|
2284
2284
|
let current = resolve3(path10);
|
|
@@ -3646,7 +3646,7 @@ import sharp3 from "sharp";
|
|
|
3646
3646
|
|
|
3647
3647
|
// node_modules/.cache/mpgd-native-build/tools/target/web-artifact.js
|
|
3648
3648
|
import { cpSync, existsSync as existsSync5, lstatSync as lstatSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync6, realpathSync as realpathSync5, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
3649
|
-
import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute5, join as join6, relative as relative7, resolve as resolve7, sep as
|
|
3649
|
+
import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute5, join as join6, relative as relative7, resolve as resolve7, sep as sep4 } from "node:path";
|
|
3650
3650
|
var installableManifestNames = /* @__PURE__ */ new Set(["manifest.json", "manifest.webmanifest"]);
|
|
3651
3651
|
var generatedWebArtifactEvidenceNames = [
|
|
3652
3652
|
"mpgd-effective-target.json",
|
|
@@ -4197,7 +4197,7 @@ function assertExistingWebOutputsAreGeneratedArtifacts(outputs) {
|
|
|
4197
4197
|
}
|
|
4198
4198
|
function isPathWithin(root, candidate) {
|
|
4199
4199
|
const path10 = relative7(root, candidate);
|
|
4200
|
-
return path10 === "" || path10 !== ".." && !path10.startsWith(`..${
|
|
4200
|
+
return path10 === "" || path10 !== ".." && !path10.startsWith(`..${sep4}`) && !isAbsolute5(path10);
|
|
4201
4201
|
}
|
|
4202
4202
|
function pathsOverlap(first, second) {
|
|
4203
4203
|
return isPathWithin(first, second) || isPathWithin(second, first);
|
|
@@ -7039,7 +7039,7 @@ function isValidHostname(hostname) {
|
|
|
7039
7039
|
|
|
7040
7040
|
// node_modules/.cache/mpgd-native-build/tools/target/minigame-package-budget.js
|
|
7041
7041
|
import { lstatSync as lstatSync6, readdirSync as readdirSync3 } from "node:fs";
|
|
7042
|
-
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve10, sep as
|
|
7042
|
+
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve10, sep as sep5 } from "node:path";
|
|
7043
7043
|
var miniGameMainPackageLimitBytes = 4 * 1024 * 1024;
|
|
7044
7044
|
function assertMiniGamePackageBudget(input) {
|
|
7045
7045
|
const artifactRoot = resolve10(input.artifactRoot);
|
|
@@ -7186,7 +7186,7 @@ function assertSubpackageRoots(subpackages) {
|
|
|
7186
7186
|
function resolveArtifactPath2(root, path10) {
|
|
7187
7187
|
const resolved = resolve10(root, path10);
|
|
7188
7188
|
const relativePath = relative8(root, resolved);
|
|
7189
|
-
if (relativePath.length === 0 || relativePath === ".." || relativePath.startsWith(`..${
|
|
7189
|
+
if (relativePath.length === 0 || relativePath === ".." || relativePath.startsWith(`..${sep5}`) || isAbsolute6(relativePath)) {
|
|
7190
7190
|
throw new Error(`Mini-game path escapes its artifact root: ${path10}`);
|
|
7191
7191
|
}
|
|
7192
7192
|
try {
|
|
@@ -10371,7 +10371,7 @@ function requireNonEmptyString(input, label) {
|
|
|
10371
10371
|
// node_modules/.cache/mpgd-native-build/packages/cli/src/microsoft-store-pwa-release.js
|
|
10372
10372
|
import { createHash as createHash9 } from "node:crypto";
|
|
10373
10373
|
import { closeSync as closeSync2, existsSync as existsSync11, openSync as openSync2, readdirSync as readdirSync4, readFileSync as readFileSync15, readSync, statSync as statSync2 } from "node:fs";
|
|
10374
|
-
import { relative as relative10, resolve as resolve13, sep as
|
|
10374
|
+
import { relative as relative10, resolve as resolve13, sep as sep6 } from "node:path";
|
|
10375
10375
|
function assertMicrosoftStorePwaProvenance(input) {
|
|
10376
10376
|
return {
|
|
10377
10377
|
appVersion: requireNonEmptyString2(input.appVersion, "PWA app version"),
|
|
@@ -10553,7 +10553,7 @@ function listPrecacheEntries(artifactRoot) {
|
|
|
10553
10553
|
}
|
|
10554
10554
|
}
|
|
10555
10555
|
}
|
|
10556
|
-
return files.filter((path10) => !path10.endsWith(".map") && !path10.endsWith(`${
|
|
10556
|
+
return files.filter((path10) => !path10.endsWith(".map") && !path10.endsWith(`${sep6}pwa-release.json`) && !path10.endsWith(`${sep6}service-worker.js`)).map((path10) => ({
|
|
10557
10557
|
url: toPrecacheUrl(artifactRoot, path10),
|
|
10558
10558
|
source: readFileSync15(path10)
|
|
10559
10559
|
})).sort((left, right) => compareCodeUnits(left.url, right.url));
|
|
@@ -10580,7 +10580,7 @@ function normalizePrecacheUrls(urls) {
|
|
|
10580
10580
|
return normalized.sort(compareCodeUnits);
|
|
10581
10581
|
}
|
|
10582
10582
|
function toPrecacheUrl(root, path10) {
|
|
10583
|
-
const portablePath = relative10(root, path10).split(
|
|
10583
|
+
const portablePath = relative10(root, path10).split(sep6).join("/");
|
|
10584
10584
|
return assertMicrosoftStorePwaPrecacheUrl(`./${portablePath}`);
|
|
10585
10585
|
}
|
|
10586
10586
|
function requireGameSpecificPwaId(value) {
|
|
@@ -10657,7 +10657,7 @@ function readPwaId(input) {
|
|
|
10657
10657
|
// node_modules/.cache/mpgd-native-build/tools/target/minigame-artifact.js
|
|
10658
10658
|
import { createHash as createHash10 } from "node:crypto";
|
|
10659
10659
|
import { copyFileSync as copyFileSync2, cpSync as cpSync2, existsSync as existsSync12, constants as fsConstants, lstatSync as lstatSync8, mkdirSync as mkdirSync7, mkdtempSync, readdirSync as readdirSync5, readFileSync as readFileSync16, realpathSync as realpathSync7, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
10660
|
-
import { basename as basename4, dirname as dirname8, extname as extname2, isAbsolute as isAbsolute9, join as join11, relative as relative11, resolve as resolve15, sep as
|
|
10660
|
+
import { basename as basename4, dirname as dirname8, extname as extname2, isAbsolute as isAbsolute9, join as join11, relative as relative11, resolve as resolve15, sep as sep7 } from "node:path";
|
|
10661
10661
|
import { parse } from "acorn";
|
|
10662
10662
|
var miniGameArtifactEvidenceFileName = "mpgd-minigame-artifact.json";
|
|
10663
10663
|
var miniGameEffectiveTargetConfigFileName = "mpgd-effective-target-config.json";
|
|
@@ -10753,9 +10753,9 @@ function assertMiniGameArtifactOutputDirectory(artifactRoot, projectRoot) {
|
|
|
10753
10753
|
const project = resolve15(projectRoot);
|
|
10754
10754
|
const artifact = resolve15(artifactRoot);
|
|
10755
10755
|
const projectRelativePath = relative11(project, artifact);
|
|
10756
|
-
const portableProjectRelativePath = projectRelativePath.replaceAll(
|
|
10756
|
+
const portableProjectRelativePath = projectRelativePath.replaceAll(sep7, "/");
|
|
10757
10757
|
const segments = portableProjectRelativePath.split("/");
|
|
10758
|
-
if (projectRelativePath.length === 0 || projectRelativePath === ".." || projectRelativePath.startsWith(`..${
|
|
10758
|
+
if (projectRelativePath.length === 0 || projectRelativePath === ".." || projectRelativePath.startsWith(`..${sep7}`) || sep7 === "/" && projectRelativePath.includes("\\") || isAbsolute9(projectRelativePath) || segments[0] !== "artifacts" || segments.length < 2) {
|
|
10759
10759
|
throw new Error(`Mini-game artifact output must be a dedicated artifacts/ child: ${artifactRoot}`);
|
|
10760
10760
|
}
|
|
10761
10761
|
assertMiniGameArtifactRelativePath(portableProjectRelativePath, "Mini-game artifact output");
|
|
@@ -10982,7 +10982,7 @@ function pathsOverlap2(first, second) {
|
|
|
10982
10982
|
}
|
|
10983
10983
|
function isPathWithin2(root, candidate) {
|
|
10984
10984
|
const path10 = relative11(root, candidate);
|
|
10985
|
-
return path10 === "" || path10 !== ".." && !path10.startsWith(`..${
|
|
10985
|
+
return path10 === "" || path10 !== ".." && !path10.startsWith(`..${sep7}`) && !isAbsolute9(path10);
|
|
10986
10986
|
}
|
|
10987
10987
|
function portablePathComparisonKey(path10) {
|
|
10988
10988
|
const portablePath = path10.replaceAll("\\", "/").split("/").map((segment) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Gunshi CLI for mpgd-kit starter generation and target workflow orchestration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -88,10 +88,11 @@
|
|
|
88
88
|
"@mpgd/adapter-verse8": "0.7.1",
|
|
89
89
|
"@mpgd/analytics": "0.4.10",
|
|
90
90
|
"@mpgd/capacitor-play-billing": "0.3.1",
|
|
91
|
-
"@mpgd/bridge": "0.13.1",
|
|
92
91
|
"@mpgd/capacitor-storekit": "0.3.1",
|
|
93
|
-
"@mpgd/
|
|
92
|
+
"@mpgd/bridge": "0.13.1",
|
|
94
93
|
"@mpgd/game-services": "0.24.1",
|
|
94
|
+
"@mpgd/game-runtime": "0.7.1",
|
|
95
|
+
"@mpgd/lite-shell": "0.1.0",
|
|
95
96
|
"@mpgd/i18n": "0.6.15"
|
|
96
97
|
},
|
|
97
98
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# __GAME_TITLE__
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Canvas2D lite game generated by `@mpgd/create-game --template lite`.
|
|
4
4
|
It uses `@mpgd/lite-shell`, `PlatformGateway`, and the shared mpgd game runtime.
|
|
5
5
|
|
|
6
6
|
## Start
|
|
@@ -13,7 +13,7 @@ pnpm build
|
|
|
13
13
|
pnpm accept
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Standalone games install the public `@mpgd/lite-shell` package. Add `--workspace --kit-path <mpgd-kit>` to generate a game linked to a local Kit checkout.
|
|
17
17
|
The CLI supports the canvas renderer; DOM and SVG renderers are planned.
|
|
18
18
|
|
|
19
19
|
## Ownership
|