@powerlines/plugin-i18next 0.1.238 → 0.1.239

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 (49) hide show
  1. package/README.md +14 -16
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  3. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  4. package/dist/index.cjs +22 -23
  5. package/dist/index.d.cts +0 -1
  6. package/dist/index.d.cts.map +1 -1
  7. package/dist/index.d.mts +0 -1
  8. package/dist/index.d.mts.map +1 -1
  9. package/dist/index.mjs +5 -6
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/{helpers → src/helpers}/config-utils.cjs +6 -6
  12. package/dist/src/helpers/config-utils.mjs.map +1 -0
  13. package/dist/types/i18n.d.cts.map +1 -1
  14. package/dist/types/i18n.d.mts.map +1 -1
  15. package/dist/types/plugin.d.cts.map +1 -1
  16. package/dist/types/plugin.d.mts.map +1 -1
  17. package/package.json +21 -20
  18. package/dist/helpers/config-utils.mjs.map +0 -1
  19. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.cjs +0 -15
  20. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.mjs +0 -15
  21. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.mjs.map +0 -1
  22. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.cjs +0 -20
  23. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.mjs +0 -21
  24. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +0 -1
  25. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.cjs +0 -16
  26. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs +0 -17
  27. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs.map +0 -1
  28. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.cjs +0 -12
  29. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.mjs +0 -12
  30. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.mjs.map +0 -1
  31. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.cjs +0 -19
  32. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.mjs +0 -20
  33. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.mjs.map +0 -1
  34. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.cjs +0 -63
  35. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.mjs +0 -64
  36. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.mjs.map +0 -1
  37. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.cjs +0 -19
  38. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs +0 -20
  39. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs.map +0 -1
  40. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.cjs +0 -19
  41. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs +0 -20
  42. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs.map +0 -1
  43. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.cjs +0 -12
  44. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs +0 -12
  45. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs.map +0 -1
  46. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.cjs +0 -8
  47. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.mjs +0 -8
  48. package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +0 -1
  49. /package/dist/{helpers → src/helpers}/config-utils.mjs +0 -0
package/README.md CHANGED
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.1.231-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.1.238-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -58,21 +58,19 @@ A Powerlines plugin to generate project code with [i18next](https://www.i18next.
58
58
 
59
59
  ## Table of Contents
60
60
 
61
- - [Powerlines - i18next Plugin](#powerlines---i18next-plugin)
62
- - [Table of Contents](#table-of-contents)
63
- - [Installing](#installing)
64
- - [Reduced Package Size](#reduced-package-size)
65
- - [Development](#development)
66
- - [Building](#building)
67
- - [Running unit tests](#running-unit-tests)
68
- - [Linting](#linting)
69
- - [Storm Workspaces](#storm-workspaces)
70
- - [Roadmap](#roadmap)
71
- - [Support](#support)
72
- - [License](#license)
73
- - [Changelog](#changelog)
74
- - [Contributing](#contributing)
75
- - [Contributors](#contributors)
61
+ - [Installing](#installing)
62
+ - [Reduced Package Size](#reduced-package-size)
63
+ - [Development](#development)
64
+ - [Building](#building)
65
+ - [Running unit tests](#running-unit-tests)
66
+ - [Linting](#linting)
67
+ - [Storm Workspaces](#storm-workspaces)
68
+ - [Roadmap](#roadmap)
69
+ - [Support](#support)
70
+ - [License](#license)
71
+ - [Changelog](#changelog)
72
+ - [Contributing](#contributing)
73
+ - [Contributors](#contributors)
76
74
 
77
75
  <!-- END doctoc -->
78
76
 
@@ -1,4 +1,4 @@
1
- //#region rolldown:runtime
1
+ //#region \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+
3
+ export { };
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_is_set = require('./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.cjs');
4
- const require_is_set_object = require('./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.cjs');
5
- const require_is_string = require('./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.cjs');
6
- const require_config_utils = require('./helpers/config-utils.cjs');
7
- let __stryke_fs_list_files = require("@stryke/fs/list-files");
8
- let __stryke_path_append = require("@stryke/path/append");
9
- let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
10
- let __stryke_path_join = require("@stryke/path/join");
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_config_utils = require('./src/helpers/config-utils.cjs');
4
+ let _stryke_fs_list_files = require("@stryke/fs/list-files");
5
+ let _stryke_path_append = require("@stryke/path/append");
6
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
+ let _stryke_path_join = require("@stryke/path/join");
8
+ let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
9
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
10
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
11
  let defu = require("defu");
12
- defu = require_rolldown_runtime.__toESM(defu);
12
+ defu = require_runtime.__toESM(defu);
13
13
  let i18next_cli = require("i18next-cli");
14
14
  let i18next_resources_for_ts = require("i18next-resources-for-ts");
15
15
 
@@ -30,7 +30,7 @@ const plugin = (options = {}) => {
30
30
  name: "i18next",
31
31
  async config() {
32
32
  const i18next = (0, defu.default)(options, { extract: {
33
- output: (language, namespace = "translation") => (0, __stryke_path_join.joinPaths)(this.config.root, `locales/${language}/${namespace}.json`),
33
+ output: (language, namespace = "translation") => (0, _stryke_path_join.joinPaths)(this.config.root, `locales/${language}/${namespace}.json`),
34
34
  primaryLanguage: this.workspaceConfig.locale
35
35
  } }, {
36
36
  extract: {
@@ -51,7 +51,7 @@ const plugin = (options = {}) => {
51
51
  locales: []
52
52
  });
53
53
  if (!i18next.locales || i18next.locales.length === 0) i18next.locales = [i18next.extract.primaryLanguage || "en"];
54
- if (!require_is_set.isSet(i18next.types.indentation)) i18next.types.indentation = i18next.extract.indentation;
54
+ if (!(0, _stryke_type_checks_is_set.isSet)(i18next.types.indentation)) i18next.types.indentation = i18next.extract.indentation;
55
55
  return { i18next };
56
56
  },
57
57
  async configResolved() {},
@@ -76,16 +76,16 @@ const plugin = (options = {}) => {
76
76
  },
77
77
  async types(code) {
78
78
  const resources = [];
79
- for (const file of await (0, __stryke_fs_list_files.listFiles)(require_config_utils.getOutputPath(this.config.i18next.extract.output, this.config.i18next.extract.primaryLanguage, "*"))) {
80
- const namespace = (0, __stryke_path_file_path_fns.findFileName)(file, { withExtension: false });
79
+ for (const file of await (0, _stryke_fs_list_files.listFiles)(require_config_utils.getOutputPath(this.config.i18next.extract.output, this.config.i18next.extract.primaryLanguage, "*"))) {
80
+ const namespace = (0, _stryke_path_file_path_fns.findFileName)(file, { withExtension: false });
81
81
  const parsedContent = await this.resolver.import(file);
82
- if (this.config.i18next.extract.mergeNamespaces && require_is_set_object.isSetObject(parsedContent)) {
83
- if (Object.keys(parsedContent).filter((k) => require_is_set_object.isSetObject(parsedContent[k])).length > 0) {
84
- for (const nsName of Object.keys(parsedContent).filter((k) => require_is_set_object.isSetObject(parsedContent[k]))) resources.push({
82
+ if (this.config.i18next.extract.mergeNamespaces && (0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent)) {
83
+ if (Object.keys(parsedContent).filter((k) => (0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).length > 0) {
84
+ for (const nsName of Object.keys(parsedContent).filter((k) => (0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent[k]))) resources.push({
85
85
  name: nsName,
86
86
  resources: parsedContent[nsName]
87
87
  });
88
- if (Object.keys(parsedContent).filter((k) => !require_is_set_object.isSetObject(parsedContent[k])).length > 0) this.warn(`The file ${file} contains top-level keys that are not objects (${Object.keys(parsedContent).filter((k) => !require_is_set_object.isSetObject(parsedContent[k])).join(", ")}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);
88
+ if (Object.keys(parsedContent).filter((k) => !(0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).length > 0) this.warn(`The file ${file} contains top-level keys that are not objects (${Object.keys(parsedContent).filter((k) => !(0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).join(", ")}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);
89
89
  continue;
90
90
  }
91
91
  }
@@ -95,7 +95,7 @@ const plugin = (options = {}) => {
95
95
  });
96
96
  }
97
97
  let result;
98
- if (this.config.i18next.types.resourcesFile) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.i18next.types.resourcesFile, this.config.i18next.types.output || this.config.root), (0, i18next_resources_for_ts.mergeResourcesAsInterface)(resources, {
98
+ if (this.config.i18next.types.resourcesFile) await this.fs.write((0, _stryke_path_append.appendPath)(this.config.i18next.types.resourcesFile, this.config.i18next.types.output || this.config.root), (0, i18next_resources_for_ts.mergeResourcesAsInterface)(resources, {
99
99
  optimize: !!this.config.i18next.types.enableSelector,
100
100
  indentation: this.config.i18next.types.indentation
101
101
  }));
@@ -113,7 +113,7 @@ ${(0, i18next_resources_for_ts.mergeResourcesAsInterface)(resources, {
113
113
  */
114
114
  declare module 'i18next' {
115
115
  interface CustomTypeOptions {
116
- enableSelector: ${require_is_string.isString(this.config.i18next.types.enableSelector) ? `"${this.config.i18next.types.enableSelector}"` : this.config.i18next.types.enableSelector};
116
+ enableSelector: ${(0, _stryke_type_checks_is_string.isString)(this.config.i18next.types.enableSelector) ? `"${this.config.i18next.types.enableSelector}"` : this.config.i18next.types.enableSelector};
117
117
  defaultNS: ${this.config.i18next.extract.defaultNS === false ? "false" : `'${this.config.i18next.extract.defaultNS || "translation"}'`};
118
118
  resources: Resources;
119
119
  }
@@ -123,8 +123,7 @@ declare module 'i18next' {
123
123
  }
124
124
  };
125
125
  };
126
- var src_default = plugin;
127
126
 
128
127
  //#endregion
129
- exports.default = src_default;
128
+ exports.default = plugin;
130
129
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.cjs";
2
2
  import { Resource, ResourceContent } from "./types/i18n.cjs";
3
- import "./types/index.cjs";
4
3
  import { Plugin } from "powerlines";
5
4
 
6
5
  //#region src/index.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAyCc;EAJU;;;;;AAmBxB;;;;;;;;cAAa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAwCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;;;;;;AAed;;;cAAa,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.mjs";
2
2
  import { Resource, ResourceContent } from "./types/i18n.mjs";
3
- import "./types/index.mjs";
4
3
  import { Plugin } from "powerlines";
5
4
 
6
5
  //#region src/index.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAyCc;EAJU;;;;;AAmBxB;;;;;;;;cAAa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAwCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;;;;;;AAed;;;cAAa,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { isSet } from "./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs";
2
- import { isSetObject } from "./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs";
3
- import { isString } from "./node_modules/.pnpm/@stryke_type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs";
4
- import { getOutputPath } from "./helpers/config-utils.mjs";
1
+ import { getOutputPath } from "./src/helpers/config-utils.mjs";
5
2
  import { listFiles } from "@stryke/fs/list-files";
6
3
  import { appendPath } from "@stryke/path/append";
7
4
  import { findFileName } from "@stryke/path/file-path-fns";
8
5
  import { joinPaths } from "@stryke/path/join";
6
+ import { isSet } from "@stryke/type-checks/is-set";
7
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
8
+ import { isString } from "@stryke/type-checks/is-string";
9
9
  import defu from "defu";
10
10
  import { runExtractor } from "i18next-cli";
11
11
  import { mergeResourcesAsInterface } from "i18next-resources-for-ts";
@@ -120,8 +120,7 @@ declare module 'i18next' {
120
120
  }
121
121
  };
122
122
  };
123
- var src_default = plugin;
124
123
 
125
124
  //#endregion
126
- export { src_default as default, plugin };
125
+ export { plugin as default, plugin };
127
126
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["resources: Resource[]","result!: string"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { I18nextToolkitConfig, runExtractor } from \"i18next-cli\";\nimport { mergeResourcesAsInterface } from \"i18next-resources-for-ts\";\nimport { Plugin } from \"powerlines\";\nimport { getOutputPath } from \"./helpers/config-utils\";\nimport { Resource, ResourceContent } from \"./types/i18n\";\nimport {\n I18NextPluginContext,\n I18NextPluginOptions,\n I18NextPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n i18next?: I18NextPluginOptions;\n }\n}\n\n/**\n * i18next Plugin\n *\n * @remarks\n * A Powerlines plugin to use the i18next internationalization framework during the prepare task.\n *\n * @see https://i18next.com\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends I18NextPluginContext = I18NextPluginContext\n>(\n options: I18NextPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"i18next\",\n async config() {\n const i18next = defu<\n I18NextPluginResolvedConfig[\"i18next\"],\n I18NextPluginOptions[]\n >(\n options,\n {\n extract: {\n output: (language: string, namespace = \"translation\") =>\n joinPaths(\n this.config.root,\n `locales/${language}/${namespace}.json`\n ),\n primaryLanguage: this.workspaceConfig.locale\n }\n },\n {\n extract: {\n input: [\n \"src/**/*.ts\",\n \"src/**/*.tsx\",\n \"src/**/*.js\",\n \"src/**/*.jsx\"\n ],\n indentation: 2,\n defaultNS: \"translation\",\n mergeNamespaces: true,\n nsSeparator: \":\",\n keySeparator: \".\",\n primaryLanguage:\n options.locales && options.locales.length > 0\n ? options.locales[0]\n : \"en\"\n },\n types: {\n enableSelector: false\n },\n locales: [] as string[]\n }\n );\n\n if (!i18next.locales || i18next.locales.length === 0) {\n i18next.locales = [i18next.extract.primaryLanguage || \"en\"];\n }\n\n if (!isSet(i18next.types.indentation)) {\n i18next.types.indentation = i18next.extract.indentation;\n }\n\n return {\n i18next\n };\n },\n async configResolved() {},\n async prepare() {\n await runExtractor(this.config.i18next as I18nextToolkitConfig, {\n isWatchMode: false,\n isDryRun: false,\n syncAll: true,\n syncPrimaryWithDefaults: true,\n logger: {\n info: (message: string) => {\n this.info(message);\n },\n warn: (message: string, _more?: any) => {\n this.warn(message);\n },\n error: (message: string | any) => {\n this.error(message);\n }\n }\n });\n },\n async types(code: string) {\n const resources: Resource[] = [];\n for (const file of await listFiles(\n getOutputPath(\n this.config.i18next.extract.output,\n this.config.i18next.extract.primaryLanguage,\n \"*\"\n )\n )) {\n const namespace = findFileName(file, { withExtension: false });\n const parsedContent = await this.resolver.import<ResourceContent>(file);\n\n // If mergeNamespaces is used, a single file can contain multiple namespaces\n // (e.g. { \"translation\": { ... }, \"common\": { ... } } in a per-language file).\n // In that case, expose each top-level key as a namespace entry so the type\n // generator will produce top-level namespace interfaces (not a language wrapper).\n if (\n this.config.i18next.extract.mergeNamespaces &&\n isSetObject(parsedContent)\n ) {\n // If we have at least one object and we are in mergeNamespaces mode, assume it's a merged file\n if (\n Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n ).length > 0\n ) {\n for (const nsName of Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n )) {\n resources.push({\n name: nsName,\n resources: parsedContent[nsName] as ResourceContent\n });\n }\n\n if (\n Object.keys(parsedContent).filter(\n k => !isSetObject(parsedContent[k])\n ).length > 0\n ) {\n this.warn(\n `The file ${file} contains top-level keys that are not objects (${Object.keys(\n parsedContent\n )\n .filter(k => !isSetObject(parsedContent[k]))\n .join(\n \", \"\n )}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`\n );\n }\n\n continue;\n }\n }\n\n resources.push({ name: namespace, resources: parsedContent });\n }\n\n let result!: string;\n if (this.config.i18next.types.resourcesFile) {\n await this.fs.write(\n appendPath(\n this.config.i18next.types.resourcesFile,\n this.config.i18next.types.output || this.config.root\n ),\n mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n })\n );\n } else {\n result = `${code}\n\n${mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n})}\n\n/**\n * i18next Custom Type Options\n *\n * @see https://www.i18next.com/overview/typescript#custom-type-options\n */\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n enableSelector: ${isString(this.config.i18next.types.enableSelector) ? `\"${this.config.i18next.types.enableSelector}\"` : this.config.i18next.types.enableSelector};\n defaultNS: ${\n this.config.i18next.extract.defaultNS === false\n ? \"false\"\n : `'${this.config.i18next.extract.defaultNS || \"translation\"}'`\n };\n resources: Resources;\n }\n}\n`;\n }\n\n return result;\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,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,QAAQ,aAAa,cAAc,GAChE;;;;;AAOC,UAAO;;EAEV;;AAGH,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { I18nextToolkitConfig, runExtractor } from \"i18next-cli\";\nimport { mergeResourcesAsInterface } from \"i18next-resources-for-ts\";\nimport { Plugin } from \"powerlines\";\nimport { getOutputPath } from \"./helpers/config-utils\";\nimport { Resource, ResourceContent } from \"./types/i18n\";\nimport {\n I18NextPluginContext,\n I18NextPluginOptions,\n I18NextPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n i18next?: I18NextPluginOptions;\n }\n}\n\n/**\n * i18next Plugin\n *\n * @remarks\n * A Powerlines plugin to use the i18next internationalization framework during the prepare task.\n *\n * @see https://i18next.com\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends I18NextPluginContext = I18NextPluginContext\n>(\n options: I18NextPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"i18next\",\n async config() {\n const i18next = defu<\n I18NextPluginResolvedConfig[\"i18next\"],\n I18NextPluginOptions[]\n >(\n options,\n {\n extract: {\n output: (language: string, namespace = \"translation\") =>\n joinPaths(\n this.config.root,\n `locales/${language}/${namespace}.json`\n ),\n primaryLanguage: this.workspaceConfig.locale\n }\n },\n {\n extract: {\n input: [\n \"src/**/*.ts\",\n \"src/**/*.tsx\",\n \"src/**/*.js\",\n \"src/**/*.jsx\"\n ],\n indentation: 2,\n defaultNS: \"translation\",\n mergeNamespaces: true,\n nsSeparator: \":\",\n keySeparator: \".\",\n primaryLanguage:\n options.locales && options.locales.length > 0\n ? options.locales[0]\n : \"en\"\n },\n types: {\n enableSelector: false\n },\n locales: [] as string[]\n }\n );\n\n if (!i18next.locales || i18next.locales.length === 0) {\n i18next.locales = [i18next.extract.primaryLanguage || \"en\"];\n }\n\n if (!isSet(i18next.types.indentation)) {\n i18next.types.indentation = i18next.extract.indentation;\n }\n\n return {\n i18next\n };\n },\n async configResolved() {},\n async prepare() {\n await runExtractor(this.config.i18next as I18nextToolkitConfig, {\n isWatchMode: false,\n isDryRun: false,\n syncAll: true,\n syncPrimaryWithDefaults: true,\n logger: {\n info: (message: string) => {\n this.info(message);\n },\n warn: (message: string, _more?: any) => {\n this.warn(message);\n },\n error: (message: string | any) => {\n this.error(message);\n }\n }\n });\n },\n async types(code: string) {\n const resources: Resource[] = [];\n for (const file of await listFiles(\n getOutputPath(\n this.config.i18next.extract.output,\n this.config.i18next.extract.primaryLanguage,\n \"*\"\n )\n )) {\n const namespace = findFileName(file, { withExtension: false });\n const parsedContent = await this.resolver.import<ResourceContent>(file);\n\n // If mergeNamespaces is used, a single file can contain multiple namespaces\n // (e.g. { \"translation\": { ... }, \"common\": { ... } } in a per-language file).\n // In that case, expose each top-level key as a namespace entry so the type\n // generator will produce top-level namespace interfaces (not a language wrapper).\n if (\n this.config.i18next.extract.mergeNamespaces &&\n isSetObject(parsedContent)\n ) {\n // If we have at least one object and we are in mergeNamespaces mode, assume it's a merged file\n if (\n Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n ).length > 0\n ) {\n for (const nsName of Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n )) {\n resources.push({\n name: nsName,\n resources: parsedContent[nsName] as ResourceContent\n });\n }\n\n if (\n Object.keys(parsedContent).filter(\n k => !isSetObject(parsedContent[k])\n ).length > 0\n ) {\n this.warn(\n `The file ${file} contains top-level keys that are not objects (${Object.keys(\n parsedContent\n )\n .filter(k => !isSetObject(parsedContent[k]))\n .join(\n \", \"\n )}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`\n );\n }\n\n continue;\n }\n }\n\n resources.push({ name: namespace, resources: parsedContent });\n }\n\n let result!: string;\n if (this.config.i18next.types.resourcesFile) {\n await this.fs.write(\n appendPath(\n this.config.i18next.types.resourcesFile,\n this.config.i18next.types.output || this.config.root\n ),\n mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n })\n );\n } else {\n result = `${code}\n\n${mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n})}\n\n/**\n * i18next Custom Type Options\n *\n * @see https://www.i18next.com/overview/typescript#custom-type-options\n */\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n enableSelector: ${isString(this.config.i18next.types.enableSelector) ? `\"${this.config.i18next.types.enableSelector}\"` : this.config.i18next.types.enableSelector};\n defaultNS: ${\n this.config.i18next.extract.defaultNS === false\n ? \"false\"\n : `'${this.config.i18next.extract.defaultNS || \"translation\"}'`\n };\n resources: Resources;\n }\n}\n`;\n }\n\n return result;\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,MAAM,SAAS;GACb,MAAM,UAAU,KAId,SACA,EACE,SAAS;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
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let __stryke_path_correct_path = require("@stryke/path/correct-path");
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+ let _stryke_path_correct_path = require("@stryke/path/correct-path");
3
3
 
4
4
  //#region src/helpers/config-utils.ts
5
5
  /**
@@ -13,18 +13,18 @@ let __stryke_path_correct_path = require("@stryke/path/correct-path");
13
13
  * - Normalizes duplicate slashes and returns a platform-correct path.
14
14
  */
15
15
  function getOutputPath(outputTemplate, language, namespace) {
16
- if (!outputTemplate) return (0, __stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
16
+ if (!outputTemplate) return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
17
17
  if (typeof outputTemplate === "function") try {
18
- return (0, __stryke_path_correct_path.correctPath)(String(outputTemplate(language, namespace)).replace(/\/{2,}/g, "/"));
18
+ return (0, _stryke_path_correct_path.correctPath)(String(outputTemplate(language, namespace)).replace(/\/{2,}/g, "/"));
19
19
  } catch {
20
- return (0, __stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
20
+ return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
21
21
  }
22
22
  let out = String(outputTemplate);
23
23
  out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
24
24
  if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
25
25
  else out = out.replace(/\/?\{\{namespace\}\}/g, "");
26
26
  out = out.replace(/\/{2,}/g, "/");
27
- return (0, __stryke_path_correct_path.correctPath)(out);
27
+ return (0, _stryke_path_correct_path.correctPath)(out);
28
28
  }
29
29
 
30
30
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-utils.mjs","names":[],"sources":["../../../src/helpers/config-utils.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { correctPath } from \"@stryke/path/correct-path\";\n\n/**\n * Resolve an output template (string or function) into an actual path string.\n *\n * @remarks\n * - If `outputTemplate` is a function, call it with (language, namespace)\n * - If it's a string, replace placeholders:\n * - \\{\\{language\\}\\} or \\{\\{lng\\}\\} -\\> language\n * - \\{\\{namespace\\}\\} -\\> namespace (or removed if namespace is undefined)\n * - Normalizes duplicate slashes and returns a platform-correct path.\n */\nexport function getOutputPath(\n outputTemplate:\n | string\n | ((language: string, namespace?: string) => string)\n | undefined,\n language: string,\n namespace?: string\n): string {\n if (!outputTemplate) {\n // Fallback to a sensible default\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n\n if (typeof outputTemplate === \"function\") {\n try {\n const result = String(outputTemplate(language, namespace));\n\n return correctPath(result.replace(/\\/{2,}/g, \"/\"));\n } catch {\n // If user function throws, fallback to default path\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n }\n\n // It's a string template\n let out = String(outputTemplate);\n out = out.replace(/\\{\\{language\\}\\}|\\{\\{lng\\}\\}/g, language);\n\n if (namespace !== undefined && namespace !== null) {\n out = out.replace(/\\{\\{namespace\\}\\}/g, namespace);\n } else {\n // remove any occurrences of /{{namespace}} or {{namespace}} (keeping surrounding slashes tidy)\n out = out.replace(/\\/?\\{\\{namespace\\}\\}/g, \"\");\n }\n\n // collapse duplicate slashes and normalize to platform-specific separators\n out = out.replace(/\\/{2,}/g, \"/\");\n return correctPath(out);\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,cACd,gBAIA,UACA,WACQ;AACR,KAAI,CAAC,eAEH,QAAO,YACL,WAAW,SAAS,GAAG,aAAa,cAAc,OACnD;AAGH,KAAI,OAAO,mBAAmB,WAC5B,KAAI;AAGF,SAAO,YAFQ,OAAO,eAAe,UAAU,UAAU,CAAC,CAEhC,QAAQ,WAAW,IAAI,CAAC;SAC5C;AAEN,SAAO,YACL,WAAW,SAAS,GAAG,aAAa,cAAc,OACnD;;CAKL,IAAI,MAAM,OAAO,eAAe;AAChC,OAAM,IAAI,QAAQ,iCAAiC,SAAS;AAE5D,KAAI,cAAc,UAAa,cAAc,KAC3C,OAAM,IAAI,QAAQ,sBAAsB,UAAU;KAGlD,OAAM,IAAI,QAAQ,yBAAyB,GAAG;AAIhD,OAAM,IAAI,QAAQ,WAAW,IAAI;AACjC,QAAO,YAAY,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.cts","names":[],"sources":["../../src/types/i18n.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAOA;UAPiB,eAAA;0BACS;;;;;UAMT,QAAA;;;;;;;;aASJ"}
1
+ {"version":3,"file":"i18n.d.cts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":";;AAqBA;;UAAiB,eAAA;EAAA,CACd,GAAA,oBAAuB,eAAA;AAAA;AAM1B;;;AAAA,UAAiB,QAAA;EAIf;;;EAAA,IAAA;EAK0B;;;EAA1B,SAAA,EAAW,eAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.mts","names":[],"sources":["../../src/types/i18n.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAOA;UAPiB,eAAA;0BACS;;;;;UAMT,QAAA;;;;;;;;aASJ"}
1
+ {"version":3,"file":"i18n.d.mts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":";;AAqBA;;UAAiB,eAAA;EAAA,CACd,GAAA,oBAAuB,eAAA;AAAA;AAM1B;;;AAAA,UAAiB,QAAA;EAIf;;;EAAA,IAAA;EAK0B;;;EAA1B,SAAA,EAAW,eAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,oBAAA,GAAuB,YAAY;KAEnC,uBAAA,GAA0B;EAF1B,OAAA,CAAA,EAGA,oBAHoB;AAEhC,CAAA;AAIY,KAAA,2BAAA,GAA8B,cAAH,GAAA;EAAG,OAAA,EAC/B,IAD+B,CAC1B,oBAD0B,EAAA,SAAA,GAAA,OAAA,CAAA,GAAA;IAC1B,OAAA,EACH,IADG,CAEV,oBAFU,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,GAKV,QALU,CAMR,IANQ,CAON,oBAPM,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,CAAA;IAAL,KAAA,EAWA,IAXA,CAYL,WAZK,CAYO,oBAZP,CAAA,OAAA,CAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,gBAAA,GAAA,aAAA,CAAA,GAAA;MAEL,KAAA,CAAA,EAAA,MAAA;MADO,MAAA,CAAA,EAAA,MAAA;MAMH,cAAA,EAAA,OAAA,GAAA,UAAA;MADF,WAAA,EAAA,MAAA,GAAA,MAAA;IADF,CAAA;EAOY,CAAA;CAAZ;AADK,KAYC,oBAZD,CAAA,wBAae,2BAbf,GAcP,2BAdO,CAAA,GAeP,aAfO,CAeO,eAfP,CAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KAsBY,oBAAA,GAAuB,WAAA,CAAY,oBAAA;AAAA,KAEnC,uBAAA,GAA0B,UAAA;EACpC,OAAA,GAAU,oBAAA;AAAA;AAAA,KAGA,2BAAA,GAA8B,cAAA;EACxC,OAAA,EAAS,IAAA,CAAK,oBAAA;IACZ,OAAA,EAAS,IAAA,CACP,oBAAA,6DAGA,QAAA,CACE,IAAA,CACE,oBAAA;IAIN,KAAA,EAAO,IAAA,CACL,WAAA,CAAY,oBAAA;MAGZ,KAAA;MACA,MAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;AAAA;AAAA,KAKM,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,oBAAA,GAAuB,YAAY;KAEnC,uBAAA,GAA0B;EAF1B,OAAA,CAAA,EAGA,oBAHoB;AAEhC,CAAA;AAIY,KAAA,2BAAA,GAA8B,cAAH,GAAA;EAAG,OAAA,EAC/B,IAD+B,CAC1B,oBAD0B,EAAA,SAAA,GAAA,OAAA,CAAA,GAAA;IAC1B,OAAA,EACH,IADG,CAEV,oBAFU,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,GAKV,QALU,CAMR,IANQ,CAON,oBAPM,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,CAAA;IAAL,KAAA,EAWA,IAXA,CAYL,WAZK,CAYO,oBAZP,CAAA,OAAA,CAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,gBAAA,GAAA,aAAA,CAAA,GAAA;MAEL,KAAA,CAAA,EAAA,MAAA;MADO,MAAA,CAAA,EAAA,MAAA;MAMH,cAAA,EAAA,OAAA,GAAA,UAAA;MADF,WAAA,EAAA,MAAA,GAAA,MAAA;IADF,CAAA;EAOY,CAAA;CAAZ;AADK,KAYC,oBAZD,CAAA,wBAae,2BAbf,GAcP,2BAdO,CAAA,GAeP,aAfO,CAeO,eAfP,CAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KAsBY,oBAAA,GAAuB,WAAA,CAAY,oBAAA;AAAA,KAEnC,uBAAA,GAA0B,UAAA;EACpC,OAAA,GAAU,oBAAA;AAAA;AAAA,KAGA,2BAAA,GAA8B,cAAA;EACxC,OAAA,EAAS,IAAA,CAAK,oBAAA;IACZ,OAAA,EAAS,IAAA,CACP,oBAAA,6DAGA,QAAA,CACE,IAAA,CACE,oBAAA;IAIN,KAAA,EAAO,IAAA,CACL,WAAA,CAAY,oBAAA;MAGZ,KAAA;MACA,MAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;AAAA;AAAA,KAKM,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA"}
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-i18next",
3
- "version": "0.1.238",
4
- "type": "module",
3
+ "version": "0.1.239",
4
+ "private": false,
5
5
  "description": "A Powerlines plugin to use i18next for internationalization.",
6
+ "keywords": ["i18next", "powerlines", "storm-software", "powerlines-plugin"],
7
+ "homepage": "https://stormsoftware.com",
8
+ "bugs": {
9
+ "url": "https://stormsoftware.com/support",
10
+ "email": "support@stormsoftware.com"
11
+ },
6
12
  "repository": {
7
13
  "type": "github",
8
14
  "url": "https://github.com/storm-software/powerlines.git",
9
15
  "directory": "packages/plugin-i18next"
10
16
  },
11
- "homepage": "https://stormsoftware.com",
12
- "bugs": {
13
- "url": "https://stormsoftware.com/support",
14
- "email": "support@stormsoftware.com"
17
+ "funding": {
18
+ "type": "github",
19
+ "url": "https://github.com/sponsors/storm-software"
15
20
  },
21
+ "license": "Apache-2.0",
16
22
  "author": {
17
23
  "name": "Storm Software",
18
24
  "email": "contact@stormsoftware.com",
@@ -32,14 +38,7 @@
32
38
  "url": "https://stormsoftware.com"
33
39
  }
34
40
  ],
35
- "funding": {
36
- "type": "github",
37
- "url": "https://github.com/sponsors/storm-software"
38
- },
39
- "license": "Apache-2.0",
40
- "private": false,
41
- "main": "./dist/index.cjs",
42
- "module": "./dist/index.mjs",
41
+ "type": "module",
43
42
  "exports": {
44
43
  ".": {
45
44
  "require": {
@@ -55,7 +54,7 @@
55
54
  "default": "./dist/index.mjs"
56
55
  }
57
56
  },
58
- "./*": "./*",
57
+ "./package.json": "./package.json",
59
58
  "./types": {
60
59
  "require": {
61
60
  "types": "./dist/types/index.d.cts",
@@ -99,23 +98,25 @@
99
98
  }
100
99
  }
101
100
  },
101
+ "main": "./dist/index.cjs",
102
+ "module": "./dist/index.mjs",
103
+ "types": "./dist/index.d.cts",
102
104
  "typings": "dist/index.d.mts",
103
105
  "files": ["dist/**/*"],
104
- "keywords": ["i18next", "powerlines", "storm-software", "powerlines-plugin"],
105
106
  "dependencies": {
106
107
  "@stryke/fs": "^0.33.57",
107
108
  "@stryke/path": "^0.26.19",
109
+ "@stryke/type-checks": "^0.5.38",
108
110
  "@stryke/types": "^0.10.52",
109
111
  "defu": "^6.1.4",
110
112
  "i18next-cli": "^1.49.6",
111
113
  "i18next-resources-for-ts": "^2.0.1",
112
- "powerlines": "^0.41.6"
114
+ "powerlines": "^0.41.7"
113
115
  },
114
116
  "devDependencies": {
115
- "@powerlines/plugin-plugin": "^0.12.292",
117
+ "@powerlines/plugin-plugin": "^0.12.293",
116
118
  "@types/node": "^25.4.0"
117
119
  },
118
120
  "publishConfig": { "access": "public" },
119
- "types": "./dist/index.d.cts",
120
- "gitHead": "86bbe64da57a38d472b37261ca9d113171841a6c"
121
+ "gitHead": "2fb48143904805988bac9bdbc04cdc4a35ff398b"
121
122
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.mjs","names":[],"sources":["../../src/helpers/config-utils.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { correctPath } from \"@stryke/path/correct-path\";\n\n/**\n * Resolve an output template (string or function) into an actual path string.\n *\n * @remarks\n * - If `outputTemplate` is a function, call it with (language, namespace)\n * - If it's a string, replace placeholders:\n * - \\{\\{language\\}\\} or \\{\\{lng\\}\\} -\\> language\n * - \\{\\{namespace\\}\\} -\\> namespace (or removed if namespace is undefined)\n * - Normalizes duplicate slashes and returns a platform-correct path.\n */\nexport function getOutputPath(\n outputTemplate:\n | string\n | ((language: string, namespace?: string) => string)\n | undefined,\n language: string,\n namespace?: string\n): string {\n if (!outputTemplate) {\n // Fallback to a sensible default\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n\n if (typeof outputTemplate === \"function\") {\n try {\n const result = String(outputTemplate(language, namespace));\n\n return correctPath(result.replace(/\\/{2,}/g, \"/\"));\n } catch {\n // If user function throws, fallback to default path\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n }\n\n // It's a string template\n let out = String(outputTemplate);\n out = out.replace(/\\{\\{language\\}\\}|\\{\\{lng\\}\\}/g, language);\n\n if (namespace !== undefined && namespace !== null) {\n out = out.replace(/\\{\\{namespace\\}\\}/g, namespace);\n } else {\n // remove any occurrences of /{{namespace}} or {{namespace}} (keeping surrounding slashes tidy)\n out = out.replace(/\\/?\\{\\{namespace\\}\\}/g, \"\");\n }\n\n // collapse duplicate slashes and normalize to platform-specific separators\n out = out.replace(/\\/{2,}/g, \"/\");\n return correctPath(out);\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,cACd,gBAIA,UACA,WACQ;AACR,KAAI,CAAC,eAEH,QAAO,YACL,WAAW,SAAS,GAAG,aAAa,cAAc,OACnD;AAGH,KAAI,OAAO,mBAAmB,WAC5B,KAAI;AAGF,SAAO,YAFQ,OAAO,eAAe,UAAU,UAAU,CAAC,CAEhC,QAAQ,WAAW,IAAI,CAAC;SAC5C;AAEN,SAAO,YACL,WAAW,SAAS,GAAG,aAAa,cAAc,OACnD;;CAKL,IAAI,MAAM,OAAO,eAAe;AAChC,OAAM,IAAI,QAAQ,iCAAiC,SAAS;AAE5D,KAAI,cAAc,UAAa,cAAc,KAC3C,OAAM,IAAI,QAAQ,sBAAsB,UAAU;KAGlD,OAAM,IAAI,QAAQ,yBAAyB,GAAG;AAIhD,OAAM,IAAI,QAAQ,WAAW,IAAI;AACjC,QAAO,YAAY,IAAI"}
@@ -1,15 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.mjs
3
- /**
4
- * Gets the `toStringTag` of `obj`.
5
- *
6
- * @param value - The obj to query.
7
- * @returns Returns the `toStringTag`.
8
- */
9
- const getObjectTag = (value) => {
10
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
11
- return Object.prototype.toString.call(value);
12
- };
13
-
14
- //#endregion
15
- exports.getObjectTag = getObjectTag;
@@ -1,15 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.mjs
2
- /**
3
- * Gets the `toStringTag` of `obj`.
4
- *
5
- * @param value - The obj to query.
6
- * @returns Returns the `toStringTag`.
7
- */
8
- const getObjectTag = (value) => {
9
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
10
- return Object.prototype.toString.call(value);
11
- };
12
-
13
- //#endregion
14
- export { getObjectTag };
15
- //# sourceMappingURL=get-object-tag.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-object-tag.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/get-object-tag.mjs"],"sourcesContent":["//#region src/get-object-tag.ts\n/**\n* Gets the `toStringTag` of `obj`.\n*\n* @param value - The obj to query.\n* @returns Returns the `toStringTag`.\n*/\nconst getObjectTag = (value) => {\n\tif (value == null) return value === void 0 ? \"[object Undefined]\" : \"[object Null]\";\n\treturn Object.prototype.toString.call(value);\n};\n\n//#endregion\nexport { getObjectTag };\n//# sourceMappingURL=get-object-tag.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAOA,MAAM,gBAAgB,UAAU;AAC/B,KAAI,SAAS,KAAM,QAAO,UAAU,KAAK,IAAI,uBAAuB;AACpE,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM"}
@@ -1,20 +0,0 @@
1
- const require_is_null = require('./is-null.cjs');
2
- const require_is_undefined = require('./is-undefined.cjs');
3
-
4
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.mjs
5
- /**
6
- * Check if the provided value's type is `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
- */
11
- const isEmpty = (value) => {
12
- try {
13
- return require_is_undefined.isUndefined(value) || require_is_null.isNull(value);
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- exports.isEmpty = isEmpty;
@@ -1,21 +0,0 @@
1
- import { isNull } from "./is-null.mjs";
2
- import { isUndefined } from "./is-undefined.mjs";
3
-
4
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.mjs
5
- /**
6
- * Check if the provided value's type is `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
- */
11
- const isEmpty = (value) => {
12
- try {
13
- return isUndefined(value) || isNull(value);
14
- } catch {
15
- return false;
16
- }
17
- };
18
-
19
- //#endregion
20
- export { isEmpty };
21
- //# sourceMappingURL=is-empty.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-empty.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-empty.mjs"],"sourcesContent":["import { isDate } from \"./is-date.mjs\";\nimport { isFunction } from \"./is-function.mjs\";\nimport { isNull } from \"./is-null.mjs\";\nimport { isNumber } from \"./is-number.mjs\";\nimport { isSymbol } from \"./is-symbol.mjs\";\nimport { isUndefined } from \"./is-undefined.mjs\";\n\n//#region src/is-empty.ts\n/**\n* Check if the provided value's type is `null` or `undefined`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `null` or `undefined`\n*/\nconst isEmpty = (value) => {\n\ttry {\n\t\treturn isUndefined(value) || isNull(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\nconst isEmptyAnything = (value) => {\n\tif (value === true || value === false) return true;\n\tif (value === null || value === void 0) return true;\n\tif (isNumber(value)) return value === 0;\n\tif (isDate(value)) return Number.isNaN(value.getTime());\n\tif (isFunction(value)) return false;\n\tif (isSymbol(value)) return false;\n\tconst { length } = value;\n\tif (isNumber(length)) return length === 0;\n\tconst { size } = value;\n\tif (isNumber(size)) return size === 0;\n\treturn Object.keys(value).length === 0;\n};\n\n//#endregion\nexport { isEmpty, isEmptyAnything };\n//# sourceMappingURL=is-empty.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAcA,MAAM,WAAW,UAAU;AAC1B,KAAI;AACH,SAAO,YAAY,MAAM,IAAI,OAAO,MAAM;SACnC;AACP,SAAO"}
@@ -1,16 +0,0 @@
1
- const require_is_set = require('./is-set.cjs');
2
- const require_is_object = require('./is-object.cjs');
3
-
4
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs
5
- /**
6
- * Check if the provided value's type is `Object` and is not `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
10
- */
11
- const isNonNullObject = (value) => {
12
- return require_is_set.isSet(value) && require_is_object.isObject(value);
13
- };
14
-
15
- //#endregion
16
- exports.isNonNullObject = isNonNullObject;
@@ -1,17 +0,0 @@
1
- import { isSet } from "./is-set.mjs";
2
- import { isObject } from "./is-object.mjs";
3
-
4
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs
5
- /**
6
- * Check if the provided value's type is `Object` and is not `null` or `undefined`
7
- *
8
- * @param value - The value to type check
9
- * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
10
- */
11
- const isNonNullObject = (value) => {
12
- return isSet(value) && isObject(value);
13
- };
14
-
15
- //#endregion
16
- export { isNonNullObject };
17
- //# sourceMappingURL=is-non-null-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-non-null-object.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs"],"sourcesContent":["import { isObject } from \"./is-object.mjs\";\nimport { isSet } from \"./is-set.mjs\";\n\n//#region src/is-non-null-object.ts\n/**\n* Check if the provided value's type is `Object` and is not `null` or `undefined`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`\n*/\nconst isNonNullObject = (value) => {\n\treturn isSet(value) && isObject(value);\n};\n\n//#endregion\nexport { isNonNullObject };\n//# sourceMappingURL=is-non-null-object.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAUA,MAAM,mBAAmB,UAAU;AAClC,QAAO,MAAM,MAAM,IAAI,SAAS,MAAM"}
@@ -1,12 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.mjs
3
- const isNull = (value) => {
4
- try {
5
- return value === null;
6
- } catch {
7
- return false;
8
- }
9
- };
10
-
11
- //#endregion
12
- exports.isNull = isNull;
@@ -1,12 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.mjs
2
- const isNull = (value) => {
3
- try {
4
- return value === null;
5
- } catch {
6
- return false;
7
- }
8
- };
9
-
10
- //#endregion
11
- export { isNull };
12
- //# sourceMappingURL=is-null.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-null.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-null.mjs"],"sourcesContent":["//#region src/is-null.ts\nconst isNull = (value) => {\n\ttry {\n\t\treturn value === null;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isNull };\n//# sourceMappingURL=is-null.mjs.map"],"x_google_ignoreList":[0],"mappings":";AACA,MAAM,UAAU,UAAU;AACzB,KAAI;AACH,SAAO,UAAU;SACV;AACP,SAAO"}
@@ -1,19 +0,0 @@
1
- const require_is_plain_object = require('./is-plain-object.cjs');
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.mjs
4
- /**
5
- * Check if the provided value's type is `Object`
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is of type `Object`
9
- */
10
- const isObject = (value) => {
11
- try {
12
- return typeof value === "object" || Boolean(value) && value?.constructor === Object || require_is_plain_object.isPlainObject(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isObject = isObject;
@@ -1,20 +0,0 @@
1
- import { isPlainObject } from "./is-plain-object.mjs";
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.mjs
4
- /**
5
- * Check if the provided value's type is `Object`
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is of type `Object`
9
- */
10
- const isObject = (value) => {
11
- try {
12
- return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isObject };
20
- //# sourceMappingURL=is-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-object.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-object.mjs"],"sourcesContent":["import { isPlainObject } from \"./is-plain-object.mjs\";\n\n//#region src/is-object.ts\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n/** Is ES6+ class */\nfunction isNativeClass(value) {\n\treturn typeof value === \"function\" && isNativeClassRegex.test(value.toString());\n}\n/**\n* Check if the provided value's type is a conventional class\n*\n* @remarks\n* Is Conventional Class\n* Looks for function with capital first letter MyClass\n* First letter is the 9th character\n* If changed, isClass must also be updated\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is a conventional class\n*/\nfunction isConventionalClass(value) {\n\treturn typeof value === \"function\" && isConventionalClassRegex.test(value.toString());\n}\nfunction isClass(value) {\n\treturn typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n/**\n* Check if the provided value's type is `Object`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `Object`\n*/\nconst isObject = (value) => {\n\ttry {\n\t\treturn typeof value === \"object\" || Boolean(value) && value?.constructor === Object || isPlainObject(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isClass, isConventionalClass, isNativeClass, isObject };\n//# sourceMappingURL=is-object.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AAkCA,MAAM,YAAY,UAAU;AAC3B,KAAI;AACH,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAAU,cAAc,MAAM;SACpG;AACP,SAAO"}
@@ -1,63 +0,0 @@
1
- const require_get_object_tag = require('./get-object-tag.cjs');
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.mjs
4
- /**
5
- * Checks if `value` is object-like. A value is object-like if it's not `null`
6
- * and has a `typeof` result of "object".
7
- *
8
- * @example
9
- * ```typescript
10
- * isObjectLike({})
11
- * // => true
12
- *
13
- * isObjectLike([1, 2, 3])
14
- * // => true
15
- *
16
- * isObjectLike(Function)
17
- * // => false
18
- *
19
- * isObjectLike(null)
20
- * // => false
21
- * ```
22
- *
23
- * @param value - The value to check.
24
- * @returns Returns `true` if `value` is object-like, else `false`.
25
- */
26
- const isObjectLike = (obj) => {
27
- return typeof obj === "object" && obj !== null;
28
- };
29
- /**
30
- * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
31
- *
32
- * @example
33
- * ```typescript
34
- * function Foo() {
35
- * this.a = 1
36
- * }
37
- *
38
- * isPlainObject(new Foo)
39
- * // => false
40
- *
41
- * isPlainObject([1, 2, 3])
42
- * // => false
43
- *
44
- * isPlainObject({ 'x': 0, 'y': 0 })
45
- * // => true
46
- *
47
- * isPlainObject(Object.create(null))
48
- * // => true
49
- * ```
50
- *
51
- * @param obj - The value to check.
52
- * @returns Returns `true` if `obj` is a plain object, else `false`.
53
- */
54
- const isPlainObject = (obj) => {
55
- if (!isObjectLike(obj) || require_get_object_tag.getObjectTag(obj) !== "[object Object]") return false;
56
- if (Object.getPrototypeOf(obj) === null) return true;
57
- let proto = obj;
58
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
59
- return Object.getPrototypeOf(obj) === proto;
60
- };
61
-
62
- //#endregion
63
- exports.isPlainObject = isPlainObject;
@@ -1,64 +0,0 @@
1
- import { getObjectTag } from "./get-object-tag.mjs";
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.mjs
4
- /**
5
- * Checks if `value` is object-like. A value is object-like if it's not `null`
6
- * and has a `typeof` result of "object".
7
- *
8
- * @example
9
- * ```typescript
10
- * isObjectLike({})
11
- * // => true
12
- *
13
- * isObjectLike([1, 2, 3])
14
- * // => true
15
- *
16
- * isObjectLike(Function)
17
- * // => false
18
- *
19
- * isObjectLike(null)
20
- * // => false
21
- * ```
22
- *
23
- * @param value - The value to check.
24
- * @returns Returns `true` if `value` is object-like, else `false`.
25
- */
26
- const isObjectLike = (obj) => {
27
- return typeof obj === "object" && obj !== null;
28
- };
29
- /**
30
- * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
31
- *
32
- * @example
33
- * ```typescript
34
- * function Foo() {
35
- * this.a = 1
36
- * }
37
- *
38
- * isPlainObject(new Foo)
39
- * // => false
40
- *
41
- * isPlainObject([1, 2, 3])
42
- * // => false
43
- *
44
- * isPlainObject({ 'x': 0, 'y': 0 })
45
- * // => true
46
- *
47
- * isPlainObject(Object.create(null))
48
- * // => true
49
- * ```
50
- *
51
- * @param obj - The value to check.
52
- * @returns Returns `true` if `obj` is a plain object, else `false`.
53
- */
54
- const isPlainObject = (obj) => {
55
- if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
56
- if (Object.getPrototypeOf(obj) === null) return true;
57
- let proto = obj;
58
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
59
- return Object.getPrototypeOf(obj) === proto;
60
- };
61
-
62
- //#endregion
63
- export { isPlainObject };
64
- //# sourceMappingURL=is-plain-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-plain-object.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-plain-object.mjs"],"sourcesContent":["import { getObjectTag } from \"./get-object-tag.mjs\";\n\n//#region src/is-plain-object.ts\n/**\n* Checks if `value` is object-like. A value is object-like if it's not `null`\n* and has a `typeof` result of \"object\".\n*\n* @example\n* ```typescript\n* isObjectLike({})\n* // => true\n*\n* isObjectLike([1, 2, 3])\n* // => true\n*\n* isObjectLike(Function)\n* // => false\n*\n* isObjectLike(null)\n* // => false\n* ```\n*\n* @param value - The value to check.\n* @returns Returns `true` if `value` is object-like, else `false`.\n*/\nconst isObjectLike = (obj) => {\n\treturn typeof obj === \"object\" && obj !== null;\n};\n/**\n* Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n*\n* @example\n* ```typescript\n* function Foo() {\n* this.a = 1\n* }\n*\n* isPlainObject(new Foo)\n* // => false\n*\n* isPlainObject([1, 2, 3])\n* // => false\n*\n* isPlainObject({ 'x': 0, 'y': 0 })\n* // => true\n*\n* isPlainObject(Object.create(null))\n* // => true\n* ```\n*\n* @param obj - The value to check.\n* @returns Returns `true` if `obj` is a plain object, else `false`.\n*/\nconst isPlainObject = (obj) => {\n\tif (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") return false;\n\tif (Object.getPrototypeOf(obj) === null) return true;\n\tlet proto = obj;\n\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\n\treturn Object.getPrototypeOf(obj) === proto;\n};\n\n//#endregion\nexport { isObjectLike, isPlainObject };\n//# sourceMappingURL=is-plain-object.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,gBAAgB,QAAQ;AAC7B,QAAO,OAAO,QAAQ,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B3C,MAAM,iBAAiB,QAAQ;AAC9B,KAAI,CAAC,aAAa,IAAI,IAAI,aAAa,IAAI,KAAK,kBAAmB,QAAO;AAC1E,KAAI,OAAO,eAAe,IAAI,KAAK,KAAM,QAAO;CAChD,IAAI,QAAQ;AACZ,QAAO,OAAO,eAAe,MAAM,KAAK,KAAM,SAAQ,OAAO,eAAe,MAAM;AAClF,QAAO,OAAO,eAAe,IAAI,KAAK"}
@@ -1,19 +0,0 @@
1
- const require_is_non_null_object = require('./is-non-null-object.cjs');
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs
4
- /**
5
- * Check if the provided value's type is an object with some fields set
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is an object with some fields se
9
- */
10
- const isSetObject = (value) => {
11
- try {
12
- return require_is_non_null_object.isNonNullObject(value) && Object.keys(value).length > 0;
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isSetObject = isSetObject;
@@ -1,20 +0,0 @@
1
- import { isNonNullObject } from "./is-non-null-object.mjs";
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs
4
- /**
5
- * Check if the provided value's type is an object with some fields set
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is an object with some fields se
9
- */
10
- const isSetObject = (value) => {
11
- try {
12
- return isNonNullObject(value) && Object.keys(value).length > 0;
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isSetObject };
20
- //# sourceMappingURL=is-set-object.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-set-object.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set-object.mjs"],"sourcesContent":["import { isNonNullObject } from \"./is-non-null-object.mjs\";\n\n//#region src/is-set-object.ts\n/**\n* Check if the provided value's type is an object with some fields set\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is an object with some fields se\n*/\nconst isSetObject = (value) => {\n\ttry {\n\t\treturn isNonNullObject(value) && Object.keys(value).length > 0;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isSetObject };\n//# sourceMappingURL=is-set-object.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AASA,MAAM,eAAe,UAAU;AAC9B,KAAI;AACH,SAAO,gBAAgB,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,SAAS;SACtD;AACP,SAAO"}
@@ -1,19 +0,0 @@
1
- const require_is_empty = require('./is-empty.cjs');
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs
4
- /**
5
- * The inverse of the `isEmpty` function
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
9
- */
10
- const isSet = (value) => {
11
- try {
12
- return !require_is_empty.isEmpty(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- exports.isSet = isSet;
@@ -1,20 +0,0 @@
1
- import { isEmpty } from "./is-empty.mjs";
2
-
3
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs
4
- /**
5
- * The inverse of the `isEmpty` function
6
- *
7
- * @param value - The value to type check
8
- * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
9
- */
10
- const isSet = (value) => {
11
- try {
12
- return !isEmpty(value);
13
- } catch {
14
- return false;
15
- }
16
- };
17
-
18
- //#endregion
19
- export { isSet };
20
- //# sourceMappingURL=is-set.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-set.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-set.mjs"],"sourcesContent":["import { isEmpty } from \"./is-empty.mjs\";\n\n//#region src/is-set.ts\n/**\n* The inverse of the `isEmpty` function\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n*/\nconst isSet = (value) => {\n\ttry {\n\t\treturn !isEmpty(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isSet };\n//# sourceMappingURL=is-set.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AASA,MAAM,SAAS,UAAU;AACxB,KAAI;AACH,SAAO,CAAC,QAAQ,MAAM;SACf;AACP,SAAO"}
@@ -1,12 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs
3
- const isString = (value) => {
4
- try {
5
- return typeof value === "string";
6
- } catch {
7
- return false;
8
- }
9
- };
10
-
11
- //#endregion
12
- exports.isString = isString;
@@ -1,12 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs
2
- const isString = (value) => {
3
- try {
4
- return typeof value === "string";
5
- } catch {
6
- return false;
7
- }
8
- };
9
-
10
- //#endregion
11
- export { isString };
12
- //# sourceMappingURL=is-string.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-string.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-string.mjs"],"sourcesContent":["//#region src/is-string.ts\nconst isString = (value) => {\n\ttry {\n\t\treturn typeof value === \"string\";\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isString };\n//# sourceMappingURL=is-string.mjs.map"],"x_google_ignoreList":[0],"mappings":";AACA,MAAM,YAAY,UAAU;AAC3B,KAAI;AACH,SAAO,OAAO,UAAU;SACjB;AACP,SAAO"}
@@ -1,8 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.mjs
3
- const isUndefined = (value) => {
4
- return value === void 0;
5
- };
6
-
7
- //#endregion
8
- exports.isUndefined = isUndefined;
@@ -1,8 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.mjs
2
- const isUndefined = (value) => {
3
- return value === void 0;
4
- };
5
-
6
- //#endregion
7
- export { isUndefined };
8
- //# sourceMappingURL=is-undefined.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-undefined.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+type-checks@0.5.38/node_modules/@stryke/type-checks/dist/is-undefined.mjs"],"sourcesContent":["//#region src/is-undefined.ts\nconst isUndefined = (value) => {\n\treturn value === void 0;\n};\n\n//#endregion\nexport { isUndefined };\n//# sourceMappingURL=is-undefined.mjs.map"],"x_google_ignoreList":[0],"mappings":";AACA,MAAM,eAAe,UAAU;AAC9B,QAAO,UAAU,KAAK"}
File without changes