@anyblock/remark-any-block 1.0.1-beta3 → 1.0.1-beta4

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.
@@ -33,7 +33,7 @@ async function jsdom_init(enable = true) {
33
33
  });
34
34
  if (enable) jsdom_enable();
35
35
  }
36
- async function jsdom_enable() {
36
+ function jsdom_enable() {
37
37
  global.Storage = dom.window.Storage;
38
38
  global.window = dom.window;
39
39
  global.history = dom.window.history;
@@ -51,6 +51,11 @@ async function jsdom_enable() {
51
51
  };
52
52
  global.MutationObserver = dom.window.MutationObserver;
53
53
  }
54
+ function jsdom_disable() {
55
+ global.window = void 0;
56
+ global.history = void 0;
57
+ global.document = void 0;
58
+ }
54
59
  const convert = (
55
60
  // Note: overloads in JSDoc can’t yet use different `@template`s.
56
61
  /**
@@ -49672,6 +49677,8 @@ const quartz_transformer_anyblock = () => {
49672
49677
  };
49673
49678
  exports.ABConvertManager = ABConvertManager;
49674
49679
  exports.abConvertEvent = abConvertEvent;
49680
+ exports.jsdom_disable = jsdom_disable;
49681
+ exports.jsdom_enable = jsdom_enable;
49675
49682
  exports.jsdom_init = jsdom_init;
49676
49683
  exports.remark_anyblock_render_codeblock = remark_anyblock_render_codeblock;
49677
49684
  exports.transformer_anyblock = quartz_transformer_anyblock;
@@ -9,7 +9,7 @@ async function jsdom_init(enable = true) {
9
9
  });
10
10
  if (enable) jsdom_enable();
11
11
  }
12
- async function jsdom_enable() {
12
+ function jsdom_enable() {
13
13
  global.Storage = dom.window.Storage;
14
14
  global.window = dom.window;
15
15
  global.history = dom.window.history;
@@ -27,6 +27,11 @@ async function jsdom_enable() {
27
27
  };
28
28
  global.MutationObserver = dom.window.MutationObserver;
29
29
  }
30
+ function jsdom_disable() {
31
+ global.window = void 0;
32
+ global.history = void 0;
33
+ global.document = void 0;
34
+ }
30
35
  const convert = (
31
36
  // Note: overloads in JSDoc can’t yet use different `@template`s.
32
37
  /**
@@ -49649,6 +49654,8 @@ const quartz_transformer_anyblock = () => {
49649
49654
  export {
49650
49655
  ABConvertManager,
49651
49656
  abConvertEvent,
49657
+ jsdom_disable,
49658
+ jsdom_enable,
49652
49659
  jsdom_init,
49653
49660
  remark_anyblock_render_codeblock,
49654
49661
  quartz_transformer_anyblock as transformer_anyblock
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // JsDom。仅用于提供document对象支持 (如果Ob环境中则不需要,用ob自带document对象的)
2
- export { jsdom_init } from './jsdom_init'
2
+ export * from './jsdom_init'
3
3
  export {
4
4
  quartz_transformer_anyblock as transformer_anyblock,
5
5
  // remark_anyblock_to_codeblock, // 取消注释则用库的地方会报错找不到 document
package/jsdom_init.ts CHANGED
@@ -18,7 +18,7 @@ export async function jsdom_init(enable: boolean = true) {
18
18
  }
19
19
 
20
20
  /// 启用 jsdom 环境
21
- export async function jsdom_enable() {
21
+ export function jsdom_enable() {
22
22
  global.Storage = dom.window.Storage;
23
23
  global.window = dom.window as any
24
24
  global.history = dom.window.history // @warn 若缺少该行,则在mdit+build环境下,编译报错:ReferenceError: history is not defined
@@ -37,7 +37,7 @@ export async function jsdom_enable() {
37
37
  }
38
38
 
39
39
  /// 禁用 jsdom 环境
40
- export async function jsdom_disable() {
40
+ export function jsdom_disable() {
41
41
  global.window = undefined
42
42
  global.history = undefined
43
43
  global.document = undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyblock/remark-any-block",
3
- "version": "1.0.1-beta3",
3
+ "version": "1.0.1-beta4",
4
4
  "description": "You can flexibility to create a 'Block' by many means. It also provides many useful features, like `list to table`.",
5
5
  "types": "@types/index_remark.d.ts",
6
6
  "type": "module",