@ciderjs/gasnuki 0.5.3 → 0.5.4

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.ja.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @ciderjs/gasnuki
2
2
 
3
3
  [![README-en](https://img.shields.io/badge/English-blue?logo=ReadMe)](./README.md)
4
- [![Test Coverage](https://img.shields.io/badge/test%20coverage-89.02%25-green)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-91.22%25-brightgreen)](https://github.com/luthpg/gasnuki)
5
5
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
  [![npm version](https://img.shields.io/npm/v/@ciderjs/gasnuki.svg)](https://www.npmjs.com/package/@ciderjs/gasnuki)
7
- ![NPM Downloads](https://img.shields.io/npm/dw/@ciderjs/gasnuki)
7
+ [![NPM Downloads](https://img.shields.io/npm/dw/@ciderjs/gasnuki)](https://www.npmjs.com/package/@ciderjs/gasnuki)
8
8
  [![GitHub issues](https://img.shields.io/github/issues/luthpg/gasnuki.svg)](https://github.com/luthpg/gasnuki/issues)
9
9
 
10
10
  Google Apps Script クライアントサイドAPIの型定義・ユーティリティ
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @ciderjs/gasnuki
2
2
 
3
3
  [![README-ja](https://img.shields.io/badge/日本語-blue?logo=ReadMe)](./README.ja.md)
4
- [![Test Coverage](https://img.shields.io/badge/test%20coverage-89.02%25-green)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-91.22%25-brightgreen)](https://github.com/luthpg/gasnuki)
5
5
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
  [![npm version](https://img.shields.io/npm/v/@ciderjs/gasnuki.svg)](https://www.npmjs.com/package/@ciderjs/gasnuki)
7
- ![NPM Downloads](https://img.shields.io/npm/dw/@ciderjs/gasnuki)
7
+ [![NPM Downloads](https://img.shields.io/npm/dw/@ciderjs/gasnuki)](https://www.npmjs.com/package/@ciderjs/gasnuki)
8
8
  [![GitHub issues](https://img.shields.io/github/issues/luthpg/gasnuki.svg)](https://github.com/luthpg/gasnuki/issues)
9
9
 
10
10
  Type definitions and utilities for Google Apps Script client-side API
package/dist/cli.cjs CHANGED
@@ -4,7 +4,7 @@
4
4
  const path = require('node:path');
5
5
  const commander = require('commander');
6
6
  const index = require('./index.cjs');
7
- const config = require('./shared/gasnuki.CDe7f-cZ.cjs');
7
+ const config = require('./shared/gasnuki.D2FZdJSt.cjs');
8
8
  require('chokidar');
9
9
  require('consola');
10
10
  require('node:crypto');
@@ -26,7 +26,7 @@ function _interopNamespaceCompat(e) {
26
26
 
27
27
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
28
28
 
29
- const version = "0.5.3";
29
+ const version = "0.5.4";
30
30
 
31
31
  const parseArgs = async (command) => {
32
32
  const cliOpts = command.opts();
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as path from 'node:path';
3
3
  import { Command } from 'commander';
4
4
  import { generateTypes } from './index.mjs';
5
- import { l as loadConfig } from './shared/gasnuki.BAmTBfMa.mjs';
5
+ import { l as loadConfig } from './shared/gasnuki.Ee5cF3d4.mjs';
6
6
  import 'chokidar';
7
7
  import 'consola';
8
8
  import 'node:crypto';
@@ -10,7 +10,7 @@ import 'node:fs';
10
10
  import 'ts-morph';
11
11
  import 'jiti';
12
12
 
13
- const version = "0.5.3";
13
+ const version = "0.5.4";
14
14
 
15
15
  const parseArgs = async (command) => {
16
16
  const cliOpts = command.opts();
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  const path = require('node:path');
4
4
  const chokidar = require('chokidar');
5
5
  const consola = require('consola');
6
- const config = require('./shared/gasnuki.CDe7f-cZ.cjs');
6
+ const config = require('./shared/gasnuki.D2FZdJSt.cjs');
7
7
  require('node:crypto');
8
8
  require('node:fs');
9
9
  require('ts-morph');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as path from 'node:path';
2
2
  import * as chokidar from 'chokidar';
3
3
  import { consola } from 'consola';
4
- import { g as generateAppsScriptTypes } from './shared/gasnuki.BAmTBfMa.mjs';
5
- export { d as defineConfig } from './shared/gasnuki.BAmTBfMa.mjs';
4
+ import { g as generateAppsScriptTypes } from './shared/gasnuki.Ee5cF3d4.mjs';
5
+ export { d as defineConfig } from './shared/gasnuki.Ee5cF3d4.mjs';
6
6
  import 'node:crypto';
7
7
  import 'node:fs';
8
8
  import 'ts-morph';
@@ -123,15 +123,18 @@ const findPackageJson_ = (startDir) => {
123
123
  return null;
124
124
  };
125
125
  const matchesExportValue_ = (node, targetPath) => {
126
+ const normalize = (p) => p.startsWith(".") ? p : `./${p}`;
127
+ const normalizedTarget = normalize(targetPath);
126
128
  if (typeof node === "string") {
127
- return node === targetPath || node === targetPath.replace(/\.d\.ts$/, ".js");
129
+ const normalizedNode = normalize(node);
130
+ return normalizedNode === normalizedTarget || normalizedNode === normalizedTarget.replace(/\.d\.ts$/, ".js");
128
131
  }
129
132
  if (typeof node === "object" && node !== null) {
130
- if (node.types && node.types === targetPath) {
133
+ if (node.types && matchesExportValue_(node.types, targetPath)) {
131
134
  return true;
132
135
  }
133
136
  for (const key in node) {
134
- if (matchesExportValue_(node[key], targetPath)) {
137
+ if (key !== "types" && matchesExportValue_(node[key], targetPath)) {
135
138
  return true;
136
139
  }
137
140
  }
@@ -155,7 +158,13 @@ const resolveNodeModuleSpecifier_ = (filePath) => {
155
158
  const exportValue = pkg.content.exports[key];
156
159
  if (matchesExportValue_(exportValue, relativePath)) {
157
160
  if (key === ".") return packageName;
158
- return path__namespace.posix.join(packageName, key);
161
+ const subPath = key.startsWith("./") ? key.slice(2) : key;
162
+ console.log(`[gasnuki] Matched key: ${key}, subPath: ${subPath}`);
163
+ return `${packageName}/${subPath}`;
164
+ } else {
165
+ console.log(
166
+ `[gasnuki] No match for ${key}: ${JSON.stringify(exportValue)} vs ${relativePath} (pkgRoot: ${packageRoot}, file: ${filePath})`
167
+ );
159
168
  }
160
169
  }
161
170
  }
@@ -105,15 +105,18 @@ const findPackageJson_ = (startDir) => {
105
105
  return null;
106
106
  };
107
107
  const matchesExportValue_ = (node, targetPath) => {
108
+ const normalize = (p) => p.startsWith(".") ? p : `./${p}`;
109
+ const normalizedTarget = normalize(targetPath);
108
110
  if (typeof node === "string") {
109
- return node === targetPath || node === targetPath.replace(/\.d\.ts$/, ".js");
111
+ const normalizedNode = normalize(node);
112
+ return normalizedNode === normalizedTarget || normalizedNode === normalizedTarget.replace(/\.d\.ts$/, ".js");
110
113
  }
111
114
  if (typeof node === "object" && node !== null) {
112
- if (node.types && node.types === targetPath) {
115
+ if (node.types && matchesExportValue_(node.types, targetPath)) {
113
116
  return true;
114
117
  }
115
118
  for (const key in node) {
116
- if (matchesExportValue_(node[key], targetPath)) {
119
+ if (key !== "types" && matchesExportValue_(node[key], targetPath)) {
117
120
  return true;
118
121
  }
119
122
  }
@@ -137,7 +140,13 @@ const resolveNodeModuleSpecifier_ = (filePath) => {
137
140
  const exportValue = pkg.content.exports[key];
138
141
  if (matchesExportValue_(exportValue, relativePath)) {
139
142
  if (key === ".") return packageName;
140
- return path.posix.join(packageName, key);
143
+ const subPath = key.startsWith("./") ? key.slice(2) : key;
144
+ console.log(`[gasnuki] Matched key: ${key}, subPath: ${subPath}`);
145
+ return `${packageName}/${subPath}`;
146
+ } else {
147
+ console.log(
148
+ `[gasnuki] No match for ${key}: ${JSON.stringify(exportValue)} vs ${relativePath} (pkgRoot: ${packageRoot}, file: ${filePath})`
149
+ );
141
150
  }
142
151
  }
143
152
  }
package/dist/vite.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const path = require('node:path');
4
4
  const consola = require('consola');
5
- const config = require('./shared/gasnuki.CDe7f-cZ.cjs');
5
+ const config = require('./shared/gasnuki.D2FZdJSt.cjs');
6
6
  require('node:crypto');
7
7
  require('node:fs');
8
8
  require('ts-morph');
@@ -54,31 +54,41 @@ function gasnuki(options) {
54
54
  name: "vite-plugin-gasnuki",
55
55
  apply: "serve",
56
56
  // Apply only in serve mode
57
- async configResolved(config$1) {
58
- projectRoot = config$1.root;
59
- const fileConfig = await config.loadConfig(projectRoot);
60
- const defaultOptions = {
61
- srcDir: "server",
62
- outDir: "types",
63
- outputFile: "appsscript.ts"
64
- };
65
- gasnukiOptions = {
66
- ...defaultOptions,
67
- ...fileConfig,
68
- ...options || {}
69
- };
57
+ async configResolved(config) {
58
+ projectRoot = config.root;
59
+ await reloadOptions();
70
60
  },
71
61
  async configureServer(server) {
72
- const targetDir = path__namespace.resolve(projectRoot, gasnukiOptions.srcDir);
73
- runGeneration("server startup");
74
- server.watcher.on("all", (_event, filePath) => {
62
+ server.watcher.on("all", async (_event, filePath) => {
63
+ const fileName = path__namespace.basename(filePath);
64
+ if (fileName.startsWith("gasnuki.config.")) {
65
+ consola.consola.info("[gasnuki] Config file changed, reloading...");
66
+ await reloadOptions();
67
+ runGeneration("config change");
68
+ return;
69
+ }
70
+ const targetDir = path__namespace.resolve(projectRoot, gasnukiOptions.srcDir);
75
71
  const relativePath = path__namespace.relative(targetDir, filePath);
76
72
  if (!relativePath.startsWith("..") && relativePath !== "..") {
77
73
  runGeneration(path__namespace.relative(projectRoot, filePath));
78
74
  }
79
75
  });
76
+ runGeneration("server startup");
80
77
  }
81
78
  };
79
+ async function reloadOptions() {
80
+ const fileConfig = await config.loadConfig(projectRoot);
81
+ const defaultOptions = {
82
+ srcDir: "server",
83
+ outDir: "types",
84
+ outputFile: "appsscript.ts"
85
+ };
86
+ gasnukiOptions = {
87
+ ...defaultOptions,
88
+ ...fileConfig,
89
+ ...options || {}
90
+ };
91
+ }
82
92
  }
83
93
 
84
94
  exports.gasnuki = gasnuki;
package/dist/vite.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as path from 'node:path';
2
2
  import { consola } from 'consola';
3
- import { l as loadConfig, g as generateAppsScriptTypes } from './shared/gasnuki.BAmTBfMa.mjs';
3
+ import { l as loadConfig, g as generateAppsScriptTypes } from './shared/gasnuki.Ee5cF3d4.mjs';
4
4
  import 'node:crypto';
5
5
  import 'node:fs';
6
6
  import 'ts-morph';
@@ -40,29 +40,39 @@ function gasnuki(options) {
40
40
  // Apply only in serve mode
41
41
  async configResolved(config) {
42
42
  projectRoot = config.root;
43
- const fileConfig = await loadConfig(projectRoot);
44
- const defaultOptions = {
45
- srcDir: "server",
46
- outDir: "types",
47
- outputFile: "appsscript.ts"
48
- };
49
- gasnukiOptions = {
50
- ...defaultOptions,
51
- ...fileConfig,
52
- ...options || {}
53
- };
43
+ await reloadOptions();
54
44
  },
55
45
  async configureServer(server) {
56
- const targetDir = path.resolve(projectRoot, gasnukiOptions.srcDir);
57
- runGeneration("server startup");
58
- server.watcher.on("all", (_event, filePath) => {
46
+ server.watcher.on("all", async (_event, filePath) => {
47
+ const fileName = path.basename(filePath);
48
+ if (fileName.startsWith("gasnuki.config.")) {
49
+ consola.info("[gasnuki] Config file changed, reloading...");
50
+ await reloadOptions();
51
+ runGeneration("config change");
52
+ return;
53
+ }
54
+ const targetDir = path.resolve(projectRoot, gasnukiOptions.srcDir);
59
55
  const relativePath = path.relative(targetDir, filePath);
60
56
  if (!relativePath.startsWith("..") && relativePath !== "..") {
61
57
  runGeneration(path.relative(projectRoot, filePath));
62
58
  }
63
59
  });
60
+ runGeneration("server startup");
64
61
  }
65
62
  };
63
+ async function reloadOptions() {
64
+ const fileConfig = await loadConfig(projectRoot);
65
+ const defaultOptions = {
66
+ srcDir: "server",
67
+ outDir: "types",
68
+ outputFile: "appsscript.ts"
69
+ };
70
+ gasnukiOptions = {
71
+ ...defaultOptions,
72
+ ...fileConfig,
73
+ ...options || {}
74
+ };
75
+ }
66
76
  }
67
77
 
68
78
  export { gasnuki };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciderjs/gasnuki",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Type definitions and utilities for Google Apps Script client-side API",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",