@ciderjs/gasnuki 0.3.3 → 0.3.5

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,7 +1,7 @@
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-95.15%25-brightgreen)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-95.4%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
7
  [![GitHub issues](https://img.shields.io/github/issues/luthpg/gasnuki.svg)](https://github.com/luthpg/gasnuki/issues)
package/README.md CHANGED
@@ -1,7 +1,7 @@
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-95.15%25-brightgreen)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-95.4%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
7
  [![GitHub issues](https://img.shields.io/github/issues/luthpg/gasnuki.svg)](https://github.com/luthpg/gasnuki/issues)
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.D8w16Lbm.cjs');
7
+ const config = require('./shared/gasnuki.Cam3UO_N.cjs');
8
8
  require('chokidar');
9
9
  require('consola');
10
10
  require('node:fs');
@@ -25,7 +25,7 @@ function _interopNamespaceCompat(e) {
25
25
 
26
26
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
27
27
 
28
- const version = "0.3.3";
28
+ const version = "0.3.5";
29
29
 
30
30
  const parseArgs = async (command) => {
31
31
  const cliOpts = command.opts();
package/dist/cli.mjs CHANGED
@@ -2,14 +2,14 @@
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.D1fp3Uiw.mjs';
5
+ import { l as loadConfig } from './shared/gasnuki.HyFJZts6.mjs';
6
6
  import 'chokidar';
7
7
  import 'consola';
8
8
  import 'node:fs';
9
9
  import 'ts-morph';
10
10
  import 'jiti';
11
11
 
12
- const version = "0.3.3";
12
+ const version = "0.3.5";
13
13
 
14
14
  const parseArgs = async (command) => {
15
15
  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.D8w16Lbm.cjs');
6
+ const config = require('./shared/gasnuki.Cam3UO_N.cjs');
7
7
  require('node:fs');
8
8
  require('ts-morph');
9
9
  require('jiti');
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.D1fp3Uiw.mjs';
5
- export { d as defineConfig } from './shared/gasnuki.D1fp3Uiw.mjs';
4
+ import { g as generateAppsScriptTypes } from './shared/gasnuki.HyFJZts6.mjs';
5
+ export { d as defineConfig } from './shared/gasnuki.HyFJZts6.mjs';
6
6
  import 'node:fs';
7
7
  import 'ts-morph';
8
8
  import 'jiti';
@@ -156,13 +156,35 @@ const generateAppsScriptTypes = async ({
156
156
  }
157
157
  }
158
158
  const collectSymbolsFromType = (type, foundSymbols) => {
159
- const symbol = type.getAliasSymbol() ?? type.getSymbol();
159
+ const aliasSymbol = type.getAliasSymbol();
160
+ if (aliasSymbol) {
161
+ if (foundSymbols.has(aliasSymbol)) {
162
+ return;
163
+ }
164
+ foundSymbols.add(aliasSymbol);
165
+ for (const typeArg of type.getAliasTypeArguments()) {
166
+ collectSymbolsFromType(typeArg, foundSymbols);
167
+ }
168
+ }
169
+ const symbol = type.getSymbol();
160
170
  if (symbol && !foundSymbols.has(symbol)) {
161
171
  foundSymbols.add(symbol);
162
172
  if (type.isObject()) {
163
173
  for (const prop of type.getProperties()) {
164
174
  const propDecl = prop.getDeclarations()[0];
165
175
  if (propDecl) {
176
+ const compilerNode = propDecl.compilerNode;
177
+ if (
178
+ // @ts-expect-error - avoiding full type checks for perf, checking kind directly
179
+ compilerNode.name && // @ts-expect-error - avoiding full type checks for perf, checking kind directly
180
+ compilerNode.name.kind === tsMorph.SyntaxKind.ComputedPropertyName
181
+ ) {
182
+ const expression = propDecl.getNameNode().getExpression();
183
+ const symbol2 = expression.getSymbol();
184
+ if (symbol2 && !foundSymbols.has(symbol2)) {
185
+ foundSymbols.add(symbol2);
186
+ }
187
+ }
166
188
  collectSymbolsFromType(propDecl.getType(), foundSymbols);
167
189
  }
168
190
  }
@@ -258,7 +280,13 @@ const generateAppsScriptTypes = async ({
258
280
  }
259
281
  importsMap.get(modulePath)?.add(symbolName);
260
282
  } else {
261
- const declText = declaration.getText();
283
+ let declText = declaration.getText();
284
+ if (declaration.getKind() === tsMorph.SyntaxKind.VariableDeclaration) {
285
+ const variableStatement = declaration.getParent()?.getParent();
286
+ if (variableStatement && variableStatement.getKind() === tsMorph.SyntaxKind.VariableStatement) {
287
+ declText = variableStatement.getText();
288
+ }
289
+ }
262
290
  inlineDefinitions.set(symbolName, declText);
263
291
  }
264
292
  for (const descendant of declaration.getDescendantsOfKind(
@@ -139,13 +139,35 @@ const generateAppsScriptTypes = async ({
139
139
  }
140
140
  }
141
141
  const collectSymbolsFromType = (type, foundSymbols) => {
142
- const symbol = type.getAliasSymbol() ?? type.getSymbol();
142
+ const aliasSymbol = type.getAliasSymbol();
143
+ if (aliasSymbol) {
144
+ if (foundSymbols.has(aliasSymbol)) {
145
+ return;
146
+ }
147
+ foundSymbols.add(aliasSymbol);
148
+ for (const typeArg of type.getAliasTypeArguments()) {
149
+ collectSymbolsFromType(typeArg, foundSymbols);
150
+ }
151
+ }
152
+ const symbol = type.getSymbol();
143
153
  if (symbol && !foundSymbols.has(symbol)) {
144
154
  foundSymbols.add(symbol);
145
155
  if (type.isObject()) {
146
156
  for (const prop of type.getProperties()) {
147
157
  const propDecl = prop.getDeclarations()[0];
148
158
  if (propDecl) {
159
+ const compilerNode = propDecl.compilerNode;
160
+ if (
161
+ // @ts-expect-error - avoiding full type checks for perf, checking kind directly
162
+ compilerNode.name && // @ts-expect-error - avoiding full type checks for perf, checking kind directly
163
+ compilerNode.name.kind === SyntaxKind.ComputedPropertyName
164
+ ) {
165
+ const expression = propDecl.getNameNode().getExpression();
166
+ const symbol2 = expression.getSymbol();
167
+ if (symbol2 && !foundSymbols.has(symbol2)) {
168
+ foundSymbols.add(symbol2);
169
+ }
170
+ }
149
171
  collectSymbolsFromType(propDecl.getType(), foundSymbols);
150
172
  }
151
173
  }
@@ -241,7 +263,13 @@ const generateAppsScriptTypes = async ({
241
263
  }
242
264
  importsMap.get(modulePath)?.add(symbolName);
243
265
  } else {
244
- const declText = declaration.getText();
266
+ let declText = declaration.getText();
267
+ if (declaration.getKind() === SyntaxKind.VariableDeclaration) {
268
+ const variableStatement = declaration.getParent()?.getParent();
269
+ if (variableStatement && variableStatement.getKind() === SyntaxKind.VariableStatement) {
270
+ declText = variableStatement.getText();
271
+ }
272
+ }
245
273
  inlineDefinitions.set(symbolName, declText);
246
274
  }
247
275
  for (const descendant of declaration.getDescendantsOfKind(
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.D8w16Lbm.cjs');
5
+ const config = require('./shared/gasnuki.Cam3UO_N.cjs');
6
6
  require('node:fs');
7
7
  require('ts-morph');
8
8
  require('jiti');
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.D1fp3Uiw.mjs';
3
+ import { l as loadConfig, g as generateAppsScriptTypes } from './shared/gasnuki.HyFJZts6.mjs';
4
4
  import 'node:fs';
5
5
  import 'ts-morph';
6
6
  import 'jiti';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciderjs/gasnuki",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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",
@@ -62,13 +62,13 @@
62
62
  "ts-morph": "^27.0.2"
63
63
  },
64
64
  "devDependencies": {
65
- "@biomejs/biome": "^2.3.8",
66
- "@types/node": "^25.0.1",
67
- "@vitest/coverage-v8": "4.0.15",
65
+ "@biomejs/biome": "^2.3.10",
66
+ "@types/node": "^25.0.3",
67
+ "@vitest/coverage-v8": "4.0.16",
68
68
  "typescript": "^5.9.3",
69
69
  "unbuild": "^3.6.1",
70
- "vite": "^7.2.7",
71
- "vitest": "4.0.15"
70
+ "vite": "^7.3.0",
71
+ "vitest": "4.0.16"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "vite": "^7"