@md-plugins/md-plugin-imports 0.1.0-alpha.1 → 0.1.0-alpha.5

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.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024-present, Jeff Galbraith
3
+ Copyright (c) 2024-present, MD-PLUGINS
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -62,7 +62,7 @@ The `md-plugin-imports` plugin does not currently accept options. All `<script i
62
62
 
63
63
  The plugin recognizes `<script import>` blocks in the following format:
64
64
 
65
- ```markdown
65
+ ```markup
66
66
  <script import>
67
67
  import A from './A.vue';
68
68
  import B from './B.vue';
@@ -80,7 +80,7 @@ import B from './B.vue';
80
80
 
81
81
  The plugin supports multiple `<script import>` blocks in a single Markdown file:
82
82
 
83
- ```markdown
83
+ ```markup
84
84
  <script import>
85
85
  import A from './A.vue';
86
86
  </script>
@@ -98,7 +98,7 @@ Both `import A from './A.vue';` and `import B from './B.vue';` will be added to
98
98
 
99
99
  The plugin does not interfere with frontmatter or other Markdown content:
100
100
 
101
- ```markdown
101
+ ```markup
102
102
  ---
103
103
  title: Frontmatter Example
104
104
  ---
package/dist/index.mjs CHANGED
@@ -2,9 +2,7 @@ const scriptRE = /^\s*<script import>\n([\s\S]*?)\n\s*<\/script>/gm;
2
2
  const importsPlugin = (md) => {
3
3
  const render = md.render.bind(md);
4
4
  md.render = (src, env = {}) => {
5
- if (!env.pageScripts) {
6
- env.pageScripts = /* @__PURE__ */ new Set();
7
- }
5
+ env.pageScripts = env.pageScripts || /* @__PURE__ */ new Set();
8
6
  const mdContent = src.replace(scriptRE, (_, scriptContent) => {
9
7
  const imports = scriptContent.split("\n").map((line) => line.trim()).filter(Boolean);
10
8
  imports.forEach((importLine) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/md-plugin-imports",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.5",
4
4
  "description": "A markdown-it plugin for handling imports in markdown files.",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -33,16 +33,21 @@
33
33
  "./dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@types/markdown-it": "^14.1.2",
37
36
  "markdown-it": "^14.1.0",
38
- "@md-plugins/shared": "0.1.0-alpha.1"
37
+ "@md-plugins/shared": "0.1.0-alpha.5"
38
+ },
39
+ "devDependencies": {
40
+ "@types/markdown-it": "^14.1.2"
41
+ },
42
+ "peerDependencies": {
43
+ "markdown-it": "^14.1.0"
39
44
  },
40
45
  "publishConfig": {
41
46
  "access": "public"
42
47
  },
43
48
  "scripts": {
44
49
  "build": "unbuild",
45
- "clean": "rm -rf dist",
50
+ "clean": "rm -rf dist/ node_modules/",
46
51
  "test": "vitest"
47
52
  }
48
53
  }