Skip to content

Commit

Permalink
bump vite to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Dec 10, 2023
1 parent b13c646 commit 65764a4
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 159 deletions.
2 changes: 1 addition & 1 deletion compat/ember-data-private-build-infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function generateDefineConfig(isProd: boolean) {
Object.keys(config.debug).forEach((key) => {
items[`${prefix}.debug.${key}`] = isProd ? false : config.debug[key];
});
return items;
return {};
}

export function getDataConfig(debug: boolean) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"prettier": "^2.8.3",
"tailwindcss-ember-power-select": "^0.4.1",
"typescript": "^4.7.2",
"vite": "4.3.9"
"vite": "5.0.7"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
Expand Down
18 changes: 18 additions & 0 deletions patches/ember-intl+5.7.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/ember-intl/addon/-private/utils/hydrate.ts b/node_modules/ember-intl/addon/-private/utils/hydrate.ts
index 29610f8..1694a78 100644
--- a/node_modules/ember-intl/addon/-private/utils/hydrate.ts
+++ b/node_modules/ember-intl/addon/-private/utils/hydrate.ts
@@ -1,4 +1,3 @@
-import translations from 'ember-intl/translations';
import type IntlService from '../../services/intl';

/**
@@ -6,7 +5,5 @@ import type IntlService from '../../services/intl';
* @hide
*/
export default function hydrate(service: IntlService) {
- translations.forEach(([locale, translations]) => {
- service.addTranslations(locale, translations);
- });
+
}
17 changes: 8 additions & 9 deletions plugins/i18n-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ import { basename, extname, join } from 'path';
import { constants } from 'fs';
import type { Plugin } from 'vite';

const translationsFileName = 'ember-intl/translations';
const translationsDir = 'translations';

const virtualModuleId = 'ember-intl/translations';
const resolvedVirtualModuleId = '\0virtual:' + virtualModuleId;

export default function i18nLoader(): Plugin {
return {
name: 'i18n-loader',
enforce: 'pre',

resolveId(source) {
if (source === translationsFileName) {
return source;
if (source === virtualModuleId) {
return resolvedVirtualModuleId;
} else {
return null;
}

return null;
},

async load(id) {
if (id !== translationsFileName) {
if (id !== resolvedVirtualModuleId) {
return null;
}

const translations = [];
const files = await readdir(translationsDir);

Expand Down
2 changes: 2 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default defineConfig(({ mode }) => {
{
build: {
sourcemap: enableSourceMaps,
chunkSizeWarningLimit: 1000,
rollupOptions: isDev
? {
input: {
Expand All @@ -49,6 +50,7 @@ export default defineConfig(({ mode }) => {
App()
.extendDefineConfig({
ENV_DEBUG: isProd ? false : true,
DEBUG: isProd ? false : true,
ENV_CI: false,
})
.addAlias(`@/tests/`, fileURLToPath(new URL(`./tests/`, projectRoot)))
Expand Down
Loading

0 comments on commit 65764a4

Please sign in to comment.