@sillsdev/docu-notion 0.16.2-alpha.2 → 0.17.0-alpha.1

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.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -15,18 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.hashOfString = exports.makeImagePersistencePlan = void 0;
39
+ exports.makeImagePersistencePlan = makeImagePersistencePlan;
40
+ exports.hashOfString = hashOfString;
30
41
  const Path = __importStar(require("path"));
31
42
  const log_1 = require("./log");
32
43
  const process_1 = require("process");
@@ -98,7 +109,6 @@ function makeImagePersistencePlan(options, imageSet, imageBlockId, imageOutputRo
98
109
  "/" +
99
110
  imageSet.outputFileName;
100
111
  }
101
- exports.makeImagePersistencePlan = makeImagePersistencePlan;
102
112
  function findLastUuid(url) {
103
113
  // Regex for a UUID surrounded by slashes
104
114
  const uuidPattern = /(?<=\/)[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}(?=\/)/gi;
@@ -113,8 +123,10 @@ function hashOfString(s) {
113
123
  hash = Math.imul(31, hash) + s.charCodeAt(i);
114
124
  return Math.abs(hash);
115
125
  }
116
- exports.hashOfString = hashOfString;
117
126
  function hashOfBufferContent(buffer) {
118
- const hash = crypto_1.default.createHash("sha256").update(buffer).digest("hex");
127
+ const hash = crypto_1.default
128
+ .createHash("sha256")
129
+ .update(Uint8Array.from(buffer))
130
+ .digest("hex");
119
131
  return hash.slice(0, 20);
120
132
  }
@@ -19,7 +19,7 @@ var PageType;
19
19
  (function (PageType) {
20
20
  PageType[PageType["DatabasePage"] = 0] = "DatabasePage";
21
21
  PageType[PageType["Simple"] = 1] = "Simple";
22
- })(PageType = exports.PageType || (exports.PageType = {}));
22
+ })(PageType || (exports.PageType = PageType = {}));
23
23
  class NotionPage {
24
24
  constructor(args) {
25
25
  this.layoutContext = args.layoutContext;
package/dist/assets.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare enum AssetType {
3
2
  Image = "image",
4
3
  Video = "video"
package/dist/assets.js CHANGED
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.writeAsset = exports.AssetType = void 0;
36
+ exports.AssetType = void 0;
37
+ exports.writeAsset = writeAsset;
27
38
  const fs = __importStar(require("fs-extra"));
28
39
  const Path = __importStar(require("path"));
29
40
  const log_1 = require("./log");
@@ -31,7 +42,7 @@ var AssetType;
31
42
  (function (AssetType) {
32
43
  AssetType["Image"] = "image";
33
44
  AssetType["Video"] = "video";
34
- })(AssetType = exports.AssetType || (exports.AssetType = {}));
45
+ })(AssetType || (exports.AssetType = AssetType = {}));
35
46
  function writeAsset(path, buffer) {
36
47
  // Note: it's tempting to not spend time writing this out if we already have
37
48
  // it from a previous run. But we don't really know it's the same. A) it
@@ -47,4 +58,3 @@ function writeAsset(path, buffer) {
47
58
  }
48
59
  fs.createWriteStream(path).write(buffer); // async but we're not waiting
49
60
  }
50
- exports.writeAsset = writeAsset;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.loadConfigAsync = void 0;
48
+ exports.loadConfigAsync = loadConfigAsync;
39
49
  const Cosmic = __importStar(require("cosmiconfig"));
40
50
  const default_docunotion_config_1 = __importDefault(require("./default.docunotion.config"));
41
51
  const log_1 = require("../log");
@@ -44,8 +54,8 @@ const process_1 = require("process");
44
54
  // read the plugins from the config file
45
55
  // and add them to the map
46
56
  function loadConfigAsync() {
47
- var _a, _b, _c, _d, _e;
48
57
  return __awaiter(this, void 0, void 0, function* () {
58
+ var _a, _b, _c, _d, _e;
49
59
  let config = default_docunotion_config_1.default;
50
60
  try {
51
61
  const cosmic = Cosmic.cosmiconfig("docu-notion", {
@@ -83,4 +93,3 @@ function loadConfigAsync() {
83
93
  return config;
84
94
  });
85
95
  }
86
- exports.loadConfigAsync = loadConfigAsync;
@@ -15,7 +15,7 @@ const defaultConfig = {
15
15
  plugins: [
16
16
  // Notion "Block" JSON modifiers
17
17
  EscapeHtmlBlockModifier_1.standardEscapeHtmlBlockModifier,
18
- HeadingTransformer_1.standardHeadingTransformer,
18
+ HeadingTransformer_1.standardHeadingTransformer, // does operations on both the Notion JSON and then later, on the notion to markdown transform
19
19
  // Notion to Markdown transformers. Most things get transformed correctly by the notion-to-markdown library,
20
20
  // but some things need special handling.
21
21
  ColumnTransformer_1.standardColumnTransformer,
package/dist/images.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { FileTypeResult } from "file-type";
3
2
  import { ListBlockChildrenResponseResult } from "notion-to-md/build/types";
4
3
  import { IDocuNotionContext, IDocuNotionContextPageInfo, IPlugin } from "./plugins/pluginTypes";
package/dist/images.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.cleanupOldImages = exports.parseImageBlock = exports.markdownToMDImageTransformer = exports.standardImageTransformer = exports.initImageHandling = void 0;
48
+ exports.standardImageTransformer = void 0;
49
+ exports.initImageHandling = initImageHandling;
50
+ exports.markdownToMDImageTransformer = markdownToMDImageTransformer;
51
+ exports.parseImageBlock = parseImageBlock;
52
+ exports.cleanupOldImages = cleanupOldImages;
39
53
  const fs = __importStar(require("fs-extra"));
40
54
  const file_type_1 = __importDefault(require("file-type"));
41
55
  const MakeImagePersistencePlan_1 = require("./MakeImagePersistencePlan");
@@ -66,7 +80,6 @@ function initImageHandling(prefix, outputPath, incomingLocales) {
66
80
  }
67
81
  });
68
82
  }
69
- exports.initImageHandling = initImageHandling;
70
83
  exports.standardImageTransformer = {
71
84
  name: "DownloadImagesToRepo",
72
85
  notionToMarkdownTransforms: [
@@ -93,7 +106,6 @@ function markdownToMDImageTransformer(block, context) {
93
106
  return `![${altText}](${href})`;
94
107
  });
95
108
  }
96
- exports.markdownToMDImageTransformer = markdownToMDImageTransformer;
97
109
  function processImageBlock(block, context) {
98
110
  return __awaiter(this, void 0, void 0, function* () {
99
111
  const imageBlock = block.image;
@@ -210,7 +222,6 @@ function parseImageBlock(image) {
210
222
  //console.log(JSON.stringify(imageSet, null, 2));
211
223
  return imageSet;
212
224
  }
213
- exports.parseImageBlock = parseImageBlock;
214
225
  function imageWasSeen(path) {
215
226
  existingImagesNotSeenYetInPull = existingImagesNotSeenYetInPull.filter(p => p !== path);
216
227
  }
@@ -222,4 +233,3 @@ function cleanupOldImages() {
222
233
  }
223
234
  });
224
235
  }
225
- exports.cleanupOldImages = cleanupOldImages;
package/dist/index.js CHANGED
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
16
16
  }) : function(o, v) {
17
17
  o["default"] = v;
18
18
  });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
26
36
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
37
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
38
  };
@@ -51,7 +51,7 @@ test("Latex Rendering", () => __awaiter(void 0, void 0, void 0, function* () {
51
51
  statusTag: "",
52
52
  },
53
53
  pages: pages,
54
- counts: counts,
54
+ counts: counts, // review will this get copied or pointed to?
55
55
  imports: [],
56
56
  convertNotionLinkToLocalDocusaurusLink: (url) => (0, internalLinks_1.convertInternalUrl)(context, url),
57
57
  };
package/dist/log.js CHANGED
@@ -3,41 +3,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logDebug = exports.logDebugFn = exports.verbose = exports.endGroup = exports.group = exports.info = exports.warning = exports.error = exports.setLogLevel = void 0;
6
+ exports.setLogLevel = setLogLevel;
7
+ exports.error = error;
8
+ exports.warning = warning;
9
+ exports.info = info;
10
+ exports.group = group;
11
+ exports.endGroup = endGroup;
12
+ exports.verbose = verbose;
13
+ exports.logDebugFn = logDebugFn;
14
+ exports.logDebug = logDebug;
7
15
  const chalk_1 = __importDefault(require("chalk"));
8
16
  chalk_1.default;
9
17
  let logLevel;
10
18
  function setLogLevel(l) {
11
19
  logLevel = l;
12
20
  }
13
- exports.setLogLevel = setLogLevel;
14
21
  function error(s) {
15
22
  console.error(chalk_1.default.red(wrapForCI(s, "error")));
16
23
  }
17
- exports.error = error;
18
24
  function warning(s) {
19
25
  console.log(chalk_1.default.hex("#FFA500")(wrapForCI(s, "warning")));
20
26
  }
21
- exports.warning = warning;
22
27
  function info(s) {
23
28
  console.log(s);
24
29
  }
25
- exports.info = info;
26
30
  // make sure to call endGroup(), eventually, after calling this
27
31
  function group(s) {
28
32
  console.log(chalk_1.default.blue(wrapForCI(s, "group")));
29
33
  }
30
- exports.group = group;
31
34
  // github actions needs an ::endgroup:: to end a group
32
35
  function endGroup() {
33
36
  console.log(wrapForCI("", "endgroup"));
34
37
  }
35
- exports.endGroup = endGroup;
36
38
  function verbose(s) {
37
39
  if (logLevel === "verbose" || logLevel === "debug")
38
40
  console.log(chalk_1.default.green(s));
39
41
  }
40
- exports.verbose = verbose;
41
42
  // use this one if the debug info would take time to construct,
42
43
  // so you want to skip doing it if not in debug mode
43
44
  function logDebugFn(label, runIfLoggingDebug) {
@@ -45,14 +46,12 @@ function logDebugFn(label, runIfLoggingDebug) {
45
46
  logDebug(label, runIfLoggingDebug());
46
47
  }
47
48
  }
48
- exports.logDebugFn = logDebugFn;
49
49
  function logDebug(label, info) {
50
50
  if (logLevel === "debug") {
51
51
  console.log(chalk_1.default.dim(wrapForCI(`[${label}]`, "debug")));
52
52
  console.log(chalk_1.default.dim(wrapForCI(info, "debug")));
53
53
  }
54
54
  }
55
- exports.logDebug = logDebug;
56
55
  function wrapForCI(s, githubActionsPrefix) {
57
56
  // for now, we only know about github actions, but submit a PR if you want to add more
58
57
  return process.env["GITHUB_ACTIONS"] === "true"
@@ -44,8 +44,8 @@ function notionColumnToMarkdown(notionToMarkdown, getBlockChildren, block) {
44
44
  // and the 'notion-client' dependency.
45
45
  // This logic was mostly taken from react-notion-x (sister project of notion-client).
46
46
  function getColumnWidth(block) {
47
- var _a, _b, _c, _d;
48
47
  return __awaiter(this, void 0, void 0, function* () {
48
+ var _a, _b, _c, _d;
49
49
  const unofficialNotionClient = new notion_client_1.NotionAPI();
50
50
  const blockId = block.id;
51
51
  const recordMap = yield (0, pull_1.executeWithRateLimitAndRetries)(`unofficialNotionClient.getPage(${blockId}) in getColumnWidth()`, () => {
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.standardTableTransformer = exports.tableTransformer = void 0;
15
+ exports.standardTableTransformer = void 0;
16
+ exports.tableTransformer = tableTransformer;
16
17
  const markdown_table_1 = __importDefault(require("markdown-table"));
17
18
  // This is mostly a copy of the table handler from notion-to-md. The change is to handle newlines in the
18
19
  // notion cell content.
@@ -58,7 +59,6 @@ function tableTransformer(notionToMarkdown, getBlockChildren, block) {
58
59
  return (0, markdown_table_1.default)(tableArr);
59
60
  });
60
61
  }
61
- exports.tableTransformer = tableTransformer;
62
62
  exports.standardTableTransformer = {
63
63
  name: "standardTableTransformer",
64
64
  notionToMarkdownTransforms: [
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -16,7 +16,7 @@ exports.imgurGifEmbed = {
16
16
  name: "imgur",
17
17
  regexMarkdownModifications: [
18
18
  {
19
- regex: /\[.*?\]\((.*?imgur\.com\/.*?)\)/,
19
+ regex: /\[.*?\]\((.*?imgur\.com\/.*?)\)/, // imgur.com
20
20
  // imgur links to gifs need a .gif at the end, but the url they give you doesn't have one.
21
21
  replacementPattern: `![]($1.gif)`,
22
22
  },
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.standardInternalLinkConversion = exports.parseLinkId = exports.convertInternalUrl = void 0;
3
+ exports.standardInternalLinkConversion = void 0;
4
+ exports.convertInternalUrl = convertInternalUrl;
5
+ exports.parseLinkId = parseLinkId;
4
6
  const log_1 = require("../log");
5
7
  // converts a url to a local link, if it is a link to a page in the Notion site
6
8
  // only here for plugins, notion won't normally be giving us raw urls (at least not that I've noticed)
@@ -26,7 +28,6 @@ function convertInternalUrl(context, url) {
26
28
  }
27
29
  return convertLinkHref(context, targetPage, url);
28
30
  }
29
- exports.convertInternalUrl = convertInternalUrl;
30
31
  // handles the whole markdown link, including the label
31
32
  function convertInternalLink(context, markdownLink) {
32
33
  // match both [foo](/123) and [bar](https://www.notion.so/123) <-- the "mention" link style
@@ -89,7 +90,6 @@ function parseLinkId(fullLinkId) {
89
90
  }
90
91
  return { baseLinkId: fullLinkId, fragmentId: "" };
91
92
  }
92
- exports.parseLinkId = parseLinkId;
93
93
  exports.standardInternalLinkConversion = {
94
94
  name: "standard internal link conversion",
95
95
  linkModifier: {
@@ -9,7 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.oneBlockToMarkdown = exports.makeSamplePageObject = exports.blocksToMarkdown = exports.kTemporaryTestDirectory = void 0;
12
+ exports.kTemporaryTestDirectory = void 0;
13
+ exports.blocksToMarkdown = blocksToMarkdown;
14
+ exports.makeSamplePageObject = makeSamplePageObject;
15
+ exports.oneBlockToMarkdown = oneBlockToMarkdown;
13
16
  const client_1 = require("@notionhq/client");
14
17
  const notion_to_md_1 = require("notion-to-md");
15
18
  const HierarchicalNamedLayoutStrategy_1 = require("../HierarchicalNamedLayoutStrategy");
@@ -102,7 +105,6 @@ children, validApiKey) {
102
105
  return r;
103
106
  });
104
107
  }
105
- exports.blocksToMarkdown = blocksToMarkdown;
106
108
  // This is used for things like testing links to other pages and frontmatter creation,
107
109
  // when just testing what happens to individual blocks is not enough.
108
110
  // after getting this, you can make changes to it, then pass it to blocksToMarkdown
@@ -226,7 +228,6 @@ function makeSamplePageObject(options) {
226
228
  // console.log(p.matchesLinkId);
227
229
  return p;
228
230
  }
229
- exports.makeSamplePageObject = makeSamplePageObject;
230
231
  function oneBlockToMarkdown(config, block, targetPage, targetPage2) {
231
232
  return __awaiter(this, void 0, void 0, function* () {
232
233
  // just in case someone expects these other properties that aren't normally relevant,
@@ -262,4 +263,3 @@ function oneBlockToMarkdown(config, block, targetPage, targetPage2) {
262
263
  return yield blocksToMarkdown(config, [fullBlock], targetPage ? [dummyPage1, targetPage, targetPage2 !== null && targetPage2 !== void 0 ? targetPage2 : dummyPage2] : undefined);
263
264
  });
264
265
  }
265
- exports.oneBlockToMarkdown = oneBlockToMarkdown;
package/dist/pull.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,7 +42,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
42
  });
33
43
  };
34
44
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.numberChildrenIfNumberedList = exports.initNotionClient = exports.executeWithRateLimitAndRetries = exports.notionPull = void 0;
45
+ exports.notionPull = notionPull;
46
+ exports.executeWithRateLimitAndRetries = executeWithRateLimitAndRetries;
47
+ exports.initNotionClient = initNotionClient;
48
+ exports.numberChildrenIfNumberedList = numberChildrenIfNumberedList;
36
49
  const fs = __importStar(require("fs-extra"));
37
50
  const notion_to_md_1 = require("notion-to-md");
38
51
  const HierarchicalNamedLayoutStrategy_1 = require("./HierarchicalNamedLayoutStrategy");
@@ -98,7 +111,6 @@ function notionPull(options) {
98
111
  (0, log_1.endGroup)();
99
112
  });
100
113
  }
101
- exports.notionPull = notionPull;
102
114
  function outputPages(options, config, pages) {
103
115
  return __awaiter(this, void 0, void 0, function* () {
104
116
  const context = {
@@ -113,7 +125,7 @@ function outputPages(options, config, pages) {
113
125
  notionToMarkdown: notionToMarkdown,
114
126
  options: options,
115
127
  pages: pages,
116
- counts: counts,
128
+ counts: counts, // review will this get copied or pointed to?
117
129
  imports: [],
118
130
  convertNotionLinkToLocalDocusaurusLink: (url) => (0, internalLinks_1.convertInternalUrl)(context, url),
119
131
  };
@@ -154,8 +166,8 @@ function outputPages(options, config, pages) {
154
166
  // then step through this list creating the files we need, and, crucially, be
155
167
  // able to figure out what the url will be for any links between content pages.
156
168
  function getPagesRecursively(options, incomingContext, pageIdOfThisParent, orderOfThisParent, rootLevel) {
157
- var _a;
158
169
  return __awaiter(this, void 0, void 0, function* () {
170
+ var _a;
159
171
  const pageInTheOutline = yield fromPageId(incomingContext, pageIdOfThisParent, orderOfThisParent, true);
160
172
  (0, log_1.info)(`Looking for children and links from ${incomingContext}/${pageInTheOutline.nameOrTitle}`);
161
173
  const r = yield getBlockChildren(pageInTheOutline.pageId);
@@ -251,7 +263,6 @@ function executeWithRateLimitAndRetries(label, asyncFunction) {
251
263
  throw lastException;
252
264
  });
253
265
  }
254
- exports.executeWithRateLimitAndRetries = executeWithRateLimitAndRetries;
255
266
  function rateLimit() {
256
267
  return __awaiter(this, void 0, void 0, function* () {
257
268
  if (notionLimiter.getTokensRemaining() < 1) {
@@ -261,8 +272,8 @@ function rateLimit() {
261
272
  });
262
273
  }
263
274
  function getBlockChildren(id) {
264
- var _a, _b;
265
275
  return __awaiter(this, void 0, void 0, function* () {
276
+ var _a, _b;
266
277
  // we can only get so many responses per call, so we set this to
267
278
  // the first response we get, then keep adding to its array of blocks
268
279
  // with each subsequent response
@@ -300,7 +311,6 @@ function initNotionClient(notionToken) {
300
311
  });
301
312
  return notionClient;
302
313
  }
303
- exports.initNotionClient = initNotionClient;
304
314
  function fromPageId(context, pageId, order, foundDirectlyInOutline) {
305
315
  return __awaiter(this, void 0, void 0, function* () {
306
316
  const metadata = yield getPageMetadata(pageId);
@@ -330,4 +340,3 @@ function numberChildrenIfNumberedList(blocks) {
330
340
  }
331
341
  }
332
342
  }
333
- exports.numberChildrenIfNumberedList = numberChildrenIfNumberedList;
package/dist/run.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.run = void 0;
48
+ exports.run = run;
39
49
  const fs = __importStar(require("fs-extra"));
40
50
  const commander_1 = require("commander");
41
51
  const log_1 = require("./log");
@@ -86,7 +96,6 @@ function run() {
86
96
  yield (0, pull_1.notionPull)(commander_1.program.opts()).then(() => console.log("docu-notion Finished."));
87
97
  });
88
98
  }
89
- exports.run = run;
90
99
  function parseLocales(value) {
91
100
  return value.split(",").map(l => l.trim().toLowerCase());
92
101
  }
package/dist/transform.js CHANGED
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getMarkdownFromNotionBlocks = exports.getMarkdownForPage = void 0;
15
+ exports.getMarkdownForPage = getMarkdownForPage;
16
+ exports.getMarkdownFromNotionBlocks = getMarkdownFromNotionBlocks;
16
17
  const chalk_1 = __importDefault(require("chalk"));
17
18
  const log_1 = require("./log");
18
19
  const pull_1 = require("./pull");
@@ -30,7 +31,6 @@ function getMarkdownForPage(config, context, page) {
30
31
  return `${frontmatter}\n${body}`;
31
32
  });
32
33
  }
33
- exports.getMarkdownForPage = getMarkdownForPage;
34
34
  // this is split off from getMarkdownForPage so that unit tests can provide the block contents
35
35
  function getMarkdownFromNotionBlocks(context, config, blocks) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,7 +54,6 @@ function getMarkdownFromNotionBlocks(context, config, blocks) {
54
54
  return `${imports}\n${body}`;
55
55
  });
56
56
  }
57
- exports.getMarkdownFromNotionBlocks = getMarkdownFromNotionBlocks;
58
57
  // operations on notion blocks before they are converted to markdown
59
58
  function doNotionBlockTransforms(blocks, config) {
60
59
  for (const block of blocks) {
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "prettier": "^2.2.1",
58
58
  "rimraf": "^4.1.2",
59
59
  "semantic-release": "^19.0.2",
60
- "typescript": "^4.6.4",
60
+ "typescript": "^5.9.3",
61
61
  "vite": "^4.2.1",
62
62
  "vitest": "^0.30.1"
63
63
  },
@@ -88,7 +88,7 @@
88
88
  "access": "public"
89
89
  },
90
90
  "volta": {
91
- "node": "18.16.0"
91
+ "node": "22.21.0"
92
92
  },
93
- "version": "0.16.2-alpha.2"
93
+ "version": "0.17.0-alpha.1"
94
94
  }