chore: upgrade moduleResolution to Node16 (#9269)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
} from "@medusajs/types"
|
||||
|
||||
import type { RedisOptions } from "ioredis"
|
||||
// @ts-expect-error
|
||||
import type { InlineConfig } from "vite"
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ export type AdminOptions = {
|
||||
/**
|
||||
* Whether to disable the admin dashboard. If set to `true`, the admin dashboard is disabled,
|
||||
* in both development and production environments. The default value is `false`.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js title="medusa-config.js"
|
||||
* module.exports = defineConfig({
|
||||
@@ -36,14 +37,14 @@ export type AdminOptions = {
|
||||
* - `/store`
|
||||
* - `/auth`
|
||||
* - `/`
|
||||
*
|
||||
*
|
||||
* :::note
|
||||
*
|
||||
*
|
||||
* When using Docker, make sure that the root path of the Docker image doesn't path the admin's `path`. For example, if the Docker image's root path is `/app`, change
|
||||
* the value of the `path` configuration, as it's `/app` by default.
|
||||
*
|
||||
*
|
||||
* :::
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js title="medusa-config.js"
|
||||
* module.exports = defineConfig({
|
||||
@@ -58,7 +59,7 @@ export type AdminOptions = {
|
||||
/**
|
||||
* The directory where the admin build is outputted when you run the `build` command.
|
||||
* The default value is `./build`.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js title="medusa-config.js"
|
||||
* module.exports = defineConfig({
|
||||
@@ -72,7 +73,7 @@ export type AdminOptions = {
|
||||
outDir?: string
|
||||
/**
|
||||
* The URL of your Medusa application. This is useful to set when you deploy the Medusa application.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js title="medusa-config.js"
|
||||
* module.exports = defineConfig({
|
||||
@@ -270,11 +271,11 @@ export type ProjectConfigOptions = {
|
||||
*
|
||||
* This is useful for production databases, which can be supported by setting the `rejectUnauthorized` attribute of `ssl` object to `false`.
|
||||
* During development, it’s recommended not to pass this option.
|
||||
*
|
||||
*
|
||||
* :::note
|
||||
*
|
||||
*
|
||||
* Make sure to add to the end of the database URL `?ssl_mode=disable` as well when disabling `rejectUnauthorized`.
|
||||
*
|
||||
*
|
||||
* :::
|
||||
*
|
||||
* @example
|
||||
@@ -416,9 +417,9 @@ export type ProjectConfigOptions = {
|
||||
* // ...
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @ignore
|
||||
*
|
||||
*
|
||||
* @privateRemarks
|
||||
* Couldn't find any use for this option.
|
||||
*/
|
||||
@@ -499,7 +500,7 @@ export type ProjectConfigOptions = {
|
||||
jwtSecret?: string
|
||||
/**
|
||||
* The expiration time for the JWT token. Its format is based off the [ms package](https://github.com/vercel/ms).
|
||||
*
|
||||
*
|
||||
* If not provided, the default value is `24h`.
|
||||
*
|
||||
* @example
|
||||
@@ -760,7 +761,7 @@ export type ProjectConfigOptions = {
|
||||
* The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more.
|
||||
*
|
||||
* `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`.
|
||||
*
|
||||
*
|
||||
* `defineConfig` accepts as a parameter an object with the following properties:
|
||||
*
|
||||
* - {@link ConfigModule.projectConfig | projectConfig} (required): An object that holds general configurations related to the Medusa application, such as database or CORS configurations.
|
||||
@@ -866,12 +867,12 @@ export type ConfigModule = {
|
||||
|
||||
/**
|
||||
* This property holds all custom modules installed in your Medusa application.
|
||||
*
|
||||
*
|
||||
* :::note
|
||||
*
|
||||
*
|
||||
* Medusa's commerce modules are configured by default, so only
|
||||
* add them to this property if you're changing their configurations or adding providers to a module.
|
||||
*
|
||||
*
|
||||
* :::
|
||||
*
|
||||
* The keys of the `modules` configuration object refer to the module's registration name. Its value can be one of the following:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
dynamicImport,
|
||||
FlagRouter,
|
||||
isDefined,
|
||||
isObject,
|
||||
@@ -112,7 +113,7 @@ export async function featureFlagsLoader(
|
||||
return
|
||||
}
|
||||
|
||||
const fileExports = await import(join(flagDir, file.name))
|
||||
const fileExports = await dynamicImport(join(flagDir, file.name))
|
||||
const featureFlag = fileExports.default
|
||||
|
||||
if (!featureFlag) {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { parseCorsOrigins, promiseAll, wrapHandler } from "@medusajs/utils"
|
||||
import {
|
||||
dynamicImport,
|
||||
parseCorsOrigins,
|
||||
promiseAll,
|
||||
resolveExports,
|
||||
wrapHandler,
|
||||
} from "@medusajs/utils"
|
||||
import cors from "cors"
|
||||
import {
|
||||
type Express,
|
||||
@@ -348,7 +354,7 @@ class ApiRoutesLoader {
|
||||
const absolutePath = descriptor.absolutePath
|
||||
const route = descriptor.route
|
||||
|
||||
return await import(absolutePath).then((import_) => {
|
||||
return await dynamicImport(absolutePath).then((import_) => {
|
||||
const map = this.#routesMap
|
||||
|
||||
const config: RouteConfig = {
|
||||
@@ -486,8 +492,10 @@ class ApiRoutesLoader {
|
||||
|
||||
const absolutePath = join(this.#sourceDir, middlewareFilePath)
|
||||
|
||||
await import(absolutePath).then((import_) => {
|
||||
const middlewaresConfig = import_.default as MiddlewaresConfig | undefined
|
||||
await dynamicImport(absolutePath).then((import_) => {
|
||||
const middlewaresConfig = resolveExports(import_).default as
|
||||
| MiddlewaresConfig
|
||||
| undefined
|
||||
|
||||
if (!middlewaresConfig) {
|
||||
log({
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import type { SchedulerOptions } from "@medusajs/orchestration"
|
||||
import { MedusaContainer } from "@medusajs/types"
|
||||
import { isObject, MedusaError, promiseAll } from "@medusajs/utils"
|
||||
import {
|
||||
dynamicImport,
|
||||
isObject,
|
||||
MedusaError,
|
||||
promiseAll,
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
createStep,
|
||||
createWorkflow,
|
||||
@@ -150,11 +155,11 @@ export class JobLoader {
|
||||
fileEntries.map(async (entry) => {
|
||||
const fullPath = join(entry.path, entry.name)
|
||||
|
||||
const module_ = await import(fullPath)
|
||||
const module_ = await dynamicImport(fullPath)
|
||||
|
||||
const input = {
|
||||
config: module_.config,
|
||||
handler: module_.default,
|
||||
handler: module_.default.default,
|
||||
}
|
||||
|
||||
this.validateConfig(input.config)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
import { dynamicImport, promiseAll } from "@medusajs/utils"
|
||||
import { logger } from "../logger"
|
||||
import { access, readdir } from "fs/promises"
|
||||
import { join } from "path"
|
||||
@@ -59,7 +59,7 @@ export class LinkLoader {
|
||||
return await promiseAll(
|
||||
fileEntries.map(async (entry) => {
|
||||
const fullPath = join(entry.path, entry.name)
|
||||
return await import(fullPath)
|
||||
return await dynamicImport(fullPath)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { Event, IEventBusModuleService, Subscriber } from "@medusajs/types"
|
||||
import { Modules, kebabCase, promiseAll } from "@medusajs/utils"
|
||||
import {
|
||||
dynamicImport,
|
||||
kebabCase,
|
||||
Modules,
|
||||
promiseAll,
|
||||
resolveExports,
|
||||
} from "@medusajs/utils"
|
||||
import { access, readdir } from "fs/promises"
|
||||
import { join, parse } from "path"
|
||||
|
||||
@@ -115,7 +121,8 @@ export class SubscriberLoader {
|
||||
}
|
||||
|
||||
private async createDescriptor(absolutePath: string) {
|
||||
return await import(absolutePath).then((module_) => {
|
||||
return await dynamicImport(absolutePath).then((module_) => {
|
||||
module_ = resolveExports(module_)
|
||||
const isValid = this.validateSubscriber(module_, absolutePath)
|
||||
|
||||
if (!isValid) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { promiseAll } from "@medusajs/utils"
|
||||
import { dynamicImport, promiseAll } from "@medusajs/utils"
|
||||
import { logger } from "../logger"
|
||||
import { access, readdir } from "fs/promises"
|
||||
import { join } from "path"
|
||||
@@ -59,7 +59,7 @@ export class WorkflowLoader {
|
||||
return await promiseAll(
|
||||
fileEntries.map(async (entry) => {
|
||||
const fullPath = join(entry.path, entry.name)
|
||||
return await import(fullPath)
|
||||
return await dynamicImport(fullPath)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user