@payloadcms/graphql 3.0.0-beta.79 → 3.0.0-beta.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin.js +44 -11
  2. package/package.json +4 -4
package/bin.js CHANGED
@@ -1,21 +1,54 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node --no-deprecation
2
2
 
3
- import { register } from 'node:module'
4
3
  import path from 'node:path'
5
4
  import { fileURLToPath, pathToFileURL } from 'node:url'
6
5
 
7
- // Allow disabling SWC for debugging
8
- if (process.env.DISABLE_SWC !== 'true') {
6
+ const useSwc = process.argv.includes('--use-swc')
7
+ const disableTranspile = process.argv.includes('--disable-transpile')
8
+
9
+ if (disableTranspile) {
10
+ // Remove --disable-transpile from arguments
11
+ process.argv = process.argv.filter((arg) => arg !== '--disable-transpile')
12
+
13
+ const start = async () => {
14
+ const { bin } = await import('./dist/bin/index.js')
15
+ await bin()
16
+ }
17
+
18
+ void start()
19
+ } else {
9
20
  const filename = fileURLToPath(import.meta.url)
10
21
  const dirname = path.dirname(filename)
11
22
  const url = pathToFileURL(dirname).toString() + '/'
12
23
 
13
- register('@swc-node/register/esm', url)
14
- }
24
+ if (!useSwc) {
25
+ const start = async () => {
26
+ // Use tsx
27
+ let tsImport = (await import('tsx/esm/api')).tsImport
15
28
 
16
- const start = async () => {
17
- const { bin } = await import('./dist/bin/index.js')
18
- await bin()
19
- }
29
+ const { bin } = await tsImport('./dist/bin/index.js', url)
30
+ await bin()
31
+ }
20
32
 
21
- void start()
33
+ void start()
34
+ } else if (useSwc) {
35
+ const { register } = await import('node:module')
36
+ // Remove --use-swc from arguments
37
+ process.argv = process.argv.filter((arg) => arg !== '--use-swc')
38
+
39
+ try {
40
+ register('@swc-node/register/esm', url)
41
+ } catch (_) {
42
+ console.error(
43
+ '@swc-node/register is not installed. Please install @swc-node/register in your project, if you want to use swc in payload run.',
44
+ )
45
+ }
46
+
47
+ const start = async () => {
48
+ const { bin } = await import('./dist/bin/index.js')
49
+ await bin()
50
+ }
51
+
52
+ void start()
53
+ }
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/graphql",
3
- "version": "3.0.0-beta.79",
3
+ "version": "3.0.0-beta.81",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,18 +36,18 @@
36
36
  "dependencies": {
37
37
  "graphql-scalars": "1.22.2",
38
38
  "pluralize": "8.0.0",
39
- "@swc-node/register": "1.10.9",
39
+ "tsx": "4.17.0",
40
40
  "ts-essentials": "7.0.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/pluralize": "^0.0.33",
44
44
  "graphql-http": "^1.22.0",
45
45
  "@payloadcms/eslint-config": "3.0.0-beta.59",
46
- "payload": "3.0.0-beta.79"
46
+ "payload": "3.0.0-beta.81"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "graphql": "^16.8.1",
50
- "payload": "3.0.0-beta.79"
50
+ "payload": "3.0.0-beta.81"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "pnpm build:types && pnpm build:swc",