@squadbase/vite-server 0.1.18 → 0.1.19-dev.a00d9c3
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 -3
- package/dist/main.js +21 -3
- package/dist/vite-plugin.js +4 -1
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -47691,8 +47691,14 @@ function getSkippedServerLogics() {
|
|
|
47691
47691
|
}
|
|
47692
47692
|
var viteServer = null;
|
|
47693
47693
|
function validateHandlerPath(dirPath, handlerPath) {
|
|
47694
|
-
const absolute = path2.resolve(dirPath, handlerPath);
|
|
47695
47694
|
const normalizedDir = path2.resolve(dirPath);
|
|
47695
|
+
const dirBase = path2.basename(normalizedDir);
|
|
47696
|
+
let normalized = handlerPath.replace(/^\.?[/\\]/, "");
|
|
47697
|
+
const prefix = dirBase + "/";
|
|
47698
|
+
if (normalized.startsWith(prefix)) {
|
|
47699
|
+
normalized = normalized.slice(prefix.length);
|
|
47700
|
+
}
|
|
47701
|
+
const absolute = path2.resolve(dirPath, normalized);
|
|
47696
47702
|
if (!absolute.startsWith(normalizedDir + path2.sep)) {
|
|
47697
47703
|
throw new Error(`Handler path escapes server-logic directory: ${handlerPath}`);
|
|
47698
47704
|
}
|
|
@@ -47701,6 +47707,19 @@ function validateHandlerPath(dirPath, handlerPath) {
|
|
|
47701
47707
|
}
|
|
47702
47708
|
return absolute;
|
|
47703
47709
|
}
|
|
47710
|
+
var jitiInstance = null;
|
|
47711
|
+
var jitiModuleCache = /* @__PURE__ */ new Map();
|
|
47712
|
+
async function loadTsHandlerWithJiti(absolutePath) {
|
|
47713
|
+
const cached = jitiModuleCache.get(absolutePath);
|
|
47714
|
+
if (cached) return cached;
|
|
47715
|
+
if (!jitiInstance) {
|
|
47716
|
+
const { createJiti } = await import("jiti");
|
|
47717
|
+
jitiInstance = createJiti(import.meta.url, { fsCache: false });
|
|
47718
|
+
}
|
|
47719
|
+
const mod = await jitiInstance.import(absolutePath);
|
|
47720
|
+
jitiModuleCache.set(absolutePath, mod);
|
|
47721
|
+
return mod;
|
|
47722
|
+
}
|
|
47704
47723
|
async function loadTypeScriptHandler(absolutePath) {
|
|
47705
47724
|
let mod;
|
|
47706
47725
|
if (viteServer) {
|
|
@@ -47708,8 +47727,7 @@ async function loadTypeScriptHandler(absolutePath) {
|
|
|
47708
47727
|
if (module) viteServer.moduleGraph.invalidateModule(module);
|
|
47709
47728
|
mod = await viteServer.ssrLoadModule(absolutePath);
|
|
47710
47729
|
} else {
|
|
47711
|
-
|
|
47712
|
-
mod = await import(pathToFileURL(absolutePath).href);
|
|
47730
|
+
mod = await loadTsHandlerWithJiti(absolutePath);
|
|
47713
47731
|
}
|
|
47714
47732
|
const handler = mod.default;
|
|
47715
47733
|
if (typeof handler !== "function") {
|
package/dist/main.js
CHANGED
|
@@ -47424,8 +47424,14 @@ function getSkippedServerLogics() {
|
|
|
47424
47424
|
}
|
|
47425
47425
|
var viteServer = null;
|
|
47426
47426
|
function validateHandlerPath(dirPath, handlerPath) {
|
|
47427
|
-
const absolute = path2.resolve(dirPath, handlerPath);
|
|
47428
47427
|
const normalizedDir = path2.resolve(dirPath);
|
|
47428
|
+
const dirBase = path2.basename(normalizedDir);
|
|
47429
|
+
let normalized = handlerPath.replace(/^\.?[/\\]/, "");
|
|
47430
|
+
const prefix = dirBase + "/";
|
|
47431
|
+
if (normalized.startsWith(prefix)) {
|
|
47432
|
+
normalized = normalized.slice(prefix.length);
|
|
47433
|
+
}
|
|
47434
|
+
const absolute = path2.resolve(dirPath, normalized);
|
|
47429
47435
|
if (!absolute.startsWith(normalizedDir + path2.sep)) {
|
|
47430
47436
|
throw new Error(`Handler path escapes server-logic directory: ${handlerPath}`);
|
|
47431
47437
|
}
|
|
@@ -47434,6 +47440,19 @@ function validateHandlerPath(dirPath, handlerPath) {
|
|
|
47434
47440
|
}
|
|
47435
47441
|
return absolute;
|
|
47436
47442
|
}
|
|
47443
|
+
var jitiInstance = null;
|
|
47444
|
+
var jitiModuleCache = /* @__PURE__ */ new Map();
|
|
47445
|
+
async function loadTsHandlerWithJiti(absolutePath) {
|
|
47446
|
+
const cached = jitiModuleCache.get(absolutePath);
|
|
47447
|
+
if (cached) return cached;
|
|
47448
|
+
if (!jitiInstance) {
|
|
47449
|
+
const { createJiti } = await import("jiti");
|
|
47450
|
+
jitiInstance = createJiti(import.meta.url, { fsCache: false });
|
|
47451
|
+
}
|
|
47452
|
+
const mod = await jitiInstance.import(absolutePath);
|
|
47453
|
+
jitiModuleCache.set(absolutePath, mod);
|
|
47454
|
+
return mod;
|
|
47455
|
+
}
|
|
47437
47456
|
async function loadTypeScriptHandler(absolutePath) {
|
|
47438
47457
|
let mod;
|
|
47439
47458
|
if (viteServer) {
|
|
@@ -47441,8 +47460,7 @@ async function loadTypeScriptHandler(absolutePath) {
|
|
|
47441
47460
|
if (module) viteServer.moduleGraph.invalidateModule(module);
|
|
47442
47461
|
mod = await viteServer.ssrLoadModule(absolutePath);
|
|
47443
47462
|
} else {
|
|
47444
|
-
|
|
47445
|
-
mod = await import(pathToFileURL(absolutePath).href);
|
|
47463
|
+
mod = await loadTsHandlerWithJiti(absolutePath);
|
|
47446
47464
|
}
|
|
47447
47465
|
const handler = mod.default;
|
|
47448
47466
|
if (typeof handler !== "function") {
|
package/dist/vite-plugin.js
CHANGED
|
@@ -47460,7 +47460,10 @@ function squadbasePlugin(options = {}) {
|
|
|
47460
47460
|
"@aws-sdk/client-cost-explorer",
|
|
47461
47461
|
"@aws-sdk/client-redshift-data",
|
|
47462
47462
|
"@google-analytics/data",
|
|
47463
|
-
"@kintone/rest-api-client"
|
|
47463
|
+
"@kintone/rest-api-client",
|
|
47464
|
+
// jiti はランタイムで server-logic/*.ts をトランスパイルするため、
|
|
47465
|
+
// @hono/vite-build がサーバービルドにバンドルしないよう external にする。
|
|
47466
|
+
"jiti"
|
|
47464
47467
|
],
|
|
47465
47468
|
exclude = DEFAULT_EXCLUDE
|
|
47466
47469
|
} = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squadbase/vite-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19-dev.a00d9c3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -322,10 +322,6 @@
|
|
|
322
322
|
"./connectors/hackernews": {
|
|
323
323
|
"import": "./dist/connectors/hackernews.js",
|
|
324
324
|
"types": "./dist/connectors/hackernews.d.ts"
|
|
325
|
-
},
|
|
326
|
-
"./connectors/slack": {
|
|
327
|
-
"import": "./dist/connectors/slack.js",
|
|
328
|
-
"types": "./dist/connectors/slack.d.ts"
|
|
329
325
|
}
|
|
330
326
|
},
|
|
331
327
|
"files": [
|
|
@@ -359,6 +355,7 @@
|
|
|
359
355
|
"@kintone/rest-api-client": "^5.5.0",
|
|
360
356
|
"google-auth-library": "^9.15.1",
|
|
361
357
|
"hono": "^4.12.25",
|
|
358
|
+
"jiti": "^2.7.0",
|
|
362
359
|
"mongodb": "^7.1.1",
|
|
363
360
|
"mssql": "^11.0.1",
|
|
364
361
|
"mysql2": "^3.11.0",
|