@aidc-toolkit/core 0.9.5 → 0.9.6-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -72,7 +72,7 @@ async function i18nInit(environment, debug = false) {
72
72
  debug,
73
73
  resources: {}
74
74
  }).then(() => {
75
- import_i18next.default.services.formatter?.add("toLowerCase", (value) => value.toLowerCase());
75
+ import_i18next.default.services.formatter?.add("toLowerCase", (value) => typeof value === "string" ? value.toLowerCase() : String(value));
76
76
  for (const initResourceBundle of initResourceBundles) {
77
77
  i18nAddResourceBundle(initResourceBundle.lng, initResourceBundle.ns, initResourceBundle.resources);
78
78
  }
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ async function i18nInit(environment, debug = false) {
32
32
  debug,
33
33
  resources: {}
34
34
  }).then(() => {
35
- i18next.services.formatter?.add("toLowerCase", (value) => value.toLowerCase());
35
+ i18next.services.formatter?.add("toLowerCase", (value) => typeof value === "string" ? value.toLowerCase() : String(value));
36
36
  for (const initResourceBundle of initResourceBundles) {
37
37
  i18nAddResourceBundle(initResourceBundle.lng, initResourceBundle.ns, initResourceBundle.resources);
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidc-toolkit/core",
3
- "version": "0.9.5",
3
+ "version": "0.9.6-beta",
4
4
  "description": "Core functionality for AIDC Toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,20 +19,20 @@
19
19
  "url": "https://www.linkedin.com/in/kdean"
20
20
  },
21
21
  "scripts": {
22
- "eslint": "eslint .",
22
+ "lint": "eslint .",
23
23
  "build": "tsup src/index.ts --clean --format cjs,esm --dts",
24
24
  "build-doc": "npm run build && tsc src/index.ts --outDir dist --target esnext --moduleResolution nodenext --module nodenext --emitDeclarationOnly --declaration --declarationMap"
25
25
  },
26
26
  "devDependencies": {
27
- "@aidc-toolkit/dev": "^0.9.5",
28
- "eslint": "^9.15.0",
27
+ "@aidc-toolkit/dev": "^0.9.6-beta",
28
+ "eslint": "^9.16.0",
29
29
  "ts-node": "^10.9.2",
30
30
  "tsup": "^8.3.5",
31
- "typescript": "^5.6.3"
31
+ "typescript": "^5.7.2"
32
32
  },
33
33
  "dependencies": {
34
- "@rollup/rollup-linux-x64-gnu": "^4.27.3",
35
- "i18next": "^23.16.8",
34
+ "@rollup/rollup-linux-x64-gnu": "^4.28.0",
35
+ "i18next": "^24.0.5",
36
36
  "i18next-browser-languagedetector": "^8.0.0",
37
37
  "i18next-cli-language-detector": "^1.1.8"
38
38
  }
@@ -1,4 +1,4 @@
1
- import i18next from "i18next";
1
+ import i18next, { type LanguageDetectorModule } from "i18next";
2
2
  import I18nextBrowserLanguageDetector from "i18next-browser-languagedetector";
3
3
  import I18nextCLILanguageDetector from "i18next-cli-language-detector";
4
4
 
@@ -56,12 +56,13 @@ export async function i18nInit(environment: I18NEnvironment, debug = false): Pro
56
56
  // Skip if initialization is not pending.
57
57
  if (pendingResourceBundles !== undefined) {
58
58
  initialized = true;
59
-
60
- let module: object;
59
+
60
+ let module: Parameters<typeof i18next.use>[0];
61
61
 
62
62
  switch (environment) {
63
63
  case I18NEnvironment.CLI:
64
- module = I18nextCLILanguageDetector;
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Pending resolution of https://github.com/neet/i18next-cli-language-detector/issues/281.
65
+ module = I18nextCLILanguageDetector as unknown as LanguageDetectorModule;
65
66
  break;
66
67
 
67
68
  case I18NEnvironment.Browser:
@@ -77,13 +78,13 @@ export async function i18nInit(environment: I18NEnvironment, debug = false): Pro
77
78
  // No need to manage pending resource bundles past this point.
78
79
  pendingResourceBundles = undefined;
79
80
 
80
- await i18next.use(module as never).init({
81
+ await i18next.use(module).init({
81
82
  fallbackLng: "en",
82
83
  debug,
83
84
  resources: {}
84
85
  }).then(() => {
85
86
  // Add toLowerCase function.
86
- i18next.services.formatter?.add("toLowerCase", value => (value as string).toLowerCase());
87
+ i18next.services.formatter?.add("toLowerCase", value => typeof value === "string" ? value.toLowerCase() : String(value));
87
88
 
88
89
  // Add pending resource bundles.
89
90
  for (const initResourceBundle of initResourceBundles) {
@@ -1,32 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Platform**
27
- - OS: [e.g. Windows, iOS]
28
- - Browser [e.g. chrome, safari]
29
- - Browser Version [e.g. 22]
30
-
31
- **Additional context**
32
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1,21 +0,0 @@
1
- name: Build and publish
2
-
3
- on:
4
- release:
5
- types:
6
- - published
7
-
8
- jobs:
9
- build-and-publish:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Build and publish core
14
- uses: aidc-toolkit/dev/.github/actions/build-publish@main
15
- with:
16
- project: core
17
- node_version: ${{ vars.NODE_VERSION }}
18
- node_auth_token: ${{ secrets.NODE_AUTH_TOKEN }}
19
- no_test: true
20
- terminal_pre_build: ${{ vars.TERMINAL_PRE_BUILD }}
21
- terminal_post_build: ${{ vars.TERMINAL_POST_BUILD }}
package/.idea/core.iml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
@@ -1,7 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- <inspection_tool class="UpdateDependencyToLatestVersion" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES" />
6
- </profile>
7
- </component>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/core.iml" filepath="$PROJECT_DIR$/.idea/core.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <component name="ProjectRunConfigurationManager">
2
- <configuration default="false" name="build" type="js.build_tools.npm" nameIsGenerated="true">
3
- <package-json value="$PROJECT_DIR$/package.json" />
4
- <command value="run" />
5
- <scripts>
6
- <script value="build" />
7
- </scripts>
8
- <node-interpreter value="project" />
9
- <envs />
10
- <method v="2" />
11
- </configuration>
12
- </component>
@@ -1,12 +0,0 @@
1
- <component name="ProjectRunConfigurationManager">
2
- <configuration default="false" name="eslint" type="js.build_tools.npm" nameIsGenerated="true">
3
- <package-json value="$PROJECT_DIR$/package.json" />
4
- <command value="run" />
5
- <scripts>
6
- <script value="eslint" />
7
- </scripts>
8
- <node-interpreter value="project" />
9
- <envs />
10
- <method v="2" />
11
- </configuration>
12
- </component>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>