pangu
Version:
Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).
1 lines • 1.67 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../../src/node/index.cjs.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports */\nconst { Pangu } = require('../shared/index.cjs');\nconst { readFileSync } = require('node:fs');\nconst { readFile } = require('node:fs/promises');\n/* eslint-enable @typescript-eslint/no-require-imports */\n\n// Re-implement NodePangu here to avoid circular imports\nclass NodePangu extends Pangu {\n async spacingFile(path: string) {\n const data = await readFile(path, 'utf8');\n return this.spacingText(data);\n }\n\n spacingFileSync(path: string) {\n return this.spacingText(readFileSync(path, 'utf8'));\n }\n}\n\n// Create the pangu instance\nconst pangu = new NodePangu();\n\n// Add named exports as properties on the instance\n// This allows both: const pangu = require('pangu') AND const { NodePangu } = require('pangu')\n/* eslint-disable @typescript-eslint/no-explicit-any */\n(pangu as any).NodePangu = NodePangu;\n(pangu as any).pangu = pangu;\n(pangu as any).default = pangu;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\n// Export pangu instance as the module\n// @ts-expect-error - Using CommonJS export for compatibility\nexport = pangu;\n"],"names":[],"mappings":";AACA,MAAM,EAAE,MAAA,IAAU,QAAQ,qBAAqB;AAC/C,MAAM,EAAE,aAAA,IAAiB,QAAQ,SAAS;AAC1C,MAAM,EAAE,SAAA,IAAa,QAAQ,kBAAkB;AAI/C,MAAM,kBAAkB,MAAM;AAAA,EAC5B,MAAM,YAAY,MAAc;AAC9B,UAAM,OAAO,MAAM,SAAS,MAAM,MAAM;AACjC,WAAA,KAAK,YAAY,IAAI;AAAA,EAAA;AAAA,EAG9B,gBAAgB,MAAc;AAC5B,WAAO,KAAK,YAAY,aAAa,MAAM,MAAM,CAAC;AAAA,EAAA;AAEtD;AAGA,MAAM,QAAQ,IAAI,UAAU;AAK3B,MAAc,YAAY;AAC1B,MAAc,QAAQ;AACtB,MAAc,UAAU;AAKzB,OAAS,UAAA;"}