@dittowords/cli 4.5.2 → 5.0.0-beta.1

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 (171) hide show
  1. package/README.md +6 -5
  2. package/bin/ditto.js +110 -285
  3. package/package.json +16 -10
  4. package/.github/actions/install-node-dependencies/action.yml +0 -24
  5. package/.github/workflows/required-checks.yml +0 -24
  6. package/.husky/pre-commit +0 -4
  7. package/.prettierignore +0 -0
  8. package/.prettierrc.json +0 -1
  9. package/__mocks__/fs.js +0 -2
  10. package/babel.config.js +0 -6
  11. package/bin/__mocks__/api.js +0 -48
  12. package/bin/__mocks__/api.js.map +0 -1
  13. package/bin/add-project.js +0 -104
  14. package/bin/add-project.js.map +0 -1
  15. package/bin/api.js +0 -54
  16. package/bin/api.js.map +0 -1
  17. package/bin/component-folders.js +0 -59
  18. package/bin/component-folders.js.map +0 -1
  19. package/bin/config.js +0 -242
  20. package/bin/config.js.map +0 -1
  21. package/bin/config.test.js +0 -93
  22. package/bin/config.test.js.map +0 -1
  23. package/bin/consts.js +0 -57
  24. package/bin/consts.js.map +0 -1
  25. package/bin/ditto.js.map +0 -1
  26. package/bin/generate-suggestions.js +0 -183
  27. package/bin/generate-suggestions.js.map +0 -1
  28. package/bin/generate-suggestions.test.js +0 -200
  29. package/bin/generate-suggestions.test.js.map +0 -1
  30. package/bin/http/__mocks__/fetchComponentFolders.js +0 -71
  31. package/bin/http/__mocks__/fetchComponentFolders.js.map +0 -1
  32. package/bin/http/__mocks__/fetchComponents.js +0 -73
  33. package/bin/http/__mocks__/fetchComponents.js.map +0 -1
  34. package/bin/http/__mocks__/fetchVariants.js +0 -71
  35. package/bin/http/__mocks__/fetchVariants.js.map +0 -1
  36. package/bin/http/fetchComponentFolders.js +0 -64
  37. package/bin/http/fetchComponentFolders.js.map +0 -1
  38. package/bin/http/fetchComponents.js +0 -78
  39. package/bin/http/fetchComponents.js.map +0 -1
  40. package/bin/http/fetchVariants.js +0 -87
  41. package/bin/http/fetchVariants.js.map +0 -1
  42. package/bin/http/http.test.js +0 -159
  43. package/bin/http/http.test.js.map +0 -1
  44. package/bin/http/importComponents.js +0 -114
  45. package/bin/http/importComponents.js.map +0 -1
  46. package/bin/importComponents.js +0 -65
  47. package/bin/importComponents.js.map +0 -1
  48. package/bin/init/init.js +0 -126
  49. package/bin/init/init.js.map +0 -1
  50. package/bin/init/project.js +0 -182
  51. package/bin/init/project.js.map +0 -1
  52. package/bin/init/project.test.js +0 -26
  53. package/bin/init/project.test.js.map +0 -1
  54. package/bin/init/token.js +0 -196
  55. package/bin/init/token.js.map +0 -1
  56. package/bin/init/token.test.js +0 -147
  57. package/bin/init/token.test.js.map +0 -1
  58. package/bin/output.js +0 -76
  59. package/bin/output.js.map +0 -1
  60. package/bin/pull-lib.test.js +0 -379
  61. package/bin/pull-lib.test.js.map +0 -1
  62. package/bin/pull.js +0 -562
  63. package/bin/pull.js.map +0 -1
  64. package/bin/pull.test.js +0 -151
  65. package/bin/pull.test.js.map +0 -1
  66. package/bin/remove-project.js +0 -99
  67. package/bin/remove-project.js.map +0 -1
  68. package/bin/replace.js +0 -171
  69. package/bin/replace.js.map +0 -1
  70. package/bin/replace.test.js +0 -197
  71. package/bin/replace.test.js.map +0 -1
  72. package/bin/types.js +0 -21
  73. package/bin/types.js.map +0 -1
  74. package/bin/utils/cleanFileName.js +0 -40
  75. package/bin/utils/cleanFileName.js.map +0 -1
  76. package/bin/utils/cleanFileName.test.js +0 -15
  77. package/bin/utils/cleanFileName.test.js.map +0 -1
  78. package/bin/utils/createSentryContext.js +0 -43
  79. package/bin/utils/createSentryContext.js.map +0 -1
  80. package/bin/utils/determineModuleType.js +0 -79
  81. package/bin/utils/determineModuleType.js.map +0 -1
  82. package/bin/utils/determineModuleType.test.js +0 -60
  83. package/bin/utils/determineModuleType.test.js.map +0 -1
  84. package/bin/utils/generateIOSBundles.js +0 -147
  85. package/bin/utils/generateIOSBundles.js.map +0 -1
  86. package/bin/utils/generateJsDriver.js +0 -178
  87. package/bin/utils/generateJsDriver.js.map +0 -1
  88. package/bin/utils/generateJsDriverTypeFile.js +0 -105
  89. package/bin/utils/generateJsDriverTypeFile.js.map +0 -1
  90. package/bin/utils/generateSwiftDriver.js +0 -93
  91. package/bin/utils/generateSwiftDriver.js.map +0 -1
  92. package/bin/utils/getSelectedProjects.js +0 -67
  93. package/bin/utils/getSelectedProjects.js.map +0 -1
  94. package/bin/utils/processMetaOption.js +0 -40
  95. package/bin/utils/processMetaOption.js.map +0 -1
  96. package/bin/utils/processMetaOption.test.js +0 -45
  97. package/bin/utils/processMetaOption.test.js.map +0 -1
  98. package/bin/utils/projectsToText.js +0 -58
  99. package/bin/utils/projectsToText.js.map +0 -1
  100. package/bin/utils/promptForProject.js +0 -96
  101. package/bin/utils/promptForProject.js.map +0 -1
  102. package/bin/utils/quit.js +0 -73
  103. package/bin/utils/quit.js.map +0 -1
  104. package/bin/utils/sourcesToText.js +0 -57
  105. package/bin/utils/sourcesToText.js.map +0 -1
  106. package/etsc.config.js +0 -13
  107. package/jest.config.ts +0 -16
  108. package/jsconfig.json +0 -5
  109. package/lib/__mocks__/api.ts +0 -12
  110. package/lib/add-project.ts +0 -48
  111. package/lib/api.ts +0 -16
  112. package/lib/component-folders.ts +0 -9
  113. package/lib/config.test.ts +0 -79
  114. package/lib/config.ts +0 -279
  115. package/lib/consts.ts +0 -22
  116. package/lib/ditto.ts +0 -285
  117. package/lib/generate-suggestions.test.ts +0 -169
  118. package/lib/generate-suggestions.ts +0 -166
  119. package/lib/http/__mocks__/fetchComponentFolders.ts +0 -23
  120. package/lib/http/__mocks__/fetchComponents.ts +0 -24
  121. package/lib/http/__mocks__/fetchVariants.ts +0 -21
  122. package/lib/http/fetchComponentFolders.ts +0 -23
  123. package/lib/http/fetchComponents.ts +0 -43
  124. package/lib/http/fetchVariants.ts +0 -42
  125. package/lib/http/http.test.ts +0 -122
  126. package/lib/http/importComponents.ts +0 -79
  127. package/lib/importComponents.ts +0 -24
  128. package/lib/init/init.ts +0 -79
  129. package/lib/init/project.test.ts +0 -26
  130. package/lib/init/project.ts +0 -136
  131. package/lib/init/token.test.ts +0 -99
  132. package/lib/init/token.ts +0 -156
  133. package/lib/output.ts +0 -21
  134. package/lib/pull-lib.test.ts +0 -367
  135. package/lib/pull.test.ts +0 -117
  136. package/lib/pull.ts +0 -629
  137. package/lib/remove-project.ts +0 -44
  138. package/lib/replace.test.ts +0 -157
  139. package/lib/replace.ts +0 -140
  140. package/lib/types.ts +0 -83
  141. package/lib/utils/cleanFileName.test.ts +0 -11
  142. package/lib/utils/cleanFileName.ts +0 -8
  143. package/lib/utils/createSentryContext.ts +0 -20
  144. package/lib/utils/determineModuleType.test.ts +0 -48
  145. package/lib/utils/determineModuleType.ts +0 -55
  146. package/lib/utils/generateIOSBundles.ts +0 -122
  147. package/lib/utils/generateJsDriver.ts +0 -207
  148. package/lib/utils/generateJsDriverTypeFile.ts +0 -75
  149. package/lib/utils/generateSwiftDriver.ts +0 -48
  150. package/lib/utils/getSelectedProjects.ts +0 -36
  151. package/lib/utils/processMetaOption.test.ts +0 -18
  152. package/lib/utils/processMetaOption.ts +0 -16
  153. package/lib/utils/projectsToText.ts +0 -29
  154. package/lib/utils/promptForProject.ts +0 -61
  155. package/lib/utils/quit.ts +0 -7
  156. package/lib/utils/sourcesToText.ts +0 -25
  157. package/pull_request_template.md +0 -20
  158. package/testfiles/en.json +0 -5
  159. package/testfiles/es.json +0 -5
  160. package/testfiles/fr.json +0 -5
  161. package/testfiles/test1.jsx +0 -18
  162. package/testfiles/test2.jsx +0 -9
  163. package/testing/.gitkeep +0 -0
  164. package/testing/fixtures/bad-yaml.yml +0 -6
  165. package/testing/fixtures/ditto-config-no-token +0 -2
  166. package/testing/fixtures/project-config-empty-projects.yml +0 -1
  167. package/testing/fixtures/project-config-no-id.yml +0 -2
  168. package/testing/fixtures/project-config-no-name.yml +0 -2
  169. package/testing/fixtures/project-config-pull.yml +0 -0
  170. package/testing/fixtures/project-config-working.yml +0 -3
  171. package/tsconfig.json +0 -16
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../lib/replace.test.ts"],"sourcesContent":["import fs from \"fs\";\nimport { parseOptions, replaceJSXTextInFile } from \"./replace\"; // Assuming the function is exported in a separate file\n\njest.mock(\"fs\");\n\n// Helper function to create a temporary file\nasync function createTempJSXFile(content: string): Promise<string> {\n const tempFile = \"/tempFile.jsx\";\n await new Promise((resolve, reject) => {\n try {\n fs.writeFile(tempFile, content, resolve);\n } catch (e) {\n reject(e);\n }\n });\n return tempFile;\n}\n\n// Helper function to delete the temporary file\nasync function deleteTempFile(filePath: string): Promise<void> {\n await new Promise((resolve, reject) => {\n try {\n fs.unlink(filePath, resolve);\n } catch (e) {\n reject(e);\n }\n });\n}\n\ndescribe(\"parseOptions\", () => {\n test(\"should pass with valid input\", async () => {\n const tempFile = await createTempJSXFile(\"<div>Hello, world!</div>\");\n expect(() =>\n parseOptions([tempFile, \"secondString\", \"thirdString\"])\n ).not.toThrow();\n\n const result = parseOptions([tempFile, \"secondString\", \"thirdString\"]);\n expect(result).toEqual({\n filePath: tempFile,\n searchString: \"secondString\",\n replaceWith: \"thirdString\",\n });\n\n deleteTempFile(tempFile);\n });\n\n test(\"should throw error when options array does not have exactly three strings\", () => {\n expect(() => parseOptions([\"oneString\"])).toThrow(\n \"The options array must contain <file path> <search string> <replace with>.\"\n );\n expect(() => parseOptions([\"one\", \"two\"])).toThrow(\n \"The options array must contain <file path> <search string> <replace with>.\"\n );\n expect(() => parseOptions([\"one\", \"two\", \"three\", \"four\"])).toThrow(\n \"The options array must contain <file path> <search string> <replace with>.\"\n );\n });\n\n test(\"should throw error when the first string is not a valid file path\", () => {\n const invalidFilePath = \"/path/to/invalid/file.txt\";\n expect(() =>\n parseOptions([invalidFilePath, \"secondString\", \"thirdString\"])\n ).toThrow(`${invalidFilePath} is not a valid file path.`);\n });\n\n test(\"should throw error when the first string is a directory\", () => {\n const directoryPath = \".\";\n expect(() =>\n parseOptions([directoryPath, \"secondString\", \"thirdString\"])\n ).toThrow(`${directoryPath} is not a valid file path.`);\n });\n});\n\ndescribe(\"replaceJSXTextInFile\", () => {\n afterEach(async () => {\n await deleteTempFile(\"/tempFile.jsx\");\n });\n\n test(\"should replace JSX text with a DittoComponent\", async () => {\n const tempFile = await createTempJSXFile(\"<div>Hello, world</div>\");\n const searchString = \"world\";\n const replaceWith = \"some-id\";\n\n await replaceJSXTextInFile(tempFile, { searchString, replaceWith }, {});\n\n const transformedCode = await new Promise((resolve, reject) => {\n fs.readFile(tempFile, \"utf-8\", (error, data) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n });\n });\n expect(transformedCode).toContain(\n `<div>Hello, <DittoComponent componentId=\"${replaceWith}\" /></div>`\n );\n });\n\n test(\"should replace JSX text with a DittoComponent with a flag\", async () => {\n const tempFile = await createTempJSXFile(\n `<>\\n<div>Hello, world</div>\\n<div>Hello, world</div>\\n</>`\n );\n const searchString = \"world\";\n const replaceWith = \"some-id\";\n\n await replaceJSXTextInFile(\n tempFile,\n { searchString, replaceWith },\n { lineNumbers: [3] }\n );\n\n const transformedCode = await new Promise((resolve, reject) =>\n fs.readFile(tempFile, \"utf-8\", (error, data) => {\n if (error) reject(error);\n else resolve(data);\n })\n );\n expect(transformedCode).toContain(\n `<>\\n <div>Hello, world</div>\\n <div>Hello, <DittoComponent componentId=\\\"some-id\\\" /></div>\\n</>;`\n );\n });\n\n test(\"should handle case-insensitive search\", async () => {\n const tempFile = await createTempJSXFile(\"<div>HeLLo, WoRlD</div>\");\n const searchString = \"world\";\n const replaceWith = \"some-id\";\n\n await replaceJSXTextInFile(tempFile, { searchString, replaceWith }, {});\n\n const transformedCode = await new Promise((resolve, reject) =>\n fs.readFile(tempFile, \"utf-8\", (error, data) => {\n if (error) reject(error);\n else resolve(data);\n })\n );\n expect(transformedCode).toContain(\n `<div>HeLLo, <DittoComponent componentId=\"${replaceWith}\" /></div>`\n );\n });\n\n test(\"should not replace JSX text if searchString is not found\", async () => {\n const tempFile = await createTempJSXFile(\"<div>Hello, world!</div>\");\n const searchString = \"foobar\";\n const replaceWith = \"some-id\";\n\n await replaceJSXTextInFile(tempFile, { searchString, replaceWith }, {});\n\n const transformedCode = await new Promise((resolve, reject) =>\n fs.readFile(tempFile, \"utf-8\", (error, data) => {\n if (error) reject(error);\n else resolve(data);\n })\n );\n expect(transformedCode).toContain(\"<div>Hello, world!</div>\");\n });\n});\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gBAAe;AACf,qBAAmD;AAEnD,KAAK,KAAK,IAAI;AAGd,SAAe,kBAAkB,SAAkC;AAAA;AACjE,UAAM,WAAW;AACjB,UAAM,IAAI,QAAQ,CAAC,SAAS,WAAW;AACrC,UAAI;AACF,kBAAAA,QAAG,UAAU,UAAU,SAAS,OAAO;AAAA,MACzC,SAAS,GAAG;AACV,eAAO,CAAC;AAAA,MACV;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAGA,SAAe,eAAe,UAAiC;AAAA;AAC7D,UAAM,IAAI,QAAQ,CAAC,SAAS,WAAW;AACrC,UAAI;AACF,kBAAAA,QAAG,OAAO,UAAU,OAAO;AAAA,MAC7B,SAAS,GAAG;AACV,eAAO,CAAC;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAEA,SAAS,gBAAgB,MAAM;AAC7B,OAAK,gCAAgC,MAAY;AAC/C,UAAM,WAAW,MAAM,kBAAkB,0BAA0B;AACnE;AAAA,MAAO,UACL,6BAAa,CAAC,UAAU,gBAAgB,aAAa,CAAC;AAAA,IACxD,EAAE,IAAI,QAAQ;AAEd,UAAM,aAAS,6BAAa,CAAC,UAAU,gBAAgB,aAAa,CAAC;AACrE,WAAO,MAAM,EAAE,QAAQ;AAAA,MACrB,UAAU;AAAA,MACV,cAAc;AAAA,MACd,aAAa;AAAA,IACf,CAAC;AAED,mBAAe,QAAQ;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,SAAS,CAAC,OAAO,SAAS;AAC9C,YAAI;AAAO,iBAAO,KAAK;AAAA;AAClB,kBAAQ,IAAI;AAAA,MACnB,CAAC;AAAA,IACH;AACA,WAAO,eAAe,EAAE,UAAU,0BAA0B;AAAA,EAC9D,EAAC;AACH,CAAC","debug_id":"8d2eb72b-d2d6-5847-b480-cd39f4da1f7e"}
package/bin/types.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31cef992-b35d-58a1-b36c-4df7755fb649")}catch(e){}}();
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
19
- //# sourceMappingURL=types.js.map
20
-
21
- //# debugId=31cef992-b35d-58a1-b36c-4df7755fb649
package/bin/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../lib/types.ts"],"sourcesContent":["export interface Project {\n name: string;\n id: string;\n url?: string;\n fileName?: string;\n status?: string;\n exclude_components?: boolean;\n}\n\nexport type ComponentSource = ComponentFolder & {\n type: \"components\";\n fileName: string;\n variant: string;\n};\n\nexport type Source = (Project & { type?: undefined }) | ComponentSource;\n\nexport interface ComponentFolder {\n id: string;\n name: string;\n status?: string;\n}\n\nexport type SupportedFormat =\n | \"flat\"\n | \"nested\"\n | \"structured\"\n | \"android\"\n | \"ios-strings\"\n | \"ios-stringsdict\"\n | \"icu\";\n\nexport type SupportedExtension = \".json\" | \".xml\" | \".strings\" | \".stringsdict\";\n\ntype ComponentsSourceBool = boolean;\ntype ComponentsSourceConfig = {\n root?: boolean | { status: string };\n folders?: ComponentFolder[];\n};\ntype ComponentsSource = ComponentsSourceBool | ComponentsSourceConfig;\n\nexport interface ConfigYAML {\n sources?: {\n components?: ComponentsSource;\n projects?: Project[];\n };\n format?: SupportedFormat;\n status?: string;\n variants?: boolean;\n richText?: boolean;\n\n // TODO: might want to rename this at some point\n iosLocales?: Record<string, string>[];\n\n // prevents the generation of index.js and index.d.ts files\n // when working with JSON formats\n disableJsDriver?: boolean;\n\n // these are legacy fields - if they exist, we should output\n // a deprecation error, and suggest that they nest them under\n // a top-level `sources` property\n components?: boolean;\n projects?: Project[];\n}\n\nexport interface SourceInformation {\n hasSourceData: boolean;\n hasTopLevelProjectsField: boolean;\n hasTopLevelComponentsField: boolean;\n hasComponentLibraryInProjects: boolean;\n validProjects: Project[];\n shouldFetchComponentLibrary: boolean;\n variants: boolean;\n format: string | string[] | undefined;\n status: string | undefined;\n richText: boolean | undefined;\n componentRoot: boolean | { status: string } | undefined;\n componentFolders: ComponentFolder[] | undefined;\n localeByVariantApiId: Record<string, string> | undefined;\n disableJsDriver?: boolean;\n}\n\nexport type Token = string | undefined;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA","debug_id":"31cef992-b35d-58a1-b36c-4df7755fb649"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2c3d33c0-3502-5a27-a98a-460ccebb5e74")}catch(e){}}();
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var cleanFileName_exports = {};
22
- __export(cleanFileName_exports, {
23
- cleanFileName: () => cleanFileName
24
- });
25
- module.exports = __toCommonJS(cleanFileName_exports);
26
- function cleanFileName(fileName) {
27
- let parts = fileName.split(/\s{1,}/g);
28
- parts = parts.map(
29
- (part) => part.replace(/[^a-zA-Z0-9-_.]/g, "").toLowerCase()
30
- );
31
- parts = parts.filter((part) => part !== "");
32
- return parts.join("-");
33
- }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- cleanFileName
37
- });
38
- //# sourceMappingURL=cleanFileName.js.map
39
-
40
- //# debugId=2c3d33c0-3502-5a27-a98a-460ccebb5e74
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/cleanFileName.ts"],"sourcesContent":["export function cleanFileName(fileName: string): string {\n let parts = fileName.split(/\\s{1,}/g);\n parts = parts.map((part) =>\n part.replace(/[^a-zA-Z0-9-_.]/g, \"\").toLowerCase()\n );\n parts = parts.filter((part) => part !== \"\");\n return parts.join(\"-\");\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,cAAc,UAA0B;AACtD,MAAI,QAAQ,SAAS,MAAM,SAAS;AACpC,UAAQ,MAAM;AAAA,IAAI,CAAC,SACjB,KAAK,QAAQ,oBAAoB,EAAE,EAAE,YAAY;AAAA,EACnD;AACA,UAAQ,MAAM,OAAO,CAAC,SAAS,SAAS,EAAE;AAC1C,SAAO,MAAM,KAAK,GAAG;AACvB","debug_id":"2c3d33c0-3502-5a27-a98a-460ccebb5e74"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6d536038-ec46-5c46-a8f3-18d15a529002")}catch(e){}}();
3
-
4
- var import_cleanFileName = require("./cleanFileName");
5
- describe("cleanFileName tests", () => {
6
- it("correctly cleans emojis", () => {
7
- const folderName = "\u{1F44D}Good Folder";
8
- expect((0, import_cleanFileName.cleanFileName)(folderName)).toEqual("good-folder");
9
- const fileName = "\u{1F44D} Good Folder";
10
- expect((0, import_cleanFileName.cleanFileName)(fileName)).toEqual("good-folder");
11
- });
12
- });
13
- //# sourceMappingURL=cleanFileName.test.js.map
14
-
15
- //# debugId=6d536038-ec46-5c46-a8f3-18d15a529002
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/cleanFileName.test.ts"],"sourcesContent":["import { cleanFileName } from \"./cleanFileName\";\n\ndescribe(\"cleanFileName tests\", () => {\n it(\"correctly cleans emojis\", () => {\n const folderName = \"👍Good Folder\";\n expect(cleanFileName(folderName)).toEqual(\"good-folder\");\n\n const fileName = \"👍 Good Folder\";\n expect(cleanFileName(fileName)).toEqual(\"good-folder\");\n });\n});\n"],"names":[],"mappings":";;;AAAA,2BAA8B;AAE9B,SAAS,uBAAuB,MAAM;AACpC,KAAG,2BAA2B,MAAM;AAClC,UAAM,aAAa;AACnB,eAAO,oCAAc,UAAU,CAAC,EAAE,QAAQ,aAAa;AAEvD,UAAM,WAAW;AACjB,eAAO,oCAAc,QAAQ,CAAC,EAAE,QAAQ,aAAa;AAAA,EACvD,CAAC;AACH,CAAC","debug_id":"6d536038-ec46-5c46-a8f3-18d15a529002"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="38a5733b-13a9-57f6-843f-d2de84c4c1d0")}catch(e){}}();
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var createSentryContext_exports = {};
22
- __export(createSentryContext_exports, {
23
- createSentryContext: () => createSentryContext
24
- });
25
- module.exports = __toCommonJS(createSentryContext_exports);
26
- function createSentryContext(obj) {
27
- if (typeof obj !== "object")
28
- return {};
29
- const ctx = {};
30
- for (const key in obj) {
31
- const k = key;
32
- const r = obj[k];
33
- ctx[k] = typeof r === "object" || Array.isArray(r) ? JSON.stringify(r) : r;
34
- }
35
- return ctx;
36
- }
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- createSentryContext
40
- });
41
- //# sourceMappingURL=createSentryContext.js.map
42
-
43
- //# debugId=38a5733b-13a9-57f6-843f-d2de84c4c1d0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/createSentryContext.ts"],"sourcesContent":["type SentryContext = Record<\n string,\n string | number | boolean | null | undefined\n>;\n\n/**\n * Sentry context only supports properties one layer deep\n */\nexport function createSentryContext(obj: unknown) {\n if (typeof obj !== \"object\") return {};\n\n const ctx: SentryContext = {};\n for (const key in obj) {\n const k = key as keyof typeof obj;\n const r = obj[k];\n ctx[k] = typeof r === \"object\" || Array.isArray(r) ? JSON.stringify(r) : r;\n }\n\n return ctx;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,oBAAoB,KAAc;AAChD,MAAI,OAAO,QAAQ;AAAU,WAAO,CAAC;AAErC,QAAM,MAAqB,CAAC;AAC5B,aAAW,OAAO,KAAK;AACrB,UAAM,IAAI;AACV,UAAM,IAAI,IAAI,CAAC;AACf,QAAI,CAAC,IAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;AAAA,EAC3E;AAEA,SAAO;AACT","debug_id":"38a5733b-13a9-57f6-843f-d2de84c4c1d0"}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6334441d-042a-5df3-9f37-7bd9fd9adae4")}catch(e){}}();
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
- var determineModuleType_exports = {};
32
- __export(determineModuleType_exports, {
33
- determineModuleType: () => determineModuleType
34
- });
35
- module.exports = __toCommonJS(determineModuleType_exports);
36
- var fs = __toESM(require("fs"));
37
- var path = __toESM(require("path"));
38
- function determineModuleType(currentDir = process.cwd()) {
39
- const value = getRawTypeFromPackageJson(currentDir);
40
- return getTypeOrDefault(value);
41
- }
42
- function getRawTypeFromPackageJson(currentDir) {
43
- if (process.env.DITTO_MODULE_TYPE) {
44
- return process.env.DITTO_MODULE_TYPE;
45
- }
46
- while (currentDir) {
47
- const packageJsonPath = path.join(currentDir, "package.json");
48
- if (fs.existsSync(packageJsonPath)) {
49
- const packageJsonContents = fs.readFileSync(packageJsonPath, "utf8");
50
- try {
51
- const packageData = JSON.parse(packageJsonContents);
52
- if (packageData == null ? void 0 : packageData.type) {
53
- return packageData.type;
54
- }
55
- } catch (e) {
56
- }
57
- return null;
58
- }
59
- if (currentDir === "/") {
60
- break;
61
- }
62
- currentDir = path.dirname(currentDir);
63
- }
64
- return null;
65
- }
66
- function getTypeOrDefault(value) {
67
- const valueLower = (value == null ? void 0 : value.toLowerCase()) || "";
68
- if (valueLower === "commonjs" || valueLower === "module") {
69
- return valueLower;
70
- }
71
- return "commonjs";
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- determineModuleType
76
- });
77
- //# sourceMappingURL=determineModuleType.js.map
78
-
79
- //# debugId=6334441d-042a-5df3-9f37-7bd9fd9adae4
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/determineModuleType.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\n\nexport type ModuleType = \"commonjs\" | \"module\";\n\n/**\n * Looks for a `package.json` file starting in the current working directory and traversing upwards\n * until it finds one or reaches root.\n * @returns \"commonjs\" or \"module\", defaulting to \"module\" if no `package.json` is found or if the found\n * file does not include a `type` property.\n */\nexport function determineModuleType(currentDir: string | null = process.cwd()) {\n const value = getRawTypeFromPackageJson(currentDir);\n return getTypeOrDefault(value);\n}\n\nfunction getRawTypeFromPackageJson(currentDir: string | null) {\n if (process.env.DITTO_MODULE_TYPE) {\n return process.env.DITTO_MODULE_TYPE;\n }\n\n while (currentDir) {\n const packageJsonPath = path.join(currentDir, \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n const packageJsonContents = fs.readFileSync(packageJsonPath, \"utf8\");\n try {\n const packageData: { type?: string } = JSON.parse(packageJsonContents);\n if (packageData?.type) {\n return packageData.type;\n }\n } catch {}\n\n return null;\n }\n\n if (currentDir === \"/\") {\n break;\n }\n\n // Move up a directory and continue the search\n currentDir = path.dirname(currentDir);\n }\n\n // No package.json\n return null;\n}\n\nfunction getTypeOrDefault(value: string | null): ModuleType {\n const valueLower = value?.toLowerCase() || \"\";\n if (valueLower === \"commonjs\" || valueLower === \"module\") {\n return valueLower;\n }\n\n return \"commonjs\";\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AAUf,SAAS,oBAAoB,aAA4B,QAAQ,IAAI,GAAG;AAC7E,QAAM,QAAQ,0BAA0B,UAAU;AAClD,SAAO,iBAAiB,KAAK;AAC/B;AAEA,SAAS,0BAA0B,YAA2B;AAC5D,MAAI,QAAQ,IAAI,mBAAmB;AACjC,WAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,SAAO,YAAY;AACjB,UAAM,kBAAkB,KAAK,KAAK,YAAY,cAAc;AAC5D,QAAI,GAAG,WAAW,eAAe,GAAG;AAClC,YAAM,sBAAsB,GAAG,aAAa,iBAAiB,MAAM;AACnE,UAAI;AACF,cAAM,cAAiC,KAAK,MAAM,mBAAmB;AACrE,YAAI,2CAAa,MAAM;AACrB,iBAAO,YAAY;AAAA,QACrB;AAAA,MACF,SAAQ;AAAA,MAAC;AAET,aAAO;AAAA,IACT;AAEA,QAAI,eAAe,KAAK;AACtB;AAAA,IACF;AAGA,iBAAa,KAAK,QAAQ,UAAU;AAAA,EACtC;AAGA,SAAO;AACT;AAEA,SAAS,iBAAiB,OAAkC;AAC1D,QAAM,cAAa,+BAAO,kBAAiB;AAC3C,MAAI,eAAe,cAAc,eAAe,UAAU;AACxD,WAAO;AAAA,EACT;AAEA,SAAO;AACT","debug_id":"6334441d-042a-5df3-9f37-7bd9fd9adae4"}
@@ -1,60 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31410f07-eaa0-59b5-a32b-1c709affaf87")}catch(e){}}();
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var import_determineModuleType = require("./determineModuleType");
21
- var import_memfs = require("memfs");
22
- const defaultEnv = process.env;
23
- jest.mock("fs");
24
- beforeEach(() => {
25
- import_memfs.vol.reset();
26
- process.env = __spreadValues({}, defaultEnv);
27
- });
28
- test("'commonjs' if no package.json found", () => {
29
- expect((0, import_determineModuleType.determineModuleType)()).toBe("commonjs");
30
- });
31
- test("'commonjs' if package.json found but no `type` property", () => {
32
- import_memfs.vol.fromJSON({ "package.json": JSON.stringify({}) }, process.cwd());
33
- expect((0, import_determineModuleType.determineModuleType)()).toBe("commonjs");
34
- });
35
- test("'commonjs' if package.json found and `type` property is 'commonjs'", () => {
36
- import_memfs.vol.fromJSON({ "package.json": JSON.stringify({ type: "commonjs" }) });
37
- expect((0, import_determineModuleType.determineModuleType)()).toBe("commonjs");
38
- });
39
- test("'commonjs' if package.json found and `type` property is invalid", () => {
40
- import_memfs.vol.fromJSON({ "package.json": JSON.stringify({ type: "invalid-type" }) });
41
- expect((0, import_determineModuleType.determineModuleType)()).toBe("commonjs");
42
- });
43
- test("'module' if package.json found and `type` property is 'module'", () => {
44
- import_memfs.vol.fromJSON({ "package.json": JSON.stringify({ type: "module" }) });
45
- expect((0, import_determineModuleType.determineModuleType)()).toBe("module");
46
- });
47
- test("finds package.json in parent directories", () => {
48
- import_memfs.vol.fromJSON({
49
- "/some/nested/dir/test.txt": "",
50
- "/package.json": JSON.stringify({ type: "module" })
51
- });
52
- expect((0, import_determineModuleType.determineModuleType)("/some/nested/dir")).toBe("module");
53
- });
54
- test("supports explicit specification of module type via environment variable", () => {
55
- process.env.DITTO_MODULE_TYPE = "module";
56
- expect((0, import_determineModuleType.determineModuleType)()).toBe("module");
57
- });
58
- //# sourceMappingURL=determineModuleType.test.js.map
59
-
60
- //# debugId=31410f07-eaa0-59b5-a32b-1c709affaf87
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/determineModuleType.test.ts"],"sourcesContent":["import { determineModuleType } from \"./determineModuleType\";\nimport { vol } from \"memfs\";\n\nconst defaultEnv = process.env;\n\njest.mock(\"fs\");\n\nbeforeEach(() => {\n vol.reset();\n process.env = { ...defaultEnv };\n});\n\ntest(\"'commonjs' if no package.json found\", () => {\n expect(determineModuleType()).toBe(\"commonjs\");\n});\n\ntest(\"'commonjs' if package.json found but no `type` property\", () => {\n vol.fromJSON({ \"package.json\": JSON.stringify({}) }, process.cwd());\n expect(determineModuleType()).toBe(\"commonjs\");\n});\n\ntest(\"'commonjs' if package.json found and `type` property is 'commonjs'\", () => {\n vol.fromJSON({ \"package.json\": JSON.stringify({ type: \"commonjs\" }) });\n expect(determineModuleType()).toBe(\"commonjs\");\n});\n\ntest(\"'commonjs' if package.json found and `type` property is invalid\", () => {\n vol.fromJSON({ \"package.json\": JSON.stringify({ type: \"invalid-type\" }) });\n expect(determineModuleType()).toBe(\"commonjs\");\n});\n\ntest(\"'module' if package.json found and `type` property is 'module'\", () => {\n vol.fromJSON({ \"package.json\": JSON.stringify({ type: \"module\" }) });\n expect(determineModuleType()).toBe(\"module\");\n});\n\ntest(\"finds package.json in parent directories\", () => {\n vol.fromJSON({\n \"/some/nested/dir/test.txt\": \"\",\n \"/package.json\": JSON.stringify({ type: \"module\" }),\n });\n expect(determineModuleType(\"/some/nested/dir\")).toBe(\"module\");\n});\n\ntest(\"supports explicit specification of module type via environment variable\", () => {\n process.env.DITTO_MODULE_TYPE = \"module\";\n expect(determineModuleType()).toBe(\"module\");\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,iCAAoC;AACpC,mBAAoB;AAEpB,MAAM,aAAa,QAAQ;AAE3B,KAAK,KAAK,IAAI;AAEd,WAAW,MAAM;AACf,mBAAI,MAAM;AACV,UAAQ,MAAM,mBAAK;AACrB,CAAC;AAED,KAAK,uCAAuC,MAAM;AAChD,aAAO,gDAAoB,CAAC,EAAE,KAAK,UAAU;AAC/C,CAAC;AAED,KAAK,2DAA2D,MAAM;AACpE,mBAAI,SAAS,EAAE,gBAAgB,KAAK,UAAU,CAAC,CAAC,EAAE,GAAG,QAAQ,IAAI,CAAC;AAClE,aAAO,gDAAoB,CAAC,EAAE,KAAK,UAAU;AAC/C,CAAC;AAED,KAAK,sEAAsE,MAAM;AAC/E,mBAAI,SAAS,EAAE,gBAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC,EAAE,CAAC;AACrE,aAAO,gDAAoB,CAAC,EAAE,KAAK,UAAU;AAC/C,CAAC;AAED,KAAK,mEAAmE,MAAM;AAC5E,mBAAI,SAAS,EAAE,gBAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC,EAAE,CAAC;AACzE,aAAO,gDAAoB,CAAC,EAAE,KAAK,UAAU;AAC/C,CAAC;AAED,KAAK,kEAAkE,MAAM;AAC3E,mBAAI,SAAS,EAAE,gBAAgB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC,EAAE,CAAC;AACnE,aAAO,gDAAoB,CAAC,EAAE,KAAK,QAAQ;AAC7C,CAAC;AAED,KAAK,4CAA4C,MAAM;AACrD,mBAAI,SAAS;AAAA,IACX,6BAA6B;AAAA,IAC7B,iBAAiB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAAA,EACpD,CAAC;AACD,aAAO,gDAAoB,kBAAkB,CAAC,EAAE,KAAK,QAAQ;AAC/D,CAAC;AAED,KAAK,2EAA2E,MAAM;AACpF,UAAQ,IAAI,oBAAoB;AAChC,aAAO,gDAAoB,CAAC,EAAE,KAAK,QAAQ;AAC7C,CAAC","debug_id":"31410f07-eaa0-59b5-a32b-1c709affaf87"}
@@ -1,147 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b23b75ff-e7f4-506d-8f68-909661187171")}catch(e){}}();
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
- var __async = (__this, __arguments, generator) => {
32
- return new Promise((resolve, reject) => {
33
- var fulfilled = (value) => {
34
- try {
35
- step(generator.next(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var rejected = (value) => {
41
- try {
42
- step(generator.throw(value));
43
- } catch (e) {
44
- reject(e);
45
- }
46
- };
47
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
48
- step((generator = generator.apply(__this, __arguments)).next());
49
- });
50
- };
51
- var generateIOSBundles_exports = {};
52
- __export(generateIOSBundles_exports, {
53
- generateIOSBundles: () => generateIOSBundles
54
- });
55
- module.exports = __toCommonJS(generateIOSBundles_exports);
56
- var import_path = __toESM(require("path"));
57
- var import_fs = __toESM(require("fs"));
58
- var import_consts = __toESM(require("../consts"));
59
- var import_output = __toESM(require("../output"));
60
- const IOS_FILE_EXTENSION_PATTERN = /\.(strings|stringsdict)$/;
61
- function generateIOSBundles(localeByVariantApiId) {
62
- return __async(this, null, function* () {
63
- const files = import_fs.default.readdirSync(import_consts.default.TEXT_DIR);
64
- const bundlesGenerated = {};
65
- for (const fileName of files) {
66
- if (!IOS_FILE_EXTENSION_PATTERN.test(fileName)) {
67
- continue;
68
- }
69
- const [name, fileExtension] = fileName.split(".");
70
- if (!name.length) {
71
- continue;
72
- }
73
- const parts = name.split("__");
74
- const source = parts[0];
75
- const variant = parts[parts.length - 1];
76
- if (!(source && variant)) {
77
- continue;
78
- }
79
- const bundleName = localeByVariantApiId && localeByVariantApiId[variant] ? localeByVariantApiId[variant] : variant;
80
- const bundleFileName = `${bundleName}.lproj`;
81
- const bundleFolder = import_path.default.join(import_consts.default.TEXT_DIR, bundleFileName);
82
- if (!import_fs.default.existsSync(bundleFolder)) {
83
- import_fs.default.mkdirSync(bundleFolder);
84
- }
85
- const filePathCurrent = import_path.default.join(import_consts.default.TEXT_DIR, fileName);
86
- const filePathNew = import_path.default.join(bundleFolder, `${source}.${fileExtension}`);
87
- handleBundleGeneration(source, fileExtension, filePathCurrent, filePathNew);
88
- bundlesGenerated[bundleFileName] = {
89
- mappedVariant: variant === bundleName ? void 0 : variant
90
- };
91
- }
92
- return Object.keys(bundlesGenerated).map((bundleName) => {
93
- let msg = `Successfully generated iOS bundle ${import_output.default.info(
94
- bundleName
95
- )}`;
96
- const mappedVariant = bundlesGenerated[bundleName].mappedVariant;
97
- if (mappedVariant) {
98
- msg += ` ${import_output.default.subtle(`(mapped to variant '${mappedVariant}')`)}`;
99
- }
100
- return msg;
101
- }).join("\n") + "\n";
102
- });
103
- }
104
- function handleBundleGeneration(sourceId, extension, sourcePath, newFilePath) {
105
- if (!import_fs.default.existsSync(newFilePath)) {
106
- return import_fs.default.renameSync(sourcePath, newFilePath);
107
- }
108
- if (sourceId !== "components") {
109
- throw new Error("Bundle path for " + sourceId + " already exists");
110
- }
111
- if (extension === "strings") {
112
- return appendStringsFile(sourcePath, newFilePath);
113
- }
114
- if (extension === "stringsdict") {
115
- return appendStringsDictFile(sourcePath, newFilePath);
116
- }
117
- throw new Error("Unsupported extension " + extension);
118
- }
119
- function appendStringsFile(sourcePath, destPath) {
120
- const sourceContents = import_fs.default.readFileSync(sourcePath, "utf-8");
121
- const newFileContents = import_fs.default.readFileSync(destPath, "utf-8");
122
- const newContents = newFileContents + "\n" + sourceContents;
123
- import_fs.default.writeFileSync(destPath, newContents);
124
- import_fs.default.unlinkSync(sourcePath);
125
- }
126
- function appendStringsDictFile(sourcePath, destPath) {
127
- const sourceContentsFull = import_fs.default.readFileSync(sourcePath, "utf-8");
128
- const sourceContentsContent = sourceContentsFull.split("\n").slice(3, -4);
129
- const newFileContentsFull = import_fs.default.readFileSync(destPath, "utf-8");
130
- const newFileContentsContent = newFileContentsFull.split("\n").slice(3, -4);
131
- const newContents = `<?xml version="1.0" encoding="utf-8"?>
132
- <plist version="1.0">
133
- <dict>
134
- ${[newFileContentsContent, sourceContentsContent].join("\n")}
135
- </dict>
136
- </plist>
137
- `;
138
- import_fs.default.writeFileSync(destPath, newContents);
139
- import_fs.default.unlinkSync(sourcePath);
140
- }
141
- // Annotate the CommonJS export names for ESM import in node:
142
- 0 && (module.exports = {
143
- generateIOSBundles
144
- });
145
- //# sourceMappingURL=generateIOSBundles.js.map
146
-
147
- //# debugId=b23b75ff-e7f4-506d-8f68-909661187171
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/utils/generateIOSBundles.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport consts from \"../consts\";\nimport output from \"../output\";\n\nconst IOS_FILE_EXTENSION_PATTERN = /\\.(strings|stringsdict)$/;\n\nexport async function generateIOSBundles(\n localeByVariantApiId: Record<string, string> | undefined\n) {\n const files = fs.readdirSync(consts.TEXT_DIR);\n\n const bundlesGenerated: {\n [bundleName: string]: {\n mappedVariant?: string;\n };\n } = {};\n\n for (const fileName of files) {\n if (!IOS_FILE_EXTENSION_PATTERN.test(fileName)) {\n continue;\n }\n\n const [name, fileExtension] = fileName.split(\".\");\n if (!name.length) {\n continue;\n }\n\n const parts = name.split(\"__\");\n const source = parts[0];\n const variant = parts[parts.length - 1];\n if (!(source && variant)) {\n continue;\n }\n\n const bundleName =\n localeByVariantApiId && localeByVariantApiId[variant]\n ? localeByVariantApiId[variant]\n : variant;\n const bundleFileName = `${bundleName}.lproj`;\n const bundleFolder = path.join(consts.TEXT_DIR, bundleFileName);\n if (!fs.existsSync(bundleFolder)) {\n fs.mkdirSync(bundleFolder);\n }\n\n const filePathCurrent = path.join(consts.TEXT_DIR, fileName);\n const filePathNew = path.join(bundleFolder, `${source}.${fileExtension}`);\n\n handleBundleGeneration(source, fileExtension, filePathCurrent, filePathNew);\n\n bundlesGenerated[bundleFileName] = {\n mappedVariant: variant === bundleName ? undefined : variant,\n };\n }\n\n return (\n Object.keys(bundlesGenerated)\n .map((bundleName) => {\n let msg = `Successfully generated iOS bundle ${output.info(\n bundleName\n )}`;\n const mappedVariant = bundlesGenerated[bundleName].mappedVariant;\n if (mappedVariant) {\n msg += ` ${output.subtle(`(mapped to variant '${mappedVariant}')`)}`;\n }\n return msg;\n })\n .join(\"\\n\") + \"\\n\"\n );\n}\n\nfunction handleBundleGeneration(\n sourceId: string,\n extension: string,\n sourcePath: string,\n newFilePath: string\n) {\n if (!fs.existsSync(newFilePath)) {\n return fs.renameSync(sourcePath, newFilePath);\n }\n\n if (sourceId !== \"components\") {\n throw new Error(\"Bundle path for \" + sourceId + \" already exists\");\n }\n\n if (extension === \"strings\") {\n return appendStringsFile(sourcePath, newFilePath);\n }\n\n if (extension === \"stringsdict\") {\n return appendStringsDictFile(sourcePath, newFilePath);\n }\n\n throw new Error(\"Unsupported extension \" + extension);\n}\n\nfunction appendStringsFile(sourcePath: string, destPath: string) {\n const sourceContents = fs.readFileSync(sourcePath, \"utf-8\");\n const newFileContents = fs.readFileSync(destPath, \"utf-8\");\n const newContents = newFileContents + \"\\n\" + sourceContents;\n fs.writeFileSync(destPath, newContents);\n fs.unlinkSync(sourcePath);\n}\n\nfunction appendStringsDictFile(sourcePath: string, destPath: string) {\n const sourceContentsFull = fs.readFileSync(sourcePath, \"utf-8\");\n const sourceContentsContent = sourceContentsFull.split(\"\\n\").slice(3, -4);\n\n const newFileContentsFull = fs.readFileSync(destPath, \"utf-8\");\n const newFileContentsContent = newFileContentsFull.split(\"\\n\").slice(3, -4);\n\n const newContents = `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<plist version=\"1.0\">\n <dict>\n${[newFileContentsContent, sourceContentsContent].join(\"\\n\")}\n </dict>\n</plist>\n `;\n\n fs.writeFileSync(destPath, newContents);\n fs.unlinkSync(sourcePath);\n}\n"],"names":["fs","consts","path","output"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,gBAAe;AACf,oBAAmB;AACnB,oBAAmB;AAEnB,MAAM,6BAA6B;AAEnC,SAAsB,mBACpB,sBACA;AAAA;AACA,UAAM,QAAQ,UAAAA,QAAG,YAAY,cAAAC,QAAO,QAAQ;AAE5C,UAAM,mBAIF,CAAC;AAEL,eAAW,YAAY,OAAO;AAC5B,UAAI,CAAC,2BAA2B,KAAK,QAAQ,GAAG;AAC9C;AAAA,MACF;AAEA,YAAM,CAAC,MAAM,aAAa,IAAI,SAAS,MAAM,GAAG;AAChD,UAAI,CAAC,KAAK,QAAQ;AAChB;AAAA,MACF;AAEA,YAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,YAAM,SAAS,MAAM,CAAC;AACtB,YAAM,UAAU,MAAM,MAAM,SAAS,CAAC;AACtC,UAAI,EAAE,UAAU,UAAU;AACxB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