@astrojs/markdown-remark 1.1.2 → 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 a3732d3a3024eee3
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.2 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,13 @@
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
+
3
11
  ## 1.1.2
4
12
 
5
13
  ### 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.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -22,6 +22,8 @@
22
22
  "acorn-jsx": "^5.3.2",
23
23
  "github-slugger": "^1.4.0",
24
24
  "hast-util-to-html": "^8.0.3",
25
+ "import-meta-resolve": "^2.1.0",
26
+ "mdast-util-from-markdown": "^1.2.0",
25
27
  "mdast-util-mdx-expression": "^1.2.1",
26
28
  "mdast-util-mdx-jsx": "^1.2.0",
27
29
  "micromark-extension-mdx-expression": "^1.0.3",
@@ -46,7 +48,7 @@
46
48
  "@types/mdast": "^3.0.10",
47
49
  "@types/mocha": "^9.1.1",
48
50
  "@types/unist": "^2.0.6",
49
- "astro-scripts": "0.0.7",
51
+ "astro-scripts": "0.0.8",
50
52
  "chai": "^4.3.6",
51
53
  "micromark-util-types": "^1.0.2",
52
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