@playcademy/vite-plugin 0.1.30 → 0.1.32
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/index.js +21 -80
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -41199,7 +41199,7 @@ var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
|
41199
41199
|
// package.json
|
|
41200
41200
|
var package_default = {
|
|
41201
41201
|
name: "@playcademy/vite-plugin",
|
|
41202
|
-
version: "0.1.
|
|
41202
|
+
version: "0.1.31",
|
|
41203
41203
|
type: "module",
|
|
41204
41204
|
exports: {
|
|
41205
41205
|
".": {
|
|
@@ -41406,15 +41406,11 @@ import { stdout } from "process";
|
|
|
41406
41406
|
import { createPublicKey as createPublicKey2, createVerify, verify as verify3 } from "crypto";
|
|
41407
41407
|
import { request as request2 } from "https";
|
|
41408
41408
|
import { pipeline } from "stream";
|
|
41409
|
-
import {
|
|
41410
|
-
import {
|
|
41411
|
-
import { tmpdir } from "node:os";
|
|
41412
|
-
import { join as join5, relative } from "node:path";
|
|
41409
|
+
import { readdir as readdir2, readFile as readFile2, stat } from "node:fs/promises";
|
|
41410
|
+
import { join as join4, relative } from "node:path";
|
|
41413
41411
|
import { createHash } from "node:crypto";
|
|
41414
41412
|
import { readdir, readFile } from "node:fs/promises";
|
|
41415
41413
|
import { join as join3 } from "node:path";
|
|
41416
|
-
import { dirname as dirname2, join as join4 } from "node:path";
|
|
41417
|
-
import { fileURLToPath } from "node:url";
|
|
41418
41414
|
import crypto6 from "node:crypto";
|
|
41419
41415
|
import * as crypto7 from "node:crypto";
|
|
41420
41416
|
var __create2 = Object.create;
|
|
@@ -147821,11 +147817,11 @@ var require_dist_cjs66 = __commonJS2((exports, module2) => {
|
|
|
147821
147817
|
}, "validateTokenKey");
|
|
147822
147818
|
var import_shared_ini_file_loader = require_dist_cjs52();
|
|
147823
147819
|
var import_fs2 = __require2("fs");
|
|
147824
|
-
var { writeFile
|
|
147820
|
+
var { writeFile } = import_fs2.promises;
|
|
147825
147821
|
var writeSSOTokenToFile = /* @__PURE__ */ __name((id, ssoToken) => {
|
|
147826
147822
|
const tokenFilepath = (0, import_shared_ini_file_loader.getSSOTokenFilepath)(id);
|
|
147827
147823
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
147828
|
-
return
|
|
147824
|
+
return writeFile(tokenFilepath, tokenString);
|
|
147829
147825
|
}, "writeSSOTokenToFile");
|
|
147830
147826
|
var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
|
|
147831
147827
|
var fromSso = /* @__PURE__ */ __name((_init = {}) => async ({ callerClientConfig } = {}) => {
|
|
@@ -178272,7 +178268,7 @@ function sql(strings, ...params) {
|
|
|
178272
178268
|
return new SQL([new StringChunk(str)]);
|
|
178273
178269
|
}
|
|
178274
178270
|
sql22.raw = raw2;
|
|
178275
|
-
function
|
|
178271
|
+
function join5(chunks, separator) {
|
|
178276
178272
|
const result = [];
|
|
178277
178273
|
for (const [i22, chunk] of chunks.entries()) {
|
|
178278
178274
|
if (i22 > 0 && separator !== undefined) {
|
|
@@ -178282,7 +178278,7 @@ function sql(strings, ...params) {
|
|
|
178282
178278
|
}
|
|
178283
178279
|
return new SQL(result);
|
|
178284
178280
|
}
|
|
178285
|
-
sql22.join =
|
|
178281
|
+
sql22.join = join5;
|
|
178286
178282
|
function identifier(value) {
|
|
178287
178283
|
return new Name(value);
|
|
178288
178284
|
}
|
|
@@ -181195,7 +181191,7 @@ class PgSelectQueryBuilderBase extends TypedQueryBuilder {
|
|
|
181195
181191
|
return (table, on) => {
|
|
181196
181192
|
const baseTableName = this.tableName;
|
|
181197
181193
|
const tableName = getTableLikeName(table);
|
|
181198
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
181194
|
+
if (typeof tableName === "string" && this.config.joins?.some((join5) => join5.alias === tableName)) {
|
|
181199
181195
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
181200
181196
|
}
|
|
181201
181197
|
if (!this.isPartialSelect) {
|
|
@@ -181700,7 +181696,7 @@ class PgUpdateBase extends QueryPromise {
|
|
|
181700
181696
|
createJoin(joinType) {
|
|
181701
181697
|
return (table, on) => {
|
|
181702
181698
|
const tableName = getTableLikeName(table);
|
|
181703
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
181699
|
+
if (typeof tableName === "string" && this.config.joins.some((join5) => join5.alias === tableName)) {
|
|
181704
181700
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
181705
181701
|
}
|
|
181706
181702
|
if (typeof on === "function") {
|
|
@@ -181750,10 +181746,10 @@ class PgUpdateBase extends QueryPromise {
|
|
|
181750
181746
|
const fromFields = this.getTableLikeFields(this.config.from);
|
|
181751
181747
|
fields[tableName] = fromFields;
|
|
181752
181748
|
}
|
|
181753
|
-
for (const
|
|
181754
|
-
const tableName2 = getTableLikeName(
|
|
181755
|
-
if (typeof tableName2 === "string" && !is(
|
|
181756
|
-
const fromFields = this.getTableLikeFields(
|
|
181749
|
+
for (const join5 of this.config.joins) {
|
|
181750
|
+
const tableName2 = getTableLikeName(join5.table);
|
|
181751
|
+
if (typeof tableName2 === "string" && !is(join5.table, SQL)) {
|
|
181752
|
+
const fromFields = this.getTableLikeFields(join5.table);
|
|
181757
181753
|
fields[tableName2] = fromFields;
|
|
181758
181754
|
}
|
|
181759
181755
|
}
|
|
@@ -197862,7 +197858,6 @@ function normalizeDeploymentOptions(options) {
|
|
|
197862
197858
|
assets: options?.bindings?.assets ?? false
|
|
197863
197859
|
},
|
|
197864
197860
|
assetsPath: options?.assetsPath,
|
|
197865
|
-
assetsZip: options?.assetsZip,
|
|
197866
197861
|
keepAssets: options?.keepAssets
|
|
197867
197862
|
};
|
|
197868
197863
|
}
|
|
@@ -197909,34 +197904,6 @@ var CUSTOM_DOMAINS_KV_NAME = "cademy-custom-domains";
|
|
|
197909
197904
|
var DEFAULT_COMPATIBILITY_DATE2 = new Date().toISOString().slice(0, 10);
|
|
197910
197905
|
var GAME_WORKER_DOMAIN_PRODUCTION = GAME_WORKER_DOMAINS.production;
|
|
197911
197906
|
var GAME_WORKER_DOMAIN_STAGING = GAME_WORKER_DOMAINS.staging;
|
|
197912
|
-
var esbuild = __toESM2(require_main(), 1);
|
|
197913
|
-
async function bundleWorker(filePath) {
|
|
197914
|
-
const result = await esbuild.build({
|
|
197915
|
-
entryPoints: [filePath],
|
|
197916
|
-
bundle: true,
|
|
197917
|
-
format: "esm",
|
|
197918
|
-
platform: "browser",
|
|
197919
|
-
target: "es2022",
|
|
197920
|
-
write: false,
|
|
197921
|
-
minify: false,
|
|
197922
|
-
sourcemap: false,
|
|
197923
|
-
logLevel: "error"
|
|
197924
|
-
});
|
|
197925
|
-
if (!result.outputFiles?.[0]) {
|
|
197926
|
-
throw new Error(`No output generated for worker ${filePath}`);
|
|
197927
|
-
}
|
|
197928
|
-
return result.outputFiles[0].text;
|
|
197929
|
-
}
|
|
197930
|
-
var _cachedStubWorker = null;
|
|
197931
|
-
async function getStubWorkerCode() {
|
|
197932
|
-
if (_cachedStubWorker) {
|
|
197933
|
-
return _cachedStubWorker;
|
|
197934
|
-
}
|
|
197935
|
-
const currentDir = dirname2(fileURLToPath(import.meta.url));
|
|
197936
|
-
const workerPath = join4(currentDir, "stub-worker.ts");
|
|
197937
|
-
_cachedStubWorker = await bundleWorker(workerPath);
|
|
197938
|
-
return _cachedStubWorker;
|
|
197939
|
-
}
|
|
197940
197907
|
|
|
197941
197908
|
class CloudflareProvider {
|
|
197942
197909
|
client;
|
|
@@ -197978,7 +197945,7 @@ class CloudflareProvider {
|
|
|
197978
197945
|
async function scanDirectory(dir) {
|
|
197979
197946
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
197980
197947
|
for (const entry of entries) {
|
|
197981
|
-
const fullPath =
|
|
197948
|
+
const fullPath = join4(dir, entry.name);
|
|
197982
197949
|
if (entry.isDirectory()) {
|
|
197983
197950
|
if (await scanDirectory(fullPath))
|
|
197984
197951
|
return true;
|
|
@@ -198000,7 +197967,7 @@ class CloudflareProvider {
|
|
|
198000
197967
|
async resolveAssetBasePath(dirPath) {
|
|
198001
197968
|
const entries = await readdir2(dirPath, { withFileTypes: true });
|
|
198002
197969
|
if (entries.length === 1 && entries[0]?.isDirectory()) {
|
|
198003
|
-
const unwrappedPath =
|
|
197970
|
+
const unwrappedPath = join4(dirPath, entries[0].name);
|
|
198004
197971
|
log2.debug("[CloudflareProvider] Unwrapping wrapper directory", {
|
|
198005
197972
|
wrapper: entries[0].name
|
|
198006
197973
|
});
|
|
@@ -198011,7 +197978,7 @@ class CloudflareProvider {
|
|
|
198011
197978
|
async uploadFilesToR2(dir, baseDir, bucketName) {
|
|
198012
197979
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
198013
197980
|
for (const entry of entries) {
|
|
198014
|
-
const fullPath =
|
|
197981
|
+
const fullPath = join4(dir, entry.name);
|
|
198015
197982
|
if (entry.isDirectory()) {
|
|
198016
197983
|
await this.uploadFilesToR2(fullPath, baseDir, bucketName);
|
|
198017
197984
|
} else {
|
|
@@ -198034,38 +198001,15 @@ class CloudflareProvider {
|
|
|
198034
198001
|
async deploy(deploymentId, code, env2, options) {
|
|
198035
198002
|
const opts = normalizeDeploymentOptions(options);
|
|
198036
198003
|
const isFirstDeploy = env2.PLAYCADEMY_API_KEY !== undefined;
|
|
198037
|
-
const hasAssets = !!
|
|
198038
|
-
let finalCode = code ?? "";
|
|
198004
|
+
const hasAssets = !!opts.assetsPath;
|
|
198039
198005
|
if (!code) {
|
|
198040
|
-
|
|
198041
|
-
log2.debug("[CloudflareProvider] Fetching existing script", {
|
|
198042
|
-
deploymentId,
|
|
198043
|
-
namespace: this.config.dispatchNamespace
|
|
198044
|
-
});
|
|
198045
|
-
finalCode = await this.client.workers.getScriptContent(this.config.dispatchNamespace, deploymentId);
|
|
198046
|
-
} catch {
|
|
198047
|
-
log2.debug("[CloudflareProvider] No existing script, using stub worker", {
|
|
198048
|
-
deploymentId
|
|
198049
|
-
});
|
|
198050
|
-
finalCode = await getStubWorkerCode();
|
|
198051
|
-
}
|
|
198006
|
+
throw new Error(`No worker code provided for deployment. Frontend-only deployments should include a stub worker from the CLI.`);
|
|
198052
198007
|
}
|
|
198008
|
+
const finalCode = code;
|
|
198053
198009
|
if (opts.keepAssets === undefined) {
|
|
198054
198010
|
opts.keepAssets = true;
|
|
198055
198011
|
}
|
|
198056
|
-
|
|
198057
|
-
let finalAssetsPath = opts.assetsPath;
|
|
198058
|
-
if (opts.assetsZip && !opts.assetsPath) {
|
|
198059
|
-
tempDir = join5(tmpdir(), `playcademy-assets-${Date.now()}`);
|
|
198060
|
-
finalAssetsPath = join5(tempDir, "dist");
|
|
198061
|
-
await mkdir(finalAssetsPath, { recursive: true });
|
|
198062
|
-
await writeFile(join5(tempDir, "temp.zip"), opts.assetsZip);
|
|
198063
|
-
execSync(`unzip -q ${join5(tempDir, "temp.zip")} -d ${finalAssetsPath}`);
|
|
198064
|
-
log2.debug("[CloudflareProvider] Extracted ZIP to temp directory", {
|
|
198065
|
-
tempDir,
|
|
198066
|
-
size: opts.assetsZip.length
|
|
198067
|
-
});
|
|
198068
|
-
}
|
|
198012
|
+
const finalAssetsPath = opts.assetsPath;
|
|
198069
198013
|
log2.info("[CloudflareProvider] Deploying worker to dispatch namespace", {
|
|
198070
198014
|
deploymentId,
|
|
198071
198015
|
namespace: this.config.dispatchNamespace,
|
|
@@ -198194,10 +198138,6 @@ class CloudflareProvider {
|
|
|
198194
198138
|
error: error2
|
|
198195
198139
|
});
|
|
198196
198140
|
throw new Error(`Failed to deploy to Cloudflare Workers for Platforms: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
198197
|
-
} finally {
|
|
198198
|
-
if (tempDir) {
|
|
198199
|
-
await rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
198200
|
-
}
|
|
198201
198141
|
}
|
|
198202
198142
|
}
|
|
198203
198143
|
async delete(deploymentId, options) {
|
|
@@ -198277,6 +198217,7 @@ class CloudflareProvider {
|
|
|
198277
198217
|
});
|
|
198278
198218
|
}
|
|
198279
198219
|
}
|
|
198220
|
+
var esbuild = __toESM2(require_main(), 1);
|
|
198280
198221
|
init_src();
|
|
198281
198222
|
var cloudflareProvider = null;
|
|
198282
198223
|
function getCloudflareProvider() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"archiver": "^7.0.1",
|
|
23
23
|
"picocolors": "^1.1.1",
|
|
24
|
-
"playcademy": "0.14.
|
|
24
|
+
"playcademy": "0.14.17"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@inquirer/prompts": "^7.8.6",
|