mirror of
https://github.com/modrinth/code.git
synced 2026-08-03 14:45:55 +00:00
Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e45e0fdde9 | ||
|
|
db449d439a | ||
|
|
333d55741c | ||
|
|
2590b2f942 | ||
|
|
f59c0af86e | ||
|
|
47f1739873 | ||
|
|
f62ae92791 | ||
|
|
d5b7e30494 | ||
|
|
1d21fc02fe | ||
|
|
9756d4acb9 | ||
|
|
3d41dd1757 | ||
|
|
355a7d0726 | ||
|
|
1a470e9ee2 | ||
|
|
d36cd55167 | ||
|
|
b872f41ea1 | ||
|
|
256598c87f | ||
|
|
19908fb197 | ||
|
|
bfbcfd7c06 | ||
|
|
d46362362d | ||
|
|
8f4ca76780 | ||
|
|
016c6938b8 | ||
|
|
25b5acfdd4 | ||
|
|
67168d2d2e | ||
|
|
71b900075f | ||
|
|
26354bacc9 | ||
|
|
566bf1561a |
@@ -0,0 +1,79 @@
|
|||||||
|
name: Test pull request
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main, next, alpha, beta, rc]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
|
||||||
|
- name: Check changed files
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
shared: &shared
|
||||||
|
- .npmrc
|
||||||
|
- package.json
|
||||||
|
- pnpm-lock.yaml
|
||||||
|
nvintl:
|
||||||
|
- *shared
|
||||||
|
- 'packages/vintl-nuxt/**'
|
||||||
|
playground:
|
||||||
|
- *shared
|
||||||
|
- 'apps/playground/**'
|
||||||
|
- 'packages/translations/**'
|
||||||
|
docs:
|
||||||
|
- *shared
|
||||||
|
- 'apps/docs/**'
|
||||||
|
|
||||||
|
- name: Install pnpm via corepack
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
corepack prepare --activate
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
id: pnpm-cache
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
name: Setup pnpm cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Prepare everything
|
||||||
|
run: pnpm all:prepare
|
||||||
|
|
||||||
|
- name: Lint everything
|
||||||
|
run: pnpm all:lint
|
||||||
|
|
||||||
|
- name: Build module
|
||||||
|
if: steps.filter.outputs.nvintl == 'true'
|
||||||
|
run: pnpm mod:build
|
||||||
|
|
||||||
|
- name: Build playground
|
||||||
|
if: steps.filter.outputs.playground == 'true' || steps.filter.outputs.nvintl == 'true'
|
||||||
|
run: pnpm pg:build
|
||||||
|
|
||||||
|
- name: Build docs
|
||||||
|
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.nvintl == 'true'
|
||||||
|
run: pnpm docs:build
|
||||||
@@ -9,7 +9,7 @@ This monorepo hosts the VIntl for Nuxt module as well as other projects that hel
|
|||||||
### Apps
|
### Apps
|
||||||
|
|
||||||
- [Playground](https://github.com/vintl-dev/nuxt/tree/main/apps/playground) 🔒
|
- [Playground](https://github.com/vintl-dev/nuxt/tree/main/apps/playground) 🔒
|
||||||
- [Docs](https://github.com/vintl-dev/nuxt/tree/main/apps/docs) 🔒 [🌐](https://vintl-nuxt.vercel.app/)
|
- [Docs](https://github.com/vintl-dev/nuxt/tree/main/apps/docs) 🔒 [🌐](https://vintl-nuxt.netlify.app/)
|
||||||
|
|
||||||
### Packages
|
### Packages
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export default defineAppConfig({
|
|||||||
docus: {
|
docus: {
|
||||||
title: 'VIntl for Nuxt',
|
title: 'VIntl for Nuxt',
|
||||||
description: 'Internationalization for your Nuxt apps',
|
description: 'Internationalization for your Nuxt apps',
|
||||||
url: 'http://vintl-nuxt.vercel.app',
|
url: 'https://vintl-nuxt.netlify.app',
|
||||||
// image: '/social-card-preview.png',
|
// image: '/social-card-preview.png',
|
||||||
socials: {
|
socials: {
|
||||||
github: 'vintl-dev/nuxt',
|
github: 'vintl-dev/nuxt',
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ Message descriptors are objects that describe a message and its properties. The
|
|||||||
- `description` (optional): A description of the message for translators.
|
- `description` (optional): A description of the message for translators.
|
||||||
|
|
||||||
::alert{type="warning"}
|
::alert{type="warning"}
|
||||||
VIntl for Nuxt currently does not transpile the descriptors during the build, leaving `description` property as is, meaning they will pointlessly increase bundle size. If you really want to use them, look into wiring up [Babel plugin by FormatJS][babel_plugin].
|
|
||||||
|
Note that VIntl for Nuxt does not currently transpile code during the build process. This means that any `description` properties of message descriptors will remain unchanged, needlessly increasing the bundle size. If you must use `description` properties, we recommend using the [Babel plugin by FormatJS][babel_plugin] to remove them.
|
||||||
|
|
||||||
[babel_plugin]: https://formatjs.io/docs/tooling/babel-plugin
|
[babel_plugin]: https://formatjs.io/docs/tooling/babel-plugin
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,15 @@
|
|||||||
"start": "node .output/server/index.mjs"
|
"start": "node .output/server/index.mjs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@formatjs/cli": "^6.0.4",
|
"@formatjs/cli": "^6.1.2",
|
||||||
"@nuxt-themes/docus": "^1.10.1",
|
"@nuxt-themes/docus": "^1.12.3",
|
||||||
"@nuxt/eslint-config": "^0.1.1",
|
"@nuxt/eslint-config": "^0.1.1",
|
||||||
"@vintl-dev/eslint-config-peony": "workspace:^",
|
"@vintl-dev/eslint-config-peony": "workspace:^",
|
||||||
"@vintl/nuxt": "workspace:^",
|
"@vintl/nuxt": "workspace:^",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.42.0",
|
||||||
"nuxt": "^3.4.2",
|
"nuxi": "^3.5.3",
|
||||||
"theme-colors": "^0.0.5"
|
"nuxt": "^3.5.3",
|
||||||
|
"theme-colors": "^0.0.5",
|
||||||
|
"vue": "^3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
"@vintl-dev/eslint-config-peony": "workspace:^",
|
"@vintl-dev/eslint-config-peony": "workspace:^",
|
||||||
"@vintl-dev/pg-messages": "workspace:^",
|
"@vintl-dev/pg-messages": "workspace:^",
|
||||||
"@vintl/nuxt": "workspace:^",
|
"@vintl/nuxt": "workspace:^",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.42.0",
|
||||||
"nuxi": "^3.4.2",
|
"nuxi": "^3.5.3",
|
||||||
"nuxt": "^3.4.2"
|
"nuxt": "^3.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -8,7 +8,7 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "^2.26.1",
|
"@changesets/cli": "^2.26.1",
|
||||||
"turbo": "^1.8.7"
|
"turbo": "^1.10.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pg:prepare": "turbo run --no-daemon @vintl-dev/pg#dev:prepare",
|
"pg:prepare": "turbo run --no-daemon @vintl-dev/pg#dev:prepare",
|
||||||
@@ -28,9 +28,6 @@
|
|||||||
"_ci:publish": "changeset publish"
|
"_ci:publish": "changeset publish"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
|
||||||
"astring@1.8.4": "patches/astring@1.8.4.patch"
|
|
||||||
},
|
|
||||||
"packageExtensions": {
|
"packageExtensions": {
|
||||||
"@nuxt/kit": {
|
"@nuxt/kit": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -39,5 +36,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.3.1"
|
"packageManager": "pnpm@8.6.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,14 +26,14 @@
|
|||||||
"config.json"
|
"config.json"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rushstack/eslint-patch": "^1.2.0",
|
"@rushstack/eslint-patch": "^1.3.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
"@typescript-eslint/eslint-plugin": "^5.59.9",
|
||||||
"@typescript-eslint/parser": "^5.59.0",
|
"@typescript-eslint/parser": "^5.59.9",
|
||||||
"eslint-plugin-vue": "^9.11.0",
|
"eslint-plugin-vue": "^9.14.1",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/eslint": "^8.37.0",
|
"@types/eslint": "^8.40.0",
|
||||||
"eslint": "^8.38.0"
|
"eslint": "^8.42.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,65 @@
|
|||||||
# @vintl/nuxt
|
# @vintl/nuxt
|
||||||
|
|
||||||
|
## 1.2.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- db449d4: Fix missing options in the newer Nuxt versions
|
||||||
|
|
||||||
|
## 1.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 2590b2f: Downgrade and pin versions of FormatJS packages
|
||||||
|
|
||||||
|
Newest versions of FormatJS packages contain exports map that result in illegal ESM as CJS imports. This downgrades them
|
||||||
|
|
||||||
|
For more details see the issue at https://github.com/formatjs/formatjs/issues/4126.
|
||||||
|
|
||||||
|
## 1.2.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- f62ae92: Adapt to new export conditions of the parser
|
||||||
|
|
||||||
|
`@formatjs/icu-messageformat-parser` has been updated and now has export conditions, this change adapts and fixes the error caused by the previous direct import of the file for `no-parser` alias.
|
||||||
|
|
||||||
|
- 47f1739: Fix consola not being actually listed as a dependency or used
|
||||||
|
|
||||||
|
## 1.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- 3d41dd1: Update VIntl to 4.2.0
|
||||||
|
|
||||||
|
Previously VIntl was depending on Vue directly, which caused issues, and wasn't correct, as Vue is not its implementation detail. 4.2.0 made Vue a peer dependency, fixing this issue. It also brought updates to other dependencies like `@formatjs/intl`.
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 9756d4a: Upgrade `import-meta-resolve` to v3
|
||||||
|
|
||||||
|
## 1.1.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 8f4ca76: Fix compatibility with newer versions of Nuxt
|
||||||
|
|
||||||
|
It seems that TypeScript has a trouble identifying similar types from different packages, which caused it to disregard any types from VIntl.
|
||||||
|
|
||||||
|
Now that the `@nuxt/schema` is moved to `devDependencies` (since it's used for types only anyway), and doesn't have to strictly match the version, this should be fixed.
|
||||||
|
|
||||||
|
## 1.1.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 25b5acf: Don't require additionalImports to be a non-empty array
|
||||||
|
|
||||||
|
## 1.1.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 71b9000: Fix object import sources not resolving by default
|
||||||
|
|
||||||
## 1.1.1
|
## 1.1.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Store your users preferences with cookies, localStorage, or with the custom stor
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Check out the [VIntl for Nuxt documentation site](https://vintl-nuxt.vercel.app/) for detailed usage instructions and examples.
|
Check out the [VIntl for Nuxt documentation site](https://vintl-nuxt.netlify.app/) for detailed usage instructions and examples.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vintl/nuxt",
|
"name": "@vintl/nuxt",
|
||||||
"version": "1.1.1",
|
"version": "1.2.3",
|
||||||
"description": "Nuxt Module for VIntl integration",
|
"description": "Nuxt Module for VIntl integration",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"i18n",
|
"i18n",
|
||||||
@@ -39,27 +39,28 @@
|
|||||||
"prepack": "pnpm run -s lint && pnpm run -s build"
|
"prepack": "pnpm run -s lint && pnpm run -s build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/module-builder": "^0.3.0",
|
"@nuxt/module-builder": "^0.4.0",
|
||||||
|
"@nuxt/schema": "^3.5.3",
|
||||||
"@types/hash-sum": "^1.0.0",
|
"@types/hash-sum": "^1.0.0",
|
||||||
"@types/node": "^18.15.12",
|
"@types/node": "^18.16.16",
|
||||||
"@unhead/vue": "^1.1.26",
|
"@unhead/vue": "^1.1.27",
|
||||||
"@vintl-dev/eslint-config-peony": "workspace:^",
|
"@vintl-dev/eslint-config-peony": "workspace:^",
|
||||||
"hookable": "^5.5.3",
|
"hookable": "^5.5.3",
|
||||||
"prettier-plugin-jsdoc": "^0.4.2",
|
"prettier-plugin-jsdoc": "^0.4.2",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.1.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formatjs/intl": "^2.7.1",
|
"@formatjs/intl": "2.7.2",
|
||||||
"@nuxt/kit": "^3.4.2",
|
"@nuxt/kit": "^3.5.3",
|
||||||
"@nuxt/schema": "^3.4.2",
|
"@vintl/unplugin": "^1.2.4",
|
||||||
"@vintl/unplugin": "^1.2.1",
|
"@vintl/vintl": "^4.2.1",
|
||||||
"@vintl/vintl": "^4.1.2",
|
"astring": "^1.8.6",
|
||||||
"astring": "^1.8.4",
|
"consola": "^3.1.0",
|
||||||
"hash-sum": "^2.0.0",
|
"hash-sum": "^2.0.0",
|
||||||
"import-meta-resolve": "^2.2.2",
|
"import-meta-resolve": "^3.0.0",
|
||||||
"pathe": "^1.1.0",
|
"pathe": "^1.1.1",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"slash": "^5.0.0",
|
"slash": "^5.1.0",
|
||||||
"zod": "^3.21.4"
|
"zod": "^3.21.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ import { moduleOptionsSchema } from './schemas/index.js'
|
|||||||
import { PluginOptionsBank } from './parser-bank.js'
|
import { PluginOptionsBank } from './parser-bank.js'
|
||||||
import { formatZodError } from './utils/zod-error.js'
|
import { formatZodError } from './utils/zod-error.js'
|
||||||
import { OptionsError } from './errors.js'
|
import { OptionsError } from './errors.js'
|
||||||
import * as consola from 'console'
|
import { consola } from 'consola'
|
||||||
|
|
||||||
/** Path to the options file relative to `buildDir`. */
|
/** Path to the options file relative to `buildDir`. */
|
||||||
const optionsFilePath = 'i18n/options.mjs'
|
const optionsFilePath = 'i18n/options.mjs'
|
||||||
|
|
||||||
type _InputModuleOptions = typeof moduleOptionsSchema
|
type _InputModuleOptions = typeof moduleOptionsSchema
|
||||||
|
|
||||||
export interface InputModuleOptions extends t.input<_InputModuleOptions> {}
|
export interface ModuleOptions extends t.input<_InputModuleOptions> {}
|
||||||
|
|
||||||
export default defineNuxtModule<InputModuleOptions>({
|
export default defineNuxtModule<ModuleOptions>({
|
||||||
meta: {
|
meta: {
|
||||||
name: '@vintl/nuxt',
|
name: '@vintl/nuxt',
|
||||||
configKey: 'vintl',
|
configKey: 'vintl',
|
||||||
@@ -48,7 +48,7 @@ export default defineNuxtModule<InputModuleOptions>({
|
|||||||
|
|
||||||
const resolveInRuntime = createDirResolver(runtimeDir)
|
const resolveInRuntime = createDirResolver(runtimeDir)
|
||||||
|
|
||||||
addPlugin((await resolveInRuntime('./plugin.js')).path)
|
addPlugin(resolveInRuntime('./plugin.js').path)
|
||||||
|
|
||||||
if (!nuxt.options._prepare) {
|
if (!nuxt.options._prepare) {
|
||||||
let options: t.output<typeof moduleOptionsSchema>
|
let options: t.output<typeof moduleOptionsSchema>
|
||||||
@@ -86,16 +86,14 @@ export default defineNuxtModule<InputModuleOptions>({
|
|||||||
const optionsFile = addTemplate({
|
const optionsFile = addTemplate({
|
||||||
filename: optionsFilePath,
|
filename: optionsFilePath,
|
||||||
write: true,
|
write: true,
|
||||||
async getContents() {
|
getContents() {
|
||||||
const resolveInResDir = createDirResolver(
|
const resolveInResDir = createDirResolver(
|
||||||
resolvePath(nuxt.options.srcDir, options.resolveDir ?? '.'),
|
resolvePath(nuxt.options.srcDir, options.resolveDir ?? '.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return await generateOptions(options, {
|
return generateOptions(options, {
|
||||||
async resolve(specifier) {
|
resolve(specifier) {
|
||||||
return (await resolveInResDir(specifier)).relativeTo(
|
return resolveInResDir(specifier).relativeTo(optionsFile.dst)
|
||||||
optionsFile.dst,
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
registerMessagesFile(file, importPath) {
|
registerMessagesFile(file, importPath) {
|
||||||
pluginOptionsBank.registerFile(
|
pluginOptionsBank.registerFile(
|
||||||
@@ -103,10 +101,8 @@ export default defineNuxtModule<InputModuleOptions>({
|
|||||||
resolvePath(dirname(optionsFile.dst), importPath),
|
resolvePath(dirname(optionsFile.dst), importPath),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
async resolveRuntimeModule(specifier) {
|
resolveRuntimeModule(specifier) {
|
||||||
return (await resolveInRuntime(specifier)).relativeTo(
|
return resolveInRuntime(specifier).relativeTo(optionsFile.dst)
|
||||||
optionsFile.dst,
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
parserlessModeEnabled,
|
parserlessModeEnabled,
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ interface GeneratorContext {
|
|||||||
* @param specifier Module import specifier.
|
* @param specifier Module import specifier.
|
||||||
* @returns Path relative to the options file.
|
* @returns Path relative to the options file.
|
||||||
*/
|
*/
|
||||||
resolve(specifier: string): Promise<string>
|
resolve(specifier: string): string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Analytical method that is called for every generated messages import.
|
* Analytical method that is called for every generated messages import.
|
||||||
@@ -635,7 +635,7 @@ interface GeneratorContext {
|
|||||||
* @param specifier Module import specifier.
|
* @param specifier Module import specifier.
|
||||||
* @returns Path relative to the optons file.
|
* @returns Path relative to the optons file.
|
||||||
*/
|
*/
|
||||||
resolveRuntimeModule(specifier: string): Promise<string>
|
resolveRuntimeModule(specifier: string): string
|
||||||
|
|
||||||
/** Additional state to encode which is not included in the options. */
|
/** Additional state to encode which is not included in the options. */
|
||||||
state: {
|
state: {
|
||||||
@@ -649,7 +649,7 @@ interface GeneratorContext {
|
|||||||
* then renders it to actual JavaScript code. The resulting code can be written
|
* then renders it to actual JavaScript code. The resulting code can be written
|
||||||
* to a special file and read at runtime to retrieve the options.
|
* to a special file and read at runtime to retrieve the options.
|
||||||
*/
|
*/
|
||||||
export async function generate(
|
export function generate(
|
||||||
opts: t.output<typeof moduleOptionsSchema>,
|
opts: t.output<typeof moduleOptionsSchema>,
|
||||||
{
|
{
|
||||||
resolve,
|
resolve,
|
||||||
@@ -697,7 +697,7 @@ export async function generate(
|
|||||||
|
|
||||||
imports.push(
|
imports.push(
|
||||||
new ImportDeclaration(
|
new ImportDeclaration(
|
||||||
new Literal(await resolveRuntimeModule('./utils/locale-loader.js')),
|
new Literal(resolveRuntimeModule('./utils/locale-loader.js')),
|
||||||
)
|
)
|
||||||
.addSpecifier(id$defineLocale)
|
.addSpecifier(id$defineLocale)
|
||||||
.addSpecifier(id$rawValue),
|
.addSpecifier(id$rawValue),
|
||||||
@@ -780,7 +780,7 @@ export async function generate(
|
|||||||
|
|
||||||
for (const messageFile of files) {
|
for (const messageFile of files) {
|
||||||
const { from: importPath, name: importKey } = messageFile
|
const { from: importPath, name: importKey } = messageFile
|
||||||
const resolvedPath = await resolve(messageFile.from)
|
const resolvedPath = resolve(messageFile.from)
|
||||||
registerMessagesFile(messageFile, resolvedPath)
|
registerMessagesFile(messageFile, resolvedPath)
|
||||||
|
|
||||||
if (isDefaultLocale) {
|
if (isDefaultLocale) {
|
||||||
@@ -830,7 +830,7 @@ export async function generate(
|
|||||||
|
|
||||||
for (const import_ of locale.additionalImports ?? []) {
|
for (const import_ of locale.additionalImports ?? []) {
|
||||||
const resolvedPath = import_.resolve
|
const resolvedPath = import_.resolve
|
||||||
? await resolve(import_.from)
|
? resolve(import_.from)
|
||||||
: import_.from
|
: import_.from
|
||||||
|
|
||||||
if (isDefaultLocale) {
|
if (isDefaultLocale) {
|
||||||
@@ -857,9 +857,7 @@ export async function generate(
|
|||||||
resolve: shouldResolve,
|
resolve: shouldResolve,
|
||||||
} = dataImport
|
} = dataImport
|
||||||
|
|
||||||
const resolvedPath = shouldResolve
|
const resolvedPath = shouldResolve ? resolve(importPath) : importPath
|
||||||
? await resolve(importPath)
|
|
||||||
: importPath
|
|
||||||
|
|
||||||
if (isDefaultLocale) {
|
if (isDefaultLocale) {
|
||||||
// if import key is 'default' then:
|
// if import key is 'default' then:
|
||||||
@@ -984,11 +982,11 @@ export async function generate(
|
|||||||
let storage = opts.storage
|
let storage = opts.storage
|
||||||
|
|
||||||
if (storage === 'localStorage') {
|
if (storage === 'localStorage') {
|
||||||
storage = await resolveRuntimeModule('./storage/local-storage.js')
|
storage = resolveRuntimeModule('./storage/local-storage.js')
|
||||||
} else if (storage === 'cookie') {
|
} else if (storage === 'cookie') {
|
||||||
storage = await resolveRuntimeModule('./storage/cookie.js')
|
storage = resolveRuntimeModule('./storage/cookie.js')
|
||||||
} else {
|
} else {
|
||||||
storage = await resolve(storage)
|
storage = resolve(storage)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.push(
|
exports.push(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const importSourceObjectSchema = t.object({
|
|||||||
.default('default'),
|
.default('default'),
|
||||||
|
|
||||||
/** Whether to resolve the import to a path or import as is. */
|
/** Whether to resolve the import to a path or import as is. */
|
||||||
resolve: t.boolean().optional(),
|
resolve: t.boolean().default(true),
|
||||||
})
|
})
|
||||||
|
|
||||||
/** A schema for the tuple consisting of an import path and a custom export name. */
|
/** A schema for the tuple consisting of an import path and a custom export name. */
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ export const localeDescriptorSchema = t
|
|||||||
.describe(
|
.describe(
|
||||||
'List of additional side-effect only imports (like polyfill data)',
|
'List of additional side-effect only imports (like polyfill data)',
|
||||||
)
|
)
|
||||||
.nonempty()
|
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import slash from 'slash'
|
|||||||
export function createDirResolver(dir: string) {
|
export function createDirResolver(dir: string) {
|
||||||
const pseudoParent = pathToFileURL(joinPaths(dir, '.resolve-root')).toString()
|
const pseudoParent = pathToFileURL(joinPaths(dir, '.resolve-root')).toString()
|
||||||
|
|
||||||
return async function resolve(specifier: string) {
|
return function resolve(specifier: string) {
|
||||||
const resolved = await rawResolve(specifier, pseudoParent)
|
const resolved = rawResolve(specifier, pseudoParent)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/** A getter that returns resolved URL as is. */
|
/** A getter that returns resolved URL as is. */
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
diff --git a/package.json b/package.json
|
|
||||||
index 55da8ad891741382b793f105b328b77997fab1de..d714282fd3742d377fe05db58bc00460ae44cdb6 100644
|
|
||||||
--- a/package.json
|
|
||||||
+++ b/package.json
|
|
||||||
@@ -6,6 +6,7 @@
|
|
||||||
"module": "./dist/astring.mjs",
|
|
||||||
"types": "./astring.d.ts",
|
|
||||||
"exports": {
|
|
||||||
+ "types": "./astring.d.ts",
|
|
||||||
"import": "./dist/astring.mjs",
|
|
||||||
"require": "./dist/astring.js",
|
|
||||||
"browser": "./dist/astring.min.js"
|
|
||||||
Generated
+1783
-1464
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user