Просмотр исходного кода

chore(core): Update graphql-upload, fix ESM issues

Michael Bromley 2 лет назад
Родитель
Сommit
5dbc49b909

+ 1 - 1
package.json

@@ -37,7 +37,7 @@
     "@graphql-codegen/fragment-matcher": "4.0.1",
     "@graphql-codegen/typescript": "3.0.1",
     "@graphql-codegen/typescript-operations": "3.0.1",
-    "@graphql-tools/schema": "^8.3.1",
+    "@graphql-tools/schema": "^9.0.17",
     "@types/jest": "^29.4.0",
     "@types/klaw-sync": "^6.0.0",
     "@types/node": "^14.14.31",

+ 3 - 2
packages/core/package.json

@@ -17,6 +17,7 @@
   "funding": "https://github.com/sponsors/michaelbromley",
   "private": false,
   "license": "MIT",
+  "type": "commonjs",
   "scripts": {
     "tsc:watch": "tsc -p ./build/tsconfig.build.json --watch",
     "gulp:watch": "gulp -f ./build/gulpfile.ts watch",
@@ -40,8 +41,8 @@
     "cli/**/*"
   ],
   "dependencies": {
-    "@graphql-tools/stitch": "^7.5.3",
-    "@nestjs/apollo": "10.2.0",
+    "@graphql-tools/stitch": "^8.7.43",
+    "@nestjs/apollo": "^10.2.0",
     "@nestjs/common": "9.3.9",
     "@nestjs/core": "9.3.9",
     "@nestjs/graphql": "10.2.0",

+ 3 - 3
packages/core/src/bootstrap.ts

@@ -47,7 +47,7 @@ export async function bootstrap(userConfig: Partial<VendureConfig>): Promise<INe
     // The AppModule *must* be loaded only after the entities have been set in the
     // config, so that they are available when the AppModule decorator is evaluated.
     // tslint:disable-next-line:whitespace
-    const appModule = await import('./app.module');
+    const appModule = await import('./app.module.js');
     setProcessContext('server');
     const { hostname, port, cors, middleware } = config.apiOptions;
     DefaultLogger.hideNestBoostrapLogs();
@@ -106,7 +106,7 @@ export async function bootstrapWorker(userConfig: Partial<VendureConfig>): Promi
     setProcessContext('worker');
     DefaultLogger.hideNestBoostrapLogs();
 
-    const WorkerModule = await import('./worker/worker.module').then(m => m.WorkerModule);
+    const WorkerModule = await import('./worker/worker.module.js').then(m => m.WorkerModule);
     const workerApp = await NestFactory.createApplicationContext(WorkerModule, {
         logger: new Logger(),
     });
@@ -129,7 +129,7 @@ export async function preBootstrapConfig(
     }
 
     const entities = await getAllEntities(userConfig);
-    const { coreSubscribersMap } = await import('./entity/subscribers');
+    const { coreSubscribersMap } = await import('./entity/subscribers.js');
     setConfig({
         dbConnectionOptions: {
             entities,

+ 2 - 1
packages/core/src/common/generate-public-id.ts

@@ -1,4 +1,5 @@
-import { customAlphabet } from 'nanoid';
+// tslint:disable-next-line:no-var-requires
+const { customAlphabet } = require('nanoid');
 
 const nanoid = customAlphabet('123456789ABCDEFGHJKLMNPQRSTUVWXYZ', 16);
 

+ 2 - 2
packages/core/src/config/auth/native-authentication-strategy.ts

@@ -35,8 +35,8 @@ export class NativeAuthenticationStrategy implements AuthenticationStrategy<Nati
     async init(injector: Injector) {
         this.connection = injector.get(TransactionalConnection);
         // These are lazily-loaded to avoid a circular dependency
-        const { PasswordCipher } = await import('../../service/helpers/password-cipher/password-cipher');
-        const { UserService } = await import('../../service/services/user.service');
+        const { PasswordCipher } = await import('../../service/helpers/password-cipher/password-cipher.js');
+        const { UserService } = await import('../../service/services/user.service.js');
         this.passwordCipher = injector.get(PasswordCipher);
         this.userService = injector.get(UserService);
     }

+ 3 - 1
packages/core/src/config/catalog/default-collection-filters.ts

@@ -1,5 +1,6 @@
 import { LanguageCode } from '@vendure/common/lib/generated-types';
-import { customAlphabet } from 'nanoid';
+// tslint:disable-next-line:no-var-requires
+const { customAlphabet } = require('nanoid');
 
 import { ConfigArgDef } from '../../common/configurable-operation';
 import { UserInputError } from '../../common/error/errors';
@@ -28,6 +29,7 @@ export const combineWithAndArg: ConfigArgDef<'boolean'> = {
     description: [
         {
             languageCode: LanguageCode.en,
+            // tslint:disable-next-line:max-line-length
             value: 'If this filter is being combined with other filters, do all conditions need to be satisfied (AND), or just one or the other (OR)?',
         },
     ],

+ 6 - 6
packages/core/src/config/fulfillment/default-fulfillment-process.ts

@@ -60,14 +60,14 @@ export const defaultFulfillmentProcess: FulfillmentProcess<FulfillmentState> = {
     async init(injector) {
         // Lazily import these services to avoid a circular dependency error
         // due to this being used as part of the DefaultConfig
-        const TransactionalConnection = await import('../../connection/transactional-connection').then(
+        const TransactionalConnection = await import('../../connection/transactional-connection.js').then(
             m => m.TransactionalConnection,
         );
-        const ConfigService = await import('../config.service').then(m => m.ConfigService);
-        const HistoryService = await import('../../service/index').then(m => m.HistoryService);
-        const OrderService = await import('../../service/index').then(m => m.OrderService);
-        const StockMovementService = await import('../../service/index').then(m => m.StockMovementService);
-        const StockLevelService = await import('../../service/index').then(m => m.StockLevelService);
+        const ConfigService = await import('../config.service.js').then(m => m.ConfigService);
+        const HistoryService = await import('../../service/index.js').then(m => m.HistoryService);
+        const OrderService = await import('../../service/index.js').then(m => m.OrderService);
+        const StockMovementService = await import('../../service/index.js').then(m => m.StockMovementService);
+        const StockLevelService = await import('../../service/index.js').then(m => m.StockLevelService);
         connection = injector.get(TransactionalConnection);
         configService = injector.get(ConfigService);
         orderService = injector.get(OrderService);

+ 2 - 2
packages/core/src/config/order/default-active-order-strategy.ts

@@ -25,8 +25,8 @@ export class DefaultActiveOrderStrategy implements ActiveOrderStrategy {
     async init(injector: Injector) {
         this.connection = injector.get(TransactionalConnection);
         // Lazy import these dependencies to avoid a circular dependency issue in NestJS.
-        const { OrderService } = await import('../../service/services/order.service');
-        const { SessionService } = await import('../../service/services/session.service');
+        const { OrderService } = await import('../../service/services/order.service.js');
+        const { SessionService } = await import('../../service/services/session.service.js');
         this.orderService = injector.get(OrderService);
         this.sessionService = injector.get(SessionService);
     }

+ 7 - 7
packages/core/src/config/order/default-order-process.ts

@@ -233,15 +233,15 @@ export function configureDefaultOrderProcess(options: DefaultOrderProcessOptions
         async init(injector) {
             // Lazily import these services to avoid a circular dependency error
             // due to this being used as part of the DefaultConfig
-            const ConfigService = await import('../config.service').then(m => m.ConfigService);
-            const EventBus = await import('../../event-bus/index').then(m => m.EventBus);
-            const StockMovementService = await import('../../service/index').then(
+            const ConfigService = await import('../config.service.js').then(m => m.ConfigService);
+            const EventBus = await import('../../event-bus/index.js').then(m => m.EventBus);
+            const StockMovementService = await import('../../service/index.js').then(
                 m => m.StockMovementService,
             );
-            const StockLevelService = await import('../../service/index').then(m => m.StockLevelService);
-            const HistoryService = await import('../../service/index').then(m => m.HistoryService);
-            const OrderSplitter = await import('../../service/index').then(m => m.OrderSplitter);
-            const ProductVariantService = await import('../../service/index').then(
+            const StockLevelService = await import('../../service/index.js').then(m => m.StockLevelService);
+            const HistoryService = await import('../../service/index.js').then(m => m.HistoryService);
+            const OrderSplitter = await import('../../service/index.js').then(m => m.OrderSplitter);
+            const ProductVariantService = await import('../../service/index.js').then(
                 m => m.ProductVariantService,
             );
             connection = injector.get(TransactionalConnection);

+ 5 - 3
packages/core/src/config/payment/default-payment-process.ts

@@ -47,9 +47,11 @@ export const defaultPaymentProcess: PaymentProcess<PaymentState> = {
     async init(injector) {
         // Lazily import these services to avoid a circular dependency error
         // due to this being used as part of the DefaultConfig
-        const ConfigService = await import('../config.service').then(m => m.ConfigService);
-        const HistoryService = await import('../../service/index').then(m => m.HistoryService);
-        const OrderService = await import('../../service/services/order.service').then(m => m.OrderService);
+        const ConfigService = await import('../config.service.js').then(m => m.ConfigService);
+        const HistoryService = await import('../../service/index.js').then(m => m.HistoryService);
+        const OrderService = await import('../../service/services/order.service.js').then(
+            m => m.OrderService,
+        );
         configService = injector.get(ConfigService);
         historyService = injector.get(HistoryService);
         orderService = injector.get(OrderService);

+ 1 - 1
packages/core/src/config/promotion/conditions/customer-group-condition.ts

@@ -26,7 +26,7 @@ export const customerGroup = new PromotionCondition({
     },
     async init(injector) {
         // Lazily-imported to avoid circular dependency issues.
-        const { CustomerService } = await import('../../../service/services/customer.service');
+        const { CustomerService } = await import('../../../service/services/customer.service.js');
         customerService = injector.get(CustomerService);
         subscription = injector
             .get(EventBus)

+ 3 - 1
packages/core/tsconfig.json

@@ -1,9 +1,11 @@
 {
   "extends": "../../tsconfig.json",
   "compilerOptions": {
+    "moduleResolution": "NodeNext",
     "declaration": true,
     "removeComments": true,
     "strictPropertyInitialization": false,
-    "sourceMap": true
+    "sourceMap": true,
+    "allowJs": true
   }
 }

+ 1 - 0
tsconfig.json

@@ -1,6 +1,7 @@
 {
   "compilerOptions": {
     "module": "commonjs",
+    "moduleResolution": "Node",
     "noLib": false,
     "skipLibCheck": true,
     "lib": ["es2019", "esnext.asynciterable"],

Разница между файлами не показана из-за своего большого размера
+ 296 - 325
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов