Ver Fonte

Merge pull request #66 from forksss/main

fix: support nextjs 13 (fix #65)
Timothy há 2 anos atrás
pai
commit
fdeaa637f6
5 ficheiros alterados com 21 adições e 21 exclusões
  1. 0 6
      index.js
  2. 13 13
      package.json
  3. 6 0
      src/index.js
  4. 1 1
      test.js
  5. 1 1
      tsconfig.json

+ 0 - 6
index.js

@@ -1,6 +0,0 @@
-import rehypePrismGenerator from './src/generator.js'
-import rehypePrismCommon from './src/common.js'
-import rehypePrism from './src/all.js'
-
-export { rehypePrismGenerator, rehypePrismCommon }
-export default rehypePrism

+ 13 - 13
package.json

@@ -6,26 +6,26 @@
   "files": [
     "dist"
   ],
-  "main": "./dist/rehype-prism-plus.es.js",
-  "module": "./dist/rehype-prism-plus.es.js",
+  "main": "./dist/index.es.js",
+  "module": "./dist/index.es.js",
   "types": "./dist/index.d.ts",
   "type": "module",
   "exports": {
     ".": {
       "types": "./dist/index.d.ts",
-      "import": "./dist/rehype-prism-plus.es.js"
+      "default": "./dist/index.es.js"
     },
     "./common": {
-      "types": "./dist/src/common.d.ts",
-      "import": "./dist/common.es.js"
+      "types": "./dist/common.d.ts",
+      "default": "./dist/common.es.js"
     },
     "./all": {
-      "types": "./dist/src/all.d.ts",
-      "import": "./dist/all.es.js"
+      "types": "./dist/all.d.ts",
+      "default": "./dist/all.es.js"
     },
     "./generator": {
-      "types": "./dist/src/generator.d.ts",
-      "import": "./dist/generator.es.js"
+      "types": "./dist/generator.d.ts",
+      "default": "./dist/generator.es.js"
     }
   },
   "typesVersions": {
@@ -34,18 +34,18 @@
         "./dist/index"
       ],
       "common": [
-        "./dist/src/common"
+        "./dist/common"
       ],
       "all": [
-        "./dist/src/all"
+        "./dist/all"
       ],
       "generator": [
-        "./dist/src/generator"
+        "./dist/generator"
       ]
     }
   },
   "scripts": {
-    "build": "tsc -b && microbundle index.js src/common.js src/all.js src/generator.js --format esm",
+    "build": "tsc -b && microbundle src/index.js src/common.js src/all.js src/generator.js --format esm",
     "tsc": "tsc --watch",
     "lint": "eslint .",
     "prettier": "prettier --write '*.js'",

+ 6 - 0
src/index.js

@@ -0,0 +1,6 @@
+import rehypePrismGenerator from './generator.js'
+import rehypePrismCommon from './common.js'
+import rehypePrism from './all.js'
+
+export { rehypePrismGenerator, rehypePrismCommon }
+export default rehypePrism

+ 1 - 1
test.js

@@ -7,7 +7,7 @@ import remarkParse from 'remark-parse'
 import remarkRehype from 'remark-rehype'
 import rehypeStringify from 'rehype-stringify'
 import dedent from 'dedent'
-import rehypePrism from './index.js'
+import rehypePrism from './src/index.js'
 
 /**
  * Mock meta in code block

+ 1 - 1
tsconfig.json

@@ -1,5 +1,5 @@
 {
-  "include": ["index.js", "src/*"],
+  "include": ["src/*"],
   "compilerOptions": {
     "target": "ES2020",
     "lib": ["ES2020"],