@astrojs/markdown-remark 1.1.1 → 1.1.3

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.
@@ -1,5 +1,5 @@
1
- @astrojs/markdown-remark:build: cache hit, replaying output ddf2e92d592039b4
1
+ @astrojs/markdown-remark:build: cache hit, replaying output 724460aa5e72591a
2
2
  @astrojs/markdown-remark:build: 
3
- @astrojs/markdown-remark:build: > @astrojs/markdown-remark@1.1.1 build /home/runner/work/astro/astro/packages/markdown/remark
3
+ @astrojs/markdown-remark:build: > @astrojs/markdown-remark@1.1.3 build /home/runner/work/astro/astro/packages/markdown/remark
4
4
  @astrojs/markdown-remark:build: > astro-scripts build "src/**/*.ts" && tsc -p tsconfig.json
5
5
  @astrojs/markdown-remark:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @astrojs/markdown-remark
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4842](https://github.com/withastro/astro/pull/4842) [`812658ad2`](https://github.com/withastro/astro/commit/812658ad2ab3732a99e35c4fd903e302e723db46) Thanks [@bluwy](https://github.com/bluwy)! - Fix non-hoisted remark/rehype plugin loading
8
+
9
+ - [#4842](https://github.com/withastro/astro/pull/4842) [`812658ad2`](https://github.com/withastro/astro/commit/812658ad2ab3732a99e35c4fd903e302e723db46) Thanks [@bluwy](https://github.com/bluwy)! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
10
+
11
+ ## 1.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#4787](https://github.com/withastro/astro/pull/4787) [`df54595a8`](https://github.com/withastro/astro/commit/df54595a8836448a621fceeb38fbaacde1bb27cf) Thanks [@merceyz](https://github.com/merceyz)! - declare `hast-util-to-html` as a dependency
16
+
3
17
  ## 1.1.1
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,16 @@
1
+ import { resolve as importMetaResolve } from "import-meta-resolve";
2
+ import path from "path";
3
+ import { pathToFileURL } from "url";
4
+ const cwdUrlStr = pathToFileURL(path.join(process.cwd(), "package.json")).toString();
1
5
  async function importPlugin(p) {
2
6
  if (typeof p === "string") {
3
- const importResult = await import(p);
7
+ try {
8
+ const importResult2 = await import(p);
9
+ return importResult2.default;
10
+ } catch {
11
+ }
12
+ const resolved = await importMetaResolve(p, cwdUrlStr);
13
+ const importResult = await import(resolved);
4
14
  return importResult.default;
5
15
  }
6
16
  return p;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -21,6 +21,9 @@
21
21
  "acorn": "^8.7.1",
22
22
  "acorn-jsx": "^5.3.2",
23
23
  "github-slugger": "^1.4.0",
24
+ "hast-util-to-html": "^8.0.3",
25
+ "import-meta-resolve": "^2.1.0",
26
+ "mdast-util-from-markdown": "^1.2.0",
24
27
  "mdast-util-mdx-expression": "^1.2.1",
25
28
  "mdast-util-mdx-jsx": "^1.2.0",
26
29
  "micromark-extension-mdx-expression": "^1.0.3",
@@ -45,7 +48,7 @@
45
48
  "@types/mdast": "^3.0.10",
46
49
  "@types/mocha": "^9.1.1",
47
50
  "@types/unist": "^2.0.6",
48
- "astro-scripts": "0.0.7",
51
+ "astro-scripts": "0.0.8",
49
52
  "chai": "^4.3.6",
50
53
  "micromark-util-types": "^1.0.2",
51
54
  "mocha": "^9.2.2"
@@ -1,8 +1,21 @@
1
+ import { resolve as importMetaResolve } from 'import-meta-resolve';
2
+ import path from 'path';
1
3
  import * as unified from 'unified';
4
+ import { pathToFileURL } from 'url';
5
+
6
+ const cwdUrlStr = pathToFileURL(path.join(process.cwd(), 'package.json')).toString();
2
7
 
3
8
  async function importPlugin(p: string | unified.Plugin): Promise<unified.Plugin> {
4
9
  if (typeof p === 'string') {
5
- const importResult = await import(p);
10
+ // Try import from this package first
11
+ try {
12
+ const importResult = await import(p);
13
+ return importResult.default;
14
+ } catch {}
15
+
16
+ // Try import from user project
17
+ const resolved = await importMetaResolve(p, cwdUrlStr);
18
+ const importResult = await import(resolved);
6
19
  return importResult.default;
7
20
  }
8
21