diff --git a/.env.development b/.env.development new file mode 100644 index 00000000000..f3289142440 --- /dev/null +++ b/.env.development @@ -0,0 +1,8 @@ +# This file is committed to git and should not contain any secrets. +# +# Vite recommends using .env.local or .env.[mode].local if you need to manage secrets +# SEE: https://vite.dev/guide/env-and-mode.html#env-files for more information. + + +# Default NODE_ENV with vite build --mode=test is production +NODE_ENV=development diff --git a/app/app.js b/app/app.js index 0680f1c7778..007bc581fa7 100644 --- a/app/app.js +++ b/app/app.js @@ -1,5 +1,6 @@ import Application from '@ember/application'; +import compatModules from '@embroider/virtual/compat-modules'; import loadInitializers from 'ember-load-initializers'; import Resolver from 'ember-resolver'; @@ -15,7 +16,7 @@ Sentry.init(); export default class App extends Application { modulePrefix = config.modulePrefix; podModulePrefix = config.podModulePrefix; - Resolver = Resolver; + Resolver = Resolver.withModules(compatModules); customEvents = { // prevent non-passive listeners for touchstart/touchmove events @@ -24,4 +25,4 @@ export default class App extends Application { }; } -loadInitializers(App, config.modulePrefix); +loadInitializers(App, config.modulePrefix, compatModules); diff --git a/app/components/version-list/row.gjs b/app/components/version-list/row.gjs index 870681c2f7d..372935c66eb 100644 --- a/app/components/version-list/row.gjs +++ b/app/components/version-list/row.gjs @@ -25,7 +25,9 @@ import dateFormatDistanceToNow from 'crates-io/helpers/date-format-distance-to-n import dateFormatIso from 'crates-io/helpers/date-format-iso'; import prettyBytes from 'crates-io/helpers/pretty-bytes'; -import styles from './row.css'; +// TODO fix this - throws a vite error +// import styles from './row.css'; +const styles = {}; export default class VersionRow extends Component { @service session; diff --git a/app/config/environment.js b/app/config/environment.js new file mode 100644 index 00000000000..3dd074bf1df --- /dev/null +++ b/app/config/environment.js @@ -0,0 +1,3 @@ +import loadConfigFromMeta from '@embroider/config-meta-loader'; + +export default loadConfigFromMeta('crates-io'); diff --git a/babel.config.cjs b/babel.config.cjs new file mode 100644 index 00000000000..078f3496df1 --- /dev/null +++ b/babel.config.cjs @@ -0,0 +1,40 @@ +const { babelCompatSupport, templateCompatSupport } = require('@embroider/compat/babel'); +const scopedCSS = require('ember-scoped-css/build'); + +module.exports = { + plugins: [ + [ + 'babel-plugin-ember-template-compilation', + { + compilerPath: 'ember-source/dist/ember-template-compiler.js', + enableLegacyModules: [ + 'ember-cli-htmlbars', + 'ember-cli-htmlbars-inline-precompile', + 'htmlbars-inline-precompile', + ], + transforms: [...templateCompatSupport(), scopedCSS.templatePlugin({})], + }, + ], + [ + 'module:decorator-transforms', + { + runtime: { + import: require.resolve('decorator-transforms/runtime-esm'), + }, + }, + ], + [ + '@babel/plugin-transform-runtime', + { + absoluteRuntime: __dirname, + useESModules: true, + regenerator: false, + }, + ], + ...babelCompatSupport(), + ], + + generatorOpts: { + compact: false, + }, +}; diff --git a/ember-cli-build.js b/ember-cli-build.js index a231bd84d37..54f05817cb4 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,8 +1,10 @@ 'use strict'; - +const { compatBuild } = require('@embroider/compat'); const EmberApp = require('ember-cli/lib/broccoli/ember-app'); -module.exports = function (defaults) { +module.exports = async function (defaults) { + const { buildOnce } = await import('@embroider/vite'); + let env = EmberApp.env(); let isProd = env === 'production'; @@ -66,8 +68,7 @@ module.exports = function (defaults) { // app.import('node_modules/normalize.css/normalize.css'); app.import('vendor/qunit.css', { type: 'test' }); - const { Webpack } = require('@embroider/webpack'); - return require('@embroider/compat').compatBuild(app, Webpack, { + return compatBuild(app, buildOnce, { extraPublicTrees, staticAddonTrees: true, staticAddonTestSupportTrees: true, diff --git a/eslint.config.mjs b/eslint.config.mjs index 5333c53b257..6a1572b86c5 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -72,17 +72,6 @@ export default [ parserOptions: { requireConfigFile: false, - - babelOptions: { - plugins: [ - [ - '@babel/plugin-proposal-decorators', - { - decoratorsBeforeExport: true, - }, - ], - ], - }, }, }, @@ -180,7 +169,8 @@ export default [ 'eslint.config.mjs', '**/.template-lintrc.js', '**/ember-cli-build.js', - '**/testem.js', + '**/testem.cjs', + '**/babel.config.cjs', 'blueprints/*/index.js', 'config/**/*.js', 'lib/*/index.js', diff --git a/app/index.html b/index.html similarity index 71% rename from app/index.html rename to index.html index d87a0a03689..0fa79e8be5e 100644 --- a/app/index.html +++ b/index.html @@ -7,16 +7,16 @@