@yarn-tool/static-file 3.0.33 → 3.0.35

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +2 -2
  3. package/file/gitignore +16 -13
  4. package/file/npmignore +79 -14
  5. package/lib/const.d.ts +18 -1
  6. package/lib/const.js +20 -2
  7. package/lib/const.js.map +1 -1
  8. package/lib/copyStaticFilesByRootData.d.ts +52 -0
  9. package/lib/copyStaticFilesByRootData.js +53 -0
  10. package/lib/copyStaticFilesByRootData.js.map +1 -0
  11. package/lib/root/getRootCopyStaticFiles.d.ts +2 -1
  12. package/lib/root/getRootCopyStaticFiles.js +10 -0
  13. package/lib/root/getRootCopyStaticFiles.js.map +1 -1
  14. package/package.json +5 -3
  15. package/playwright.config.js.map +1 -0
  16. package/test/copyStaticFiles.test.js.map +1 -1
  17. package/test/copyStaticFiles.test.ts.snapshot +2 -22
  18. package/test/copyStaticFilesByRootData.test.js.map +1 -0
  19. package/test/copyStaticFilesByRootData.test.ts.snapshot +639 -0
  20. package/test/fixtures/empty-pkg/package.json +4 -0
  21. package/test/fixtures/out/gitignore +16 -13
  22. package/test/fixtures/out/npmignore +79 -14
  23. package/test/fixtures/split/git/00-header.txt +1 -1
  24. package/test/fixtures/split/git/10-project.txt +1 -1
  25. package/test/fixtures/split/git/20-test.txt +1 -1
  26. package/test/fixtures/split/git/40-env.txt +1 -1
  27. package/test/fixtures/split/git/90-misc.txt +1 -1
  28. package/test/fixtures/split/git/99-whitelist.txt +1 -1
  29. package/test/fixtures/split/npm/01-hidden.txt +1 -1
  30. package/test/fixtures/split/npm/05-source.txt +1 -1
  31. package/test/fixtures/split/npm/10-project.txt +1 -1
  32. package/test/fixtures/split/npm/20-test.txt +3 -1
  33. package/test/fixtures/split/npm/30-ide.txt +1 -1
  34. package/test/fixtures/split/npm/40-env.txt +1 -1
  35. package/test/fixtures/split/npm/90-misc.txt +1 -1
  36. package/test/fixtures/split/other/90-duplicates.txt +2 -2
  37. package/test/fixtures/split/shared/10-project.txt +1 -1
  38. package/test/fixtures/split/shared/20-test.txt +4 -1
  39. package/test/fixtures/split/shared/30-ide.txt +1 -1
  40. package/test/fixtures/split/shared/40-env.txt +1 -1
  41. package/test/fixtures/split/shared/90-misc.txt +1 -1
  42. package/test/scripts/compose-split-ignore-files.js +1 -1
  43. package/test/scripts/compose-split-ignore-files.js.map +1 -1
  44. package/test/scripts/lib/ignore-split.d.ts +24 -64
  45. package/test/scripts/lib/ignore-split.js +41 -75
  46. package/test/scripts/lib/ignore-split.js.map +1 -1
  47. package/test/scripts/split-ignore-files.js +19 -19
  48. package/test/scripts/split-ignore-files.js.map +1 -1
  49. package/test/scripts/update-npmignore-static-files.js +25 -2
  50. package/test/scripts/update-npmignore-static-files.js.map +1 -1
  51. package/file/playwright.config.ts +0 -6
  52. package/file/test/__root.js.map +0 -1
  53. package/file/test/temp.js.map +0 -1
  54. package/file/tsdx/index.cjs.map +0 -1
  55. package/file/tsdx/index.js.map +0 -1
  56. package/file/ws-root/__root_ws.js.map +0 -1
@@ -103,10 +103,33 @@ function main() {
103
103
  staticFiles.push('test/fixtures/out/**');
104
104
  staticFiles.push('test/fixtures/split/**');
105
105
  console.log(`Found ${staticFiles.length} static files:`);
106
- const entries = staticFiles.sort().map(f => {
106
+ const entries = [];
107
+ [
108
+ 'file/playwright.config.d.ts',
109
+ 'file/playwright.config.js',
110
+ 'file/playwright.config.js.map',
111
+ 'file/ws-root/__root_ws.d.ts',
112
+ 'file/ws-root/__root_ws.js',
113
+ 'file/ws-root/__root_ws.js.map',
114
+ 'file/tsdx/index.cjs',
115
+ 'file/tsdx/index.cjs.map',
116
+ 'file/tsdx/index.d.cts',
117
+ 'file/tsdx/index.js',
118
+ 'file/tsdx/index.js.map',
119
+ 'file/tsdx/index.d.ts',
120
+ 'file/test/__root.d.ts',
121
+ 'file/test/__root.js',
122
+ 'file/test/__root.js.map',
123
+ 'file/test/temp.d.ts',
124
+ 'file/test/temp.js',
125
+ 'file/test/temp.js.map',
126
+ ].forEach(entry => {
127
+ entries.push(entry);
128
+ });
129
+ staticFiles.sort().forEach(f => {
107
130
  const entry = `!${f}`;
108
131
  console.log(` ${entry}`);
109
- return entry;
132
+ entries.push(entry);
110
133
  });
111
134
  const npmIgnore = path.join(__root_1.__ROOT, '.npmignore');
112
135
  const gitIgnore = path.join(__root_1.__ROOT, '.gitignore');
@@ -1 +1 @@
1
- {"version":3,"file":"update-npmignore-static-files.js","sourceRoot":"","sources":["update-npmignore-static-files.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,mDAA6B;AAC7B,iEAA8D;AAC9D,sCAAmC;AACnC,2CAIyB;AACzB,qDAAkE;AAElE;;;GAGG;AACH,MAAM,MAAM,GAAG,8BAA8B,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD;;;;;;;;GAQG;AACH,SAAS,kBAAkB;IAE1B,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC;;;;;OAKG;IACH,MAAM,SAAS,GAAG;QACjB,GAAG,8BAAsB;QACzB,GAAG,sCAA8B;QACjC,GAAG,wCAAgC;QACnC,GAAG,uCAA0B;KAC7B,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,SAAS,EAC7B,CAAC;QACA,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5B;;;WAGG;QACH,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EACrC,CAAC;YACA,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,gBAAgB,CAAC,QAAgB,EAAE,WAAqB;IAGhE;;;OAGG;IACH,MAAM,UAAU,GAAG,uBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE;Q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AE,YAAY,CAAC,CAAC;IAElD;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC;IAEtC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,SAAS,EAAE,CAAC,CAAC;AACrC,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["/**\n * Script to extract staticFile values from const.ts\n * and add them as !<file> entries to .npmignore and .gitignore\n *\n * 腳本從 const.ts 提取 staticFile 值\n * 並將它們作為 !<file> 條目加入 .npmignore 和 .gitignore\n *\n * 讀取與保存皆透過 IgnoreFile(行陣列模型:支援陣列內容,EOF 換行自動還原)\n * Reading and saving both go through IgnoreFile (the line model: array content\n * is supported and the EOF newline is restored automatically)\n */\nimport * as path from 'path';\nimport { IgnoreFile } from '@yarn-tool/ignore/lib/IgnoreFile';\nimport { __ROOT } from '../__root';\nimport {\n\tdefaultCopyStaticFiles,\n\tdefaultCopyStaticFilesRootOnly,\n\tdefaultCopyStaticFilesWsRootOnly,\n} from '../../lib/const';\nimport { defaultCopyStaticFilesTsdx } from '../../lib/const-tsdx';\n\n/**\n * 生成區段的起始標記,用於識別並替換上一次產生的內容\n * Start marker of the generated section, used to locate and replace the previous run's output\n */\nconst HEADER = '# Static files from const.ts';\n\n/**\n * 生成區段的結束標記\n * End marker of the generated section\n */\nconst FOOTER = '# END Static files from const.ts';\n\n/**\n * 收集三份清單中所有不重複的 staticFile 來源路徑\n * Collect every unique staticFile source path across the three lists\n *\n * 以 includes 去重,確保 ignore 檔中同一來源只出現一次\n * Dedupe with includes so each source appears only once in the ignore file\n *\n * @returns 靜態樣板的來源路徑陣列 / Array of static template source paths\n */\nfunction extractStaticFiles(): string[]\n{\n\tconst staticFiles: string[] = [];\n\n\t/**\n\t * 三份清單的內容可能重疊(例如同一樣板被不同情境引用),\n\t * 合併後再統一去重\n\t * The three lists may overlap (e.g. one template referenced by different scenarios),\n\t * so merge first and dedupe afterwards\n\t */\n\tconst allArrays = [\n\t\t...defaultCopyStaticFiles,\n\t\t...defaultCopyStaticFilesRootOnly,\n\t\t...defaultCopyStaticFilesWsRootOnly,\n\t\t...defaultCopyStaticFilesTsdx,\n\t];\n\n\tfor (const entry of allArrays)\n\t{\n\t\tconst staticFile = entry[1];\n\n\t\t/**\n\t\t * 已存在則跳過,避免 ignore 檔重複列出\n\t\t * Skip when already collected to avoid duplicate entries in the ignore file\n\t\t */\n\t\tif (!staticFiles.includes(staticFile))\n\t\t{\n\t\t\tstaticFiles.push(staticFile);\n\t\t}\n\t}\n\n\treturn staticFiles;\n}\n\n/**\n * 重寫 ignore 檔中的生成區段\n * Rewrite the generated section of an ignore file\n *\n * 先移除舊的 `!file/` 條目與標記區段,再重新寫入,\n * 使腳本可重複執行(Idempotent)而不會不斷累加\n * Old `!file/` entries and the marked section are removed before rewriting,\n * so the script stays idempotent instead of appending forever\n *\n * @param filePath - .npmignore 或 .gitignore 的路徑 / Path to .npmignore or .gitignore\n * @param staticFiles - 要排除的靜態樣板路徑 / Static template paths to whitelist\n */\nfunction updateIgnoreFile(filePath: string, staticFiles: string[]): void\n{\n\n\t/**\n\t * 以 IgnoreFile 讀取:內容統一為行陣列,結尾空白行已由建構處理\n\t * Read via IgnoreFile: content is normalized into a line array, with the trailing blanks already handled at construction\n\t */\n\tconst ignoreFile = IgnoreFile.from(filePath, {\n\t\tendCount: true,\n\t});\n\n\tconst lines: string[] = [];\n\n\tlines.push('');\n\tlines.push(HEADER);\n\tlines.push(...staticFiles);\n\tlines.push(FOOTER);\n\tlines.push('');\n\n\tignoreFile.addList(lines, true);\n\n\tignoreFile.outputFile(filePath);\n}\n\n/**\n * 腳本進入點:擷取清單並更新 .npmignore 與 .gitignore\n * Script entry: extract the list and update .npmignore and .gitignore\n */\nfunction main(): void\n{\n\tconsole.log('Extracting static files from imported module...');\n\n\tconst staticFiles = extractStaticFiles();\n\n\tstaticFiles.push('test/fixtures/out/');\n\tstaticFiles.push('test/fixtures/split/');\n\tstaticFiles.push('test/fixtures/out/**');\n\tstaticFiles.push('test/fixtures/split/**');\n\n\tconsole.log(`Found ${staticFiles.length} static files:`);\n\n\tconst entries = staticFiles.sort().map(f => {\n\t\tconst entry = `!${f}`\n\t\tconsole.log(` ${entry}`)\n\t\treturn entry\n\t});\n\n\tconst npmIgnore = path.join(__ROOT, '.npmignore');\n\tconst gitIgnore = path.join(__ROOT, '.gitignore');\n\n\t/**\n\t * 兩個檔案採用同一套生成規則,先 npmignore 再 gitignore\n\t * Both files share the same generated rules, npmignore first then gitignore\n\t */\n\tupdateIgnoreFile(npmIgnore, entries);\n\tconsole.log(`\\nUpdated ${npmIgnore}`);\n\n\tupdateIgnoreFile(gitIgnore, entries);\n\tconsole.log(`Updated ${gitIgnore}`);\n}\n\nmain();\n"]}
1
+ {"version":3,"file":"update-npmignore-static-files.js","sourceRoot":"","sources":["update-npmignore-static-files.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,mDAA6B;AAC7B,iEAA8D;AAC9D,sCAAmC;AACnC,2CAIyB;AACzB,qDAAkE;AAElE;;;GAGG;AACH,MAAM,MAAM,GAAG,8BAA8B,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD;;;;;;;;GAQG;AACH,SAAS,kBAAkB;IAE1B,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC;;;;;OAKG;IACH,MAAM,SAAS,GAAG;QACjB,GAAG,8BAAsB;QACzB,GAAG,sCAA8B;QACjC,GAAG,wCAAgC;QACnC,GAAG,uCAA0B;KAC7B,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,SAAS,EAC7B,CAAC;QACA,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5B;;;WAGG;QACH,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,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,2BAA2B;QAC3B,+BAA+B;QAE/B,qBAAqB;QACrB,yBAAyB;QAEzB,uBAAuB;QAEvB,oBAAoB;QACpB,wBAAwB;QACxB,sBAAsB;QAEtB,uBAAuB;QACvB,qBAAqB;QACrB,yBAAyB;QAEzB,qBAAqB;QACrB,mBAAmB;QACnB,uBAAuB;KAEvB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAA;QACrB,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,eAAM,EAAE,YAAY,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,eAAM,EAAE,YAAY,CAAC,CAAC;IAElD;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC;IAEtC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,SAAS,EAAE,CAAC,CAAC;AACrC,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["/**\n * Script to extract staticFile values from const.ts\n * and add them as !<file> entries to .npmignore and .gitignore\n *\n * 腳本從 const.ts 提取 staticFile 值\n * 並將它們作為 !<file> 條目加入 .npmignore 和 .gitignore\n *\n * 讀取與保存皆透過 IgnoreFile(行陣列模型:支援陣列內容,EOF 換行自動還原)\n * Reading and saving both go through IgnoreFile (the line model: array content\n * is supported and the EOF newline is restored automatically)\n */\nimport * as path from 'path';\nimport { IgnoreFile } from '@yarn-tool/ignore/lib/IgnoreFile';\nimport { __ROOT } from '../__root';\nimport {\n\tdefaultCopyStaticFiles,\n\tdefaultCopyStaticFilesRootOnly,\n\tdefaultCopyStaticFilesWsRootOnly,\n} from '../../lib/const';\nimport { defaultCopyStaticFilesTsdx } from '../../lib/const-tsdx';\n\n/**\n * 生成區段的起始標記,用於識別並替換上一次產生的內容\n * Start marker of the generated section, used to locate and replace the previous run's output\n */\nconst HEADER = '# Static files from const.ts';\n\n/**\n * 生成區段的結束標記\n * End marker of the generated section\n */\nconst FOOTER = '# END Static files from const.ts';\n\n/**\n * 收集三份清單中所有不重複的 staticFile 來源路徑\n * Collect every unique staticFile source path across the three lists\n *\n * 以 includes 去重,確保 ignore 檔中同一來源只出現一次\n * Dedupe with includes so each source appears only once in the ignore file\n *\n * @returns 靜態樣板的來源路徑陣列 / Array of static template source paths\n */\nfunction extractStaticFiles(): string[]\n{\n\tconst staticFiles: string[] = [];\n\n\t/**\n\t * 三份清單的內容可能重疊(例如同一樣板被不同情境引用),\n\t * 合併後再統一去重\n\t * The three lists may overlap (e.g. one template referenced by different scenarios),\n\t * so merge first and dedupe afterwards\n\t */\n\tconst allArrays = [\n\t\t...defaultCopyStaticFiles,\n\t\t...defaultCopyStaticFilesRootOnly,\n\t\t...defaultCopyStaticFilesWsRootOnly,\n\t\t...defaultCopyStaticFilesTsdx,\n\t];\n\n\tfor (const entry of allArrays)\n\t{\n\t\tconst staticFile = entry[1];\n\n\t\t/**\n\t\t * 已存在則跳過,避免 ignore 檔重複列出\n\t\t * Skip when already collected to avoid duplicate entries in the ignore file\n\t\t */\n\t\tif (!staticFiles.includes(staticFile))\n\t\t{\n\t\t\tstaticFiles.push(staticFile);\n\t\t}\n\t}\n\n\treturn staticFiles;\n}\n\n/**\n * 重寫 ignore 檔中的生成區段\n * Rewrite the generated section of an ignore file\n *\n * 先移除舊的 `!file/` 條目與標記區段,再重新寫入,\n * 使腳本可重複執行(Idempotent)而不會不斷累加\n * Old `!file/` entries and the marked section are removed before rewriting,\n * so the script stays idempotent instead of appending forever\n *\n * @param filePath - .npmignore 或 .gitignore 的路徑 / Path to .npmignore or .gitignore\n * @param staticFiles - 要排除的靜態樣板路徑 / Static template paths to whitelist\n */\nfunction updateIgnoreFile(filePath: string, staticFiles: string[]): void\n{\n\n\t/**\n\t * 以 IgnoreFile 讀取:內容統一為行陣列,結尾空白行已由建構處理\n\t * Read via IgnoreFile: content is normalized into a line array, with the trailing blanks already handled at construction\n\t */\n\tconst ignoreFile = IgnoreFile.from(filePath, {\n\t\tendCount: true,\n\t});\n\n\tconst lines: string[] = [];\n\n\tlines.push('');\n\tlines.push(HEADER);\n\tlines.push(...staticFiles);\n\tlines.push(FOOTER);\n\tlines.push('');\n\n\tignoreFile.addList(lines, true);\n\n\tignoreFile.outputFile(filePath);\n}\n\n/**\n * 腳本進入點:擷取清單並更新 .npmignore 與 .gitignore\n * Script entry: extract the list and update .npmignore and .gitignore\n */\nfunction main(): void\n{\n\tconsole.log('Extracting static files from imported module...');\n\n\tconst staticFiles = extractStaticFiles();\n\n\tstaticFiles.push('test/fixtures/out/');\n\tstaticFiles.push('test/fixtures/split/');\n\tstaticFiles.push('test/fixtures/out/**');\n\tstaticFiles.push('test/fixtures/split/**');\n\n\tconsole.log(`Found ${staticFiles.length} static files:`);\n\n\tconst entries: string[] = [];\n\n\t\t[\n\n\t\t'file/playwright.config.d.ts',\n\t\t'file/playwright.config.js',\n\t\t'file/playwright.config.js.map',\n\n\t\t'file/ws-root/__root_ws.d.ts',\n\t\t'file/ws-root/__root_ws.js',\n\t\t'file/ws-root/__root_ws.js.map',\n\n\t\t'file/tsdx/index.cjs',\n\t\t'file/tsdx/index.cjs.map',\n\n\t\t'file/tsdx/index.d.cts',\n\n\t\t'file/tsdx/index.js',\n\t\t'file/tsdx/index.js.map',\n\t\t'file/tsdx/index.d.ts',\n\n\t\t'file/test/__root.d.ts',\n\t\t'file/test/__root.js',\n\t\t'file/test/__root.js.map',\n\n\t\t'file/test/temp.d.ts',\n\t\t'file/test/temp.js',\n\t\t'file/test/temp.js.map',\n\n\t].forEach(entry => {\n\t\tentries.push(entry);\n\t});\n\n\tstaticFiles.sort().forEach(f => {\n\t\tconst entry = `!${f}`\n\t\tconsole.log(` ${entry}`)\n\t\tentries.push(entry)\n\t});\n\n\tconst npmIgnore = path.join(__ROOT, '.npmignore');\n\tconst gitIgnore = path.join(__ROOT, '.gitignore');\n\n\t/**\n\t * 兩個檔案採用同一套生成規則,先 npmignore 再 gitignore\n\t * Both files share the same generated rules, npmignore first then gitignore\n\t */\n\tupdateIgnoreFile(npmIgnore, entries);\n\tconsole.log(`\\nUpdated ${npmIgnore}`);\n\n\tupdateIgnoreFile(gitIgnore, entries);\n\tconsole.log(`Updated ${gitIgnore}`);\n}\n\nmain();\n"]}
@@ -1,6 +0,0 @@
1
- // @ts-ignore
2
- import { defineConfig } from '@playwright/test';
3
-
4
- export default defineConfig({
5
- testMatch: /.*\.playwright(?:-|\.)(?:spec|test)\.(?:ts)/,
6
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;GAQG;AACH,8BAA8B;AAC9B;;GAEG;AACH,2BAA2B;AAC3B,4DAA0B;AAC1B,aAAa;AACb,uDAAgD;AAEhD;;GAEG;AACU,QAAA,MAAM,GAAG,gBAAI,CAAC,SAAS,CAAC,6BAAW,CAAC,CAAC;AAErC,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAElD;;;;;GAKG;AACU,QAAA,WAAW,GAAG,gBAAI,CAAC,IAAI,CAAC,cAAM,EAAE,MAAM,CAAC,CAAC;AAErD;;;;;GAKG;AACU,QAAA,eAAe,GAAG,gBAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,UAAU,CAAC,CAAC;AAElE;;;;;;;;;;;GAWG;AACU,QAAA,WAAW,GAAG,gBAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,MAAM,CAAC,CAAC","sourcesContent":["/**\n * 測試路徑架構 / Test Path Structure\n *\n * test/\n * ├── fixtures/ ← 測試資料夾(唯讀)\n * └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)\n * ├── fake-lib/\n * └── temp-pkg/\n */\n/// <reference types=\"node\" />\n/**\n * 如果不需要 upath2 可改用 path\n */\n// import path from 'path';\nimport path from 'upath2';\n// @ts-ignore\nimport { __ROOT_CORE } from './__root-core.cjs';\n\n/**\n * 專案根目錄\n */\nexport const __ROOT = path.normalize(__ROOT_CORE);\n\nexport const isWin = process.platform === \"win32\";\n\n/**\n * 測試資料夾\n * 基於 {@link __ROOT}\n *\n * @default test\n */\nexport const __TEST_ROOT = path.join(__ROOT, 'test');\n\n/**\n * 測試資料夾(唯讀)\n * 基於 {@link __TEST_ROOT}\n *\n * @default test/fixtures\n */\nexport const __TEST_FIXTURES = path.join(__TEST_ROOT, 'fixtures');\n\n/**\n * 臨時檔案(可寫,永遠建立子資料夾)\n * 基於 {@link __TEST_ROOT}\n *\n * test/\n * ├── fixtures/ ← 測試資料夾(唯讀)\n * └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)\n * ├── fake-lib/\n * └── temp-pkg/\n *\n * @default test/temp\n */\nexport const __TEST_TEMP = path.join(__TEST_ROOT, 'temp');\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"temp.js","sourceRoot":"","sources":["temp.ts"],"names":[],"mappings":";AAAA,8BAA8B","sourcesContent":["/// <reference types=\"node\" />\n\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["index.cts"],"names":[],"mappings":";;AAAA,4DAAwB;AAGxB,iBAAS,eAAC,CAAA","sourcesContent":["import _ from './index';\n\n// @ts-ignore\nexport = _\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH,MAAM,CAAC,GAAG,EAAE,CAAC;AAEb,aAAa;AACb,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,KAAK,EACrC,CAAC;IACA,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,kBAAe,CAAC,CAAA","sourcesContent":["\n\n/**\n * @deprecated change this file to match your project structure\n */\nconst _ = {};\n\n// @ts-ignore\nif (process.env.TSDX_FORMAT !== 'esm')\n{\n\tObject.defineProperty(_, \"__esModule\", { value: true });\n\n\tObject.defineProperty(_, \"default\", { value: _ });\n}\n\nexport default _\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"__root_ws.js","sourceRoot":"","sources":["__root_ws.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const __ROOT_WS = join(__dirname);\n\nexport const isWin = process.platform === \"win32\";\n"]}