From 181b9d86a406b3ec38b77b1cdc4bf131e2bfb1fc Mon Sep 17 00:00:00 2001 From: Enrico Sacchetti Date: Fri, 23 Jun 2023 21:55:21 -0400 Subject: [PATCH] chore: convert cjs to esm --- docs/package.json | 1 + docs/svelte.config.js | 24 ++++++++++++------------ package.json | 1 + 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/package.json b/docs/package.json index 2c0fdaa8..9202cd39 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,5 +1,6 @@ { "private": true, + "type": "module", "scripts": { "dev": "run-p dev:*", "dev:routify": "cross-env NODE_ENV=development routify run", diff --git a/docs/svelte.config.js b/docs/svelte.config.js index d683498e..ec62b072 100644 --- a/docs/svelte.config.js +++ b/docs/svelte.config.js @@ -1,14 +1,14 @@ -const path = require("path"); -const { mdsvex } = require("mdsvex"); -const { parse, walk } = require("svelte/compiler"); -const slug = require("remark-slug"); -const visit = require("unist-util-visit"); -const { format } = require("prettier"); -const pkg = require("../package.json"); -const component_api = require("./src/COMPONENT_API.json"); -const fs = require("fs"); -const Prism = require("prismjs"); -require("prism-svelte"); +import path from "node:path"; +import fs from "node:fs"; +import { mdsvex } from "mdsvex"; +import { parse, walk } from "svelte/compiler"; +import slug from "remark-slug"; +import visit from "unist-util-visit"; +import { format } from "prettier"; +import pkg from "../package.json" assert { type: "json" }; +import component_api from "./src/COMPONENT_API.json" assert { type: "json" }; +import Prism from "prismjs"; +import "prism-svelte"; const component_api_by_name = component_api.components.reduce((a, c) => { return { @@ -139,7 +139,7 @@ function carbonify() { }; } -module.exports = { +export { extensions: [".svelte", ".svx"], preprocess: [ { diff --git a/package.json b/package.json index 68124873..dcb29755 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "svelte": "./src/index.js", "main": "./lib/index.js", "module": "./lib/index.mjs", + "type": "module", "types": "./types/index.d.ts", "sideEffects": [ "css/*.css"