@brillout/docpress 0.2.3 → 0.3.0

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.
@@ -34,6 +34,16 @@ function isBrowserAndDev() {
34
34
  var _a;
35
35
  return typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.port) !== "";
36
36
  }
37
+ function assertWarning(condition, msg) {
38
+ if (condition) {
39
+ return;
40
+ }
41
+ msg = "[DocPress][Warning] " + msg;
42
+ console.warn(msg);
43
+ if (isBrowserAndDev()) {
44
+ alert(msg);
45
+ }
46
+ }
37
47
 
38
48
  // src/utils/isBrowser.ts
39
49
  function isBrowser() {
@@ -43,5 +53,6 @@ function isBrowser() {
43
53
  export {
44
54
  assert,
45
55
  assertUsage,
56
+ assertWarning,
46
57
  isBrowser
47
58
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Emoji
3
- } from "./chunk-MSIQIC6B.js";
3
+ } from "./chunk-Q2ERR2XO.js";
4
4
  import {
5
5
  assert
6
- } from "./chunk-4G4ACGLN.js";
6
+ } from "./chunk-2ZTPUQGS.js";
7
7
 
8
8
  // src/components/RepoLink.tsx
9
9
  import React2 from "react";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  determineSectionUrlHash
3
- } from "./chunk-MSIQIC6B.js";
3
+ } from "./chunk-Q2ERR2XO.js";
4
4
  import {
5
5
  assert
6
- } from "./chunk-4G4ACGLN.js";
6
+ } from "./chunk-2ZTPUQGS.js";
7
7
 
8
8
  // src/vite.config.ts
9
9
  import mdx from "@mdx-js/rollup";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assert
3
- } from "./chunk-4G4ACGLN.js";
3
+ } from "./chunk-2ZTPUQGS.js";
4
4
 
5
5
  // src/utils/filter.ts
6
6
  function filter(obj, predicate) {
package/dist/cli/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  vite_config_default
3
- } from "../chunk-RZAPSH5Z.js";
4
- import "../chunk-MSIQIC6B.js";
5
- import "../chunk-4G4ACGLN.js";
3
+ } from "../chunk-LOKHCWMR.js";
4
+ import "../chunk-Q2ERR2XO.js";
5
+ import "../chunk-2ZTPUQGS.js";
6
6
  import "../chunk-3QC7HYIF.js";
7
7
 
8
8
  // src/cli/index.ts
@@ -16,7 +16,7 @@ Error.stackTraceLimit = Infinity;
16
16
  cli();
17
17
  async function cli() {
18
18
  if (isDev) {
19
- await import("../devServer-UKWIENKN.js");
19
+ await import("../devServer-4RTCJ64B.js");
20
20
  } else if (isBuild) {
21
21
  await build(vite_config_default);
22
22
  await build({ ...vite_config_default, build: { ssr: true } });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assert
3
- } from "../../chunk-4G4ACGLN.js";
3
+ } from "../../chunk-2ZTPUQGS.js";
4
4
  import "../../chunk-3QC7HYIF.js";
5
5
 
6
6
  // src/components/features/initFeatureList.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  vite_config_default
3
- } from "./chunk-RZAPSH5Z.js";
4
- import "./chunk-MSIQIC6B.js";
5
- import "./chunk-4G4ACGLN.js";
3
+ } from "./chunk-LOKHCWMR.js";
4
+ import "./chunk-Q2ERR2XO.js";
5
+ import "./chunk-2ZTPUQGS.js";
6
6
  import "./chunk-3QC7HYIF.js";
7
7
 
8
8
  // src/cli/devServer.ts
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { FeatureList } from './components/features/FeatureList.js';
3
3
 
4
4
  declare function assert(condition: unknown, debugInfo?: unknown): asserts condition;
5
5
  declare function assertUsage(condition: unknown, msg: string): asserts condition;
6
+ declare function assertWarning(condition: unknown, msg: string): asserts condition;
6
7
 
7
8
  declare function isBrowser(): boolean;
8
9
 
@@ -135,4 +136,4 @@ declare function CodeBlock({ children, lineBreak }: {
135
136
  lineBreak?: true;
136
137
  }): JSX.Element;
137
138
 
138
- export { CodeBlock, Config, DocLink, Emoji, EmojiName, HeadingDefinition, HeadingWithoutLink, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsors, assert, assertUsage, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
139
+ export { CodeBlock, Config, DocLink, Emoji, EmojiName, HeadingDefinition, HeadingWithoutLink, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsors, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  isRepoLink,
5
5
  parseTitle,
6
6
  usePageContext
7
- } from "./chunk-D4PNWSRD.js";
7
+ } from "./chunk-6E4FPH4J.js";
8
8
  import {
9
9
  FeatureList
10
10
  } from "./chunk-NVJING6T.js";
@@ -16,12 +16,13 @@ import {
16
16
  filter,
17
17
  jsxToTextContent,
18
18
  objectAssign
19
- } from "./chunk-MSIQIC6B.js";
19
+ } from "./chunk-Q2ERR2XO.js";
20
20
  import {
21
21
  assert,
22
22
  assertUsage,
23
+ assertWarning,
23
24
  isBrowser
24
- } from "./chunk-4G4ACGLN.js";
25
+ } from "./chunk-2ZTPUQGS.js";
25
26
  import "./chunk-3QC7HYIF.js";
26
27
 
27
28
  // src/components/Link.tsx
@@ -501,6 +502,7 @@ export {
501
502
  Sponsors,
502
503
  assert,
503
504
  assertUsage,
505
+ assertWarning,
504
506
  crawlAllFiles,
505
507
  determineSectionTitle,
506
508
  determineSectionUrlHash,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assert
3
- } from "../chunk-4G4ACGLN.js";
3
+ } from "../chunk-2ZTPUQGS.js";
4
4
  import "../chunk-3QC7HYIF.js";
5
5
 
6
6
  // src/autoScrollNav.ts
@@ -4,16 +4,17 @@ import {
4
4
  getHeadings,
5
5
  parseTitle,
6
6
  usePageContext
7
- } from "../chunk-D4PNWSRD.js";
7
+ } from "../chunk-6E4FPH4J.js";
8
8
  import {
9
9
  Emoji,
10
10
  jsxToTextContent,
11
11
  objectAssign
12
- } from "../chunk-MSIQIC6B.js";
12
+ } from "../chunk-Q2ERR2XO.js";
13
13
  import {
14
14
  assert,
15
- assertUsage
16
- } from "../chunk-4G4ACGLN.js";
15
+ assertUsage,
16
+ assertWarning
17
+ } from "../chunk-2ZTPUQGS.js";
17
18
  import {
18
19
  __template
19
20
  } from "../chunk-3QC7HYIF.js";
@@ -222,7 +223,13 @@ function Heading({
222
223
  if (heading.level === 1 || heading.level === 4) {
223
224
  assert(heading.url === void 0);
224
225
  } else {
225
- assert(heading.url);
226
+ const sectionTitle = jsxToTextContent(heading.title);
227
+ assertWarning(
228
+ heading.url,
229
+ `${jsxToTextContent(
230
+ heading.titleInNav
231
+ )} is missing a URL hash. Use \`<h2 id="url-hash">${sectionTitle}</h2>\` instead of \`## ${sectionTitle}\`.`
232
+ );
226
233
  }
227
234
  return /* @__PURE__ */ React3.createElement("a", {
228
235
  className: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "exports": {
5
5
  "./renderer/_default.page.server.js": "./dist/renderer/_default.page.server.js",
6
6
  "./renderer/_default.page.client.js": "./dist/renderer/_default.page.client.js",
@@ -20,8 +20,8 @@
20
20
  "*": [
21
21
  "dist/*"
22
22
  ],
23
- "mdx": [
24
- "mdx.d.ts"
23
+ "types": [
24
+ "types.d.ts"
25
25
  ],
26
26
  "features/*": [
27
27
  "dist/components/features/*"
@@ -35,8 +35,7 @@
35
35
  "// Build Docpress": "",
36
36
  "build": "rm -rf dist/ && framework-builder",
37
37
  "// Release": "",
38
- "prepublishOnly": "pnpm run build",
39
- "release": "npm version patch && npm publish && git push && git push --tags"
38
+ "release": "release-me patch"
40
39
  },
41
40
  "dependencies": {
42
41
  "@mdx-js/mdx": "^2.0.0",
@@ -50,15 +49,16 @@
50
49
  "shiki": "^0.10.1",
51
50
  "twemoji": "^13.1.0",
52
51
  "vite": "npm:@brillout/vite@4.0.1-fix",
53
- "vite-plugin-ssr": "^0.4.57"
52
+ "vite-plugin-ssr": "^0.4.65"
54
53
  },
55
54
  "peerDependencies": {
56
55
  "react": "18",
57
56
  "react-dom": "18"
58
57
  },
59
58
  "devDependencies": {
60
- "@brillout/framework-builder": "^0.1.1",
61
59
  "@brillout/docpress": "link:.",
60
+ "@brillout/framework-builder": "^0.1.1",
61
+ "@brillout/release-me": "^0.1.0",
62
62
  "@types/express": "^4.17.13",
63
63
  "@types/node": "^15.12.1",
64
64
  "@types/react": "^17.0.44",
package/mdx.d.ts DELETED
@@ -1,6 +0,0 @@
1
- declare module '*.mdx' {
2
- import { FunctionComponent } from 'react'
3
- const value: FunctionComponent
4
- export default value
5
- export const headings: { level: number; title: string; id: string; titleAddendum?: string }[]
6
- }