@ciderjs/gasnuki 0.3.7 → 0.3.8

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-93.77%25-brightgreen)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-93.63%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-93.77%25-brightgreen)](https://github.com/luthpg/gasnuki)
4
+ [![Test Coverage](https://img.shields.io/badge/test%20coverage-93.63%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.CooUv3Bz.cjs');
7
+ const config = require('./shared/gasnuki.BVdkJsiP.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.7";
28
+ const version = "0.3.8";
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.Md02V2Fd.mjs';
5
+ import { l as loadConfig } from './shared/gasnuki.Cd8JOTQ5.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.7";
12
+ const version = "0.3.8";
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.CooUv3Bz.cjs');
6
+ const config = require('./shared/gasnuki.BVdkJsiP.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.Md02V2Fd.mjs';
5
- export { d as defineConfig } from './shared/gasnuki.Md02V2Fd.mjs';
4
+ import { g as generateAppsScriptTypes } from './shared/gasnuki.Cd8JOTQ5.mjs';
5
+ export { d as defineConfig } from './shared/gasnuki.Cd8JOTQ5.mjs';
6
6
  import 'node:fs';
7
7
  import 'ts-morph';
8
8
  import 'jiti';
@@ -354,24 +354,9 @@ const generateAppsScriptTypes = async ({
354
354
  // Do NOT edit this file manually.
355
355
 
356
356
  `;
357
- const sortedModulePaths = [...importsMap.keys()].sort((a, b) => {
358
- const aIsRelative = a.startsWith(".");
359
- const bIsRelative = b.startsWith(".");
360
- if (aIsRelative !== bIsRelative) return aIsRelative ? 1 : -1;
361
- return a.localeCompare(b);
362
- });
363
- if (sortedModulePaths.length > 0) {
364
- const importStatements = sortedModulePaths.map((modulePath) => {
365
- const imports = [...importsMap.get(modulePath) ?? []].sort();
366
- const finalModulePath = modulePath === "." ? "./index" : modulePath;
367
- return `import type { ${imports.join(", ")} } from '${finalModulePath}';`;
368
- });
369
- outputContent += `${importStatements.join("\n")}
370
-
371
- `;
372
- }
357
+ let bodyContent = "";
373
358
  if (inlineDefinitions.size > 0) {
374
- outputContent += `${[...inlineDefinitions.values()].join("\n\n")}
359
+ bodyContent += `${[...inlineDefinitions.values()].join("\n\n")}
375
360
 
376
361
  `;
377
362
  }
@@ -379,7 +364,7 @@ const generateAppsScriptTypes = async ({
379
364
  (d) => d.getKind() === tsMorph.SyntaxKind.InterfaceDeclaration || d.getKind() === tsMorph.SyntaxKind.TypeAliasDeclaration
380
365
  ).map((decl) => decl.getText());
381
366
  if (exportedTypeDefinitions.length > 0) {
382
- outputContent += `${exportedTypeDefinitions.join("\n\n")}
367
+ bodyContent += `${exportedTypeDefinitions.join("\n\n")}
383
368
 
384
369
  `;
385
370
  }
@@ -387,7 +372,7 @@ const generateAppsScriptTypes = async ({
387
372
  const formattedMethods = methodDefinitions.map(
388
373
  (method) => method.split("\n").map((line) => ` ${line}`).join("\n")
389
374
  ).join("\n\n");
390
- outputContent += `export type ServerScripts = {
375
+ bodyContent += `export type ServerScripts = {
391
376
  ${formattedMethods}
392
377
  }
393
378
  `;
@@ -395,15 +380,40 @@ ${formattedMethods}
395
380
  `Interface 'ServerScript' type definitions written to ${absoluteOutputFile} (${methodDefinitions.length} function(s), ${exportedTypeDefinitions.length + inlineDefinitions.size} type(s)).`
396
381
  );
397
382
  } else {
398
- outputContent += "export type ServerScripts = {}\n";
383
+ bodyContent += "export type ServerScripts = {}\n";
399
384
  consola.consola.info(
400
385
  `Interface 'ServerScript' type definitions written to ${absoluteOutputFile} (no functions found).`
401
386
  );
402
387
  }
403
- outputContent += `
388
+ bodyContent += `
404
389
  // Auto-generated Types for GoogleAppsScript in client-side code
405
390
 
406
391
  ${text}`;
392
+ const sortedModulePaths = [...importsMap.keys()].sort((a, b) => {
393
+ const aIsRelative = a.startsWith(".");
394
+ const bIsRelative = b.startsWith(".");
395
+ if (aIsRelative !== bIsRelative) return aIsRelative ? 1 : -1;
396
+ return a.localeCompare(b);
397
+ });
398
+ if (sortedModulePaths.length > 0) {
399
+ const importStatements = sortedModulePaths.map((modulePath) => {
400
+ const imports = [...importsMap.get(modulePath) ?? []].sort().filter((importName) => {
401
+ const regex = new RegExp(`\\b${importName}\\b`);
402
+ return regex.test(bodyContent);
403
+ });
404
+ if (imports.length === 0) {
405
+ return null;
406
+ }
407
+ const finalModulePath = modulePath === "." ? "./index" : modulePath;
408
+ return `import type { ${imports.join(", ")} } from '${finalModulePath}';`;
409
+ }).filter((s) => s !== null);
410
+ if (importStatements.length > 0) {
411
+ outputContent += `${importStatements.join("\n")}
412
+
413
+ `;
414
+ }
415
+ }
416
+ outputContent += bodyContent;
407
417
  fs__namespace.writeFileSync(absoluteOutputFile, outputContent);
408
418
  };
409
419
 
@@ -337,24 +337,9 @@ const generateAppsScriptTypes = async ({
337
337
  // Do NOT edit this file manually.
338
338
 
339
339
  `;
340
- const sortedModulePaths = [...importsMap.keys()].sort((a, b) => {
341
- const aIsRelative = a.startsWith(".");
342
- const bIsRelative = b.startsWith(".");
343
- if (aIsRelative !== bIsRelative) return aIsRelative ? 1 : -1;
344
- return a.localeCompare(b);
345
- });
346
- if (sortedModulePaths.length > 0) {
347
- const importStatements = sortedModulePaths.map((modulePath) => {
348
- const imports = [...importsMap.get(modulePath) ?? []].sort();
349
- const finalModulePath = modulePath === "." ? "./index" : modulePath;
350
- return `import type { ${imports.join(", ")} } from '${finalModulePath}';`;
351
- });
352
- outputContent += `${importStatements.join("\n")}
353
-
354
- `;
355
- }
340
+ let bodyContent = "";
356
341
  if (inlineDefinitions.size > 0) {
357
- outputContent += `${[...inlineDefinitions.values()].join("\n\n")}
342
+ bodyContent += `${[...inlineDefinitions.values()].join("\n\n")}
358
343
 
359
344
  `;
360
345
  }
@@ -362,7 +347,7 @@ const generateAppsScriptTypes = async ({
362
347
  (d) => d.getKind() === SyntaxKind.InterfaceDeclaration || d.getKind() === SyntaxKind.TypeAliasDeclaration
363
348
  ).map((decl) => decl.getText());
364
349
  if (exportedTypeDefinitions.length > 0) {
365
- outputContent += `${exportedTypeDefinitions.join("\n\n")}
350
+ bodyContent += `${exportedTypeDefinitions.join("\n\n")}
366
351
 
367
352
  `;
368
353
  }
@@ -370,7 +355,7 @@ const generateAppsScriptTypes = async ({
370
355
  const formattedMethods = methodDefinitions.map(
371
356
  (method) => method.split("\n").map((line) => ` ${line}`).join("\n")
372
357
  ).join("\n\n");
373
- outputContent += `export type ServerScripts = {
358
+ bodyContent += `export type ServerScripts = {
374
359
  ${formattedMethods}
375
360
  }
376
361
  `;
@@ -378,15 +363,40 @@ ${formattedMethods}
378
363
  `Interface 'ServerScript' type definitions written to ${absoluteOutputFile} (${methodDefinitions.length} function(s), ${exportedTypeDefinitions.length + inlineDefinitions.size} type(s)).`
379
364
  );
380
365
  } else {
381
- outputContent += "export type ServerScripts = {}\n";
366
+ bodyContent += "export type ServerScripts = {}\n";
382
367
  consola.info(
383
368
  `Interface 'ServerScript' type definitions written to ${absoluteOutputFile} (no functions found).`
384
369
  );
385
370
  }
386
- outputContent += `
371
+ bodyContent += `
387
372
  // Auto-generated Types for GoogleAppsScript in client-side code
388
373
 
389
374
  ${text}`;
375
+ const sortedModulePaths = [...importsMap.keys()].sort((a, b) => {
376
+ const aIsRelative = a.startsWith(".");
377
+ const bIsRelative = b.startsWith(".");
378
+ if (aIsRelative !== bIsRelative) return aIsRelative ? 1 : -1;
379
+ return a.localeCompare(b);
380
+ });
381
+ if (sortedModulePaths.length > 0) {
382
+ const importStatements = sortedModulePaths.map((modulePath) => {
383
+ const imports = [...importsMap.get(modulePath) ?? []].sort().filter((importName) => {
384
+ const regex = new RegExp(`\\b${importName}\\b`);
385
+ return regex.test(bodyContent);
386
+ });
387
+ if (imports.length === 0) {
388
+ return null;
389
+ }
390
+ const finalModulePath = modulePath === "." ? "./index" : modulePath;
391
+ return `import type { ${imports.join(", ")} } from '${finalModulePath}';`;
392
+ }).filter((s) => s !== null);
393
+ if (importStatements.length > 0) {
394
+ outputContent += `${importStatements.join("\n")}
395
+
396
+ `;
397
+ }
398
+ }
399
+ outputContent += bodyContent;
390
400
  fs.writeFileSync(absoluteOutputFile, outputContent);
391
401
  };
392
402
 
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.CooUv3Bz.cjs');
5
+ const config = require('./shared/gasnuki.BVdkJsiP.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.Md02V2Fd.mjs';
3
+ import { l as loadConfig, g as generateAppsScriptTypes } from './shared/gasnuki.Cd8JOTQ5.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.7",
3
+ "version": "0.3.8",
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",