@driftsys/markspec 0.1.0 → 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.
Files changed (242) hide show
  1. package/README.md +32 -8
  2. package/esm/_dnt.polyfills.d.ts +101 -0
  3. package/esm/_dnt.polyfills.d.ts.map +1 -0
  4. package/esm/_dnt.polyfills.js +127 -0
  5. package/esm/compiler/inverses.d.ts +22 -0
  6. package/esm/compiler/inverses.d.ts.map +1 -0
  7. package/esm/compiler/inverses.js +147 -0
  8. package/esm/compiler/link_target.d.ts +19 -0
  9. package/esm/compiler/link_target.d.ts.map +1 -0
  10. package/esm/compiler/link_target.js +66 -0
  11. package/esm/compiler/mod.d.ts +43 -0
  12. package/esm/compiler/mod.d.ts.map +1 -0
  13. package/esm/compiler/mod.js +163 -0
  14. package/esm/compiler/schema.d.ts +38 -0
  15. package/esm/compiler/schema.d.ts.map +1 -0
  16. package/esm/compiler/schema.js +44 -0
  17. package/esm/config/markspec.d.ts +51 -0
  18. package/esm/config/markspec.d.ts.map +1 -0
  19. package/esm/config/markspec.js +216 -0
  20. package/esm/config/mod.d.ts +48 -0
  21. package/esm/config/mod.d.ts.map +1 -0
  22. package/esm/config/mod.js +243 -0
  23. package/esm/formatter/mod.d.ts +65 -0
  24. package/esm/formatter/mod.d.ts.map +1 -0
  25. package/esm/formatter/mod.js +306 -0
  26. package/esm/mod.d.ts +19 -0
  27. package/esm/mod.d.ts.map +1 -1
  28. package/esm/mod.js +18 -0
  29. package/esm/model/attributes.d.ts +47 -0
  30. package/esm/model/attributes.d.ts.map +1 -0
  31. package/esm/model/attributes.js +97 -0
  32. package/esm/model/mod.d.ts +381 -0
  33. package/esm/model/mod.d.ts.map +1 -0
  34. package/esm/model/mod.js +73 -0
  35. package/esm/model/profile.d.ts +189 -0
  36. package/esm/model/profile.d.ts.map +1 -0
  37. package/esm/model/profile.js +31 -0
  38. package/esm/parser/attributes.d.ts +48 -0
  39. package/esm/parser/attributes.d.ts.map +1 -0
  40. package/esm/parser/attributes.js +131 -0
  41. package/esm/parser/captions.d.ts +25 -0
  42. package/esm/parser/captions.d.ts.map +1 -0
  43. package/esm/parser/captions.js +148 -0
  44. package/esm/parser/directives.d.ts +29 -0
  45. package/esm/parser/directives.d.ts.map +1 -0
  46. package/esm/parser/directives.js +88 -0
  47. package/esm/parser/frontmatter.d.ts +53 -0
  48. package/esm/parser/frontmatter.d.ts.map +1 -0
  49. package/esm/parser/frontmatter.js +185 -0
  50. package/esm/parser/grammars.d.ts +22 -0
  51. package/esm/parser/grammars.d.ts.map +1 -0
  52. package/esm/parser/grammars.js +70 -0
  53. package/esm/parser/markdown.d.ts +32 -0
  54. package/esm/parser/markdown.d.ts.map +1 -0
  55. package/esm/parser/markdown.js +225 -0
  56. package/esm/parser/mod.d.ts +73 -0
  57. package/esm/parser/mod.d.ts.map +1 -0
  58. package/esm/parser/mod.js +89 -0
  59. package/esm/parser/references.d.ts +24 -0
  60. package/esm/parser/references.d.ts.map +1 -0
  61. package/esm/parser/references.js +71 -0
  62. package/esm/parser/remark.d.ts +9 -0
  63. package/esm/parser/remark.d.ts.map +1 -0
  64. package/esm/parser/remark.js +11 -0
  65. package/esm/parser/source.d.ts +33 -0
  66. package/esm/parser/source.d.ts.map +1 -0
  67. package/esm/parser/source.js +192 -0
  68. package/esm/profile/cache.d.ts +29 -0
  69. package/esm/profile/cache.d.ts.map +1 -0
  70. package/esm/profile/cache.js +45 -0
  71. package/esm/profile/chain.d.ts +42 -0
  72. package/esm/profile/chain.d.ts.map +1 -0
  73. package/esm/profile/chain.js +193 -0
  74. package/esm/profile/git-cache.d.ts +73 -0
  75. package/esm/profile/git-cache.d.ts.map +1 -0
  76. package/esm/profile/git-cache.js +96 -0
  77. package/esm/profile/load.d.ts +28 -0
  78. package/esm/profile/load.d.ts.map +1 -0
  79. package/esm/profile/load.js +50 -0
  80. package/esm/profile/manifest.d.ts +21 -0
  81. package/esm/profile/manifest.d.ts.map +1 -0
  82. package/esm/profile/manifest.js +830 -0
  83. package/esm/profile/merge.d.ts +26 -0
  84. package/esm/profile/merge.d.ts.map +1 -0
  85. package/esm/profile/merge.js +518 -0
  86. package/esm/profile/mod.d.ts +23 -0
  87. package/esm/profile/mod.d.ts.map +1 -0
  88. package/esm/profile/mod.js +14 -0
  89. package/esm/profile/npm.d.ts +51 -0
  90. package/esm/profile/npm.d.ts.map +1 -0
  91. package/esm/profile/npm.js +186 -0
  92. package/esm/profile/resolver.d.ts +60 -0
  93. package/esm/profile/resolver.d.ts.map +1 -0
  94. package/esm/profile/resolver.js +132 -0
  95. package/esm/reporter/mod.d.ts +31 -0
  96. package/esm/reporter/mod.d.ts.map +1 -0
  97. package/esm/reporter/mod.js +173 -0
  98. package/esm/validator/attributes.d.ts +43 -0
  99. package/esm/validator/attributes.d.ts.map +1 -0
  100. package/esm/validator/attributes.js +169 -0
  101. package/esm/validator/mod.d.ts +44 -0
  102. package/esm/validator/mod.d.ts.map +1 -0
  103. package/esm/validator/mod.js +214 -0
  104. package/esm/validator/normalize.d.ts +21 -0
  105. package/esm/validator/normalize.d.ts.map +1 -0
  106. package/esm/validator/normalize.js +58 -0
  107. package/esm/validator/pattern.d.ts +23 -0
  108. package/esm/validator/pattern.d.ts.map +1 -0
  109. package/esm/validator/pattern.js +44 -0
  110. package/esm/validator/pipeline.d.ts +30 -0
  111. package/esm/validator/pipeline.d.ts.map +1 -0
  112. package/esm/validator/pipeline.js +115 -0
  113. package/esm/validator/traceability.d.ts +48 -0
  114. package/esm/validator/traceability.d.ts.map +1 -0
  115. package/esm/validator/traceability.js +141 -0
  116. package/esm/validator/types.d.ts +48 -0
  117. package/esm/validator/types.d.ts.map +1 -0
  118. package/esm/validator/types.js +140 -0
  119. package/esm/validator/value_types.d.ts +20 -0
  120. package/esm/validator/value_types.d.ts.map +1 -0
  121. package/esm/validator/value_types.js +126 -0
  122. package/package.json +8 -1
  123. package/script/_dnt.polyfills.d.ts +101 -0
  124. package/script/_dnt.polyfills.d.ts.map +1 -0
  125. package/script/_dnt.polyfills.js +130 -0
  126. package/script/compiler/inverses.d.ts +22 -0
  127. package/script/compiler/inverses.d.ts.map +1 -0
  128. package/script/compiler/inverses.js +150 -0
  129. package/script/compiler/link_target.d.ts +19 -0
  130. package/script/compiler/link_target.d.ts.map +1 -0
  131. package/script/compiler/link_target.js +69 -0
  132. package/script/compiler/mod.d.ts +43 -0
  133. package/script/compiler/mod.d.ts.map +1 -0
  134. package/script/compiler/mod.js +169 -0
  135. package/script/compiler/schema.d.ts +38 -0
  136. package/script/compiler/schema.d.ts.map +1 -0
  137. package/script/compiler/schema.js +47 -0
  138. package/script/config/markspec.d.ts +51 -0
  139. package/script/config/markspec.d.ts.map +1 -0
  140. package/script/config/markspec.js +222 -0
  141. package/script/config/mod.d.ts +48 -0
  142. package/script/config/mod.d.ts.map +1 -0
  143. package/script/config/mod.js +250 -0
  144. package/script/formatter/mod.d.ts +65 -0
  145. package/script/formatter/mod.d.ts.map +1 -0
  146. package/script/formatter/mod.js +313 -0
  147. package/script/mod.d.ts +19 -0
  148. package/script/mod.d.ts.map +1 -1
  149. package/script/mod.js +65 -2
  150. package/script/model/attributes.d.ts +47 -0
  151. package/script/model/attributes.d.ts.map +1 -0
  152. package/script/model/attributes.js +101 -0
  153. package/script/model/mod.d.ts +381 -0
  154. package/script/model/mod.d.ts.map +1 -0
  155. package/script/model/mod.js +83 -0
  156. package/script/model/profile.d.ts +189 -0
  157. package/script/model/profile.d.ts.map +1 -0
  158. package/script/model/profile.js +34 -0
  159. package/script/parser/attributes.d.ts +48 -0
  160. package/script/parser/attributes.d.ts.map +1 -0
  161. package/script/parser/attributes.js +137 -0
  162. package/script/parser/captions.d.ts +25 -0
  163. package/script/parser/captions.d.ts.map +1 -0
  164. package/script/parser/captions.js +151 -0
  165. package/script/parser/directives.d.ts +29 -0
  166. package/script/parser/directives.d.ts.map +1 -0
  167. package/script/parser/directives.js +91 -0
  168. package/script/parser/frontmatter.d.ts +53 -0
  169. package/script/parser/frontmatter.d.ts.map +1 -0
  170. package/script/parser/frontmatter.js +188 -0
  171. package/script/parser/grammars.d.ts +22 -0
  172. package/script/parser/grammars.d.ts.map +1 -0
  173. package/script/parser/grammars.js +77 -0
  174. package/script/parser/markdown.d.ts +32 -0
  175. package/script/parser/markdown.d.ts.map +1 -0
  176. package/script/parser/markdown.js +228 -0
  177. package/script/parser/mod.d.ts +73 -0
  178. package/script/parser/mod.d.ts.map +1 -0
  179. package/script/parser/mod.js +101 -0
  180. package/script/parser/references.d.ts +24 -0
  181. package/script/parser/references.d.ts.map +1 -0
  182. package/script/parser/references.js +74 -0
  183. package/script/parser/remark.d.ts +9 -0
  184. package/script/parser/remark.d.ts.map +1 -0
  185. package/script/parser/remark.js +17 -0
  186. package/script/parser/source.d.ts +33 -0
  187. package/script/parser/source.d.ts.map +1 -0
  188. package/script/parser/source.js +198 -0
  189. package/script/profile/cache.d.ts +29 -0
  190. package/script/profile/cache.d.ts.map +1 -0
  191. package/script/profile/cache.js +48 -0
  192. package/script/profile/chain.d.ts +42 -0
  193. package/script/profile/chain.d.ts.map +1 -0
  194. package/script/profile/chain.js +229 -0
  195. package/script/profile/git-cache.d.ts +73 -0
  196. package/script/profile/git-cache.d.ts.map +1 -0
  197. package/script/profile/git-cache.js +104 -0
  198. package/script/profile/load.d.ts +28 -0
  199. package/script/profile/load.d.ts.map +1 -0
  200. package/script/profile/load.js +53 -0
  201. package/script/profile/manifest.d.ts +21 -0
  202. package/script/profile/manifest.d.ts.map +1 -0
  203. package/script/profile/manifest.js +833 -0
  204. package/script/profile/merge.d.ts +26 -0
  205. package/script/profile/merge.d.ts.map +1 -0
  206. package/script/profile/merge.js +521 -0
  207. package/script/profile/mod.d.ts +23 -0
  208. package/script/profile/mod.d.ts.map +1 -0
  209. package/script/profile/mod.js +31 -0
  210. package/script/profile/npm.d.ts +51 -0
  211. package/script/profile/npm.d.ts.map +1 -0
  212. package/script/profile/npm.js +191 -0
  213. package/script/profile/resolver.d.ts +60 -0
  214. package/script/profile/resolver.d.ts.map +1 -0
  215. package/script/profile/resolver.js +136 -0
  216. package/script/reporter/mod.d.ts +31 -0
  217. package/script/reporter/mod.d.ts.map +1 -0
  218. package/script/reporter/mod.js +176 -0
  219. package/script/validator/attributes.d.ts +43 -0
  220. package/script/validator/attributes.d.ts.map +1 -0
  221. package/script/validator/attributes.js +173 -0
  222. package/script/validator/mod.d.ts +44 -0
  223. package/script/validator/mod.d.ts.map +1 -0
  224. package/script/validator/mod.js +231 -0
  225. package/script/validator/normalize.d.ts +21 -0
  226. package/script/validator/normalize.d.ts.map +1 -0
  227. package/script/validator/normalize.js +61 -0
  228. package/script/validator/pattern.d.ts +23 -0
  229. package/script/validator/pattern.d.ts.map +1 -0
  230. package/script/validator/pattern.js +47 -0
  231. package/script/validator/pipeline.d.ts +30 -0
  232. package/script/validator/pipeline.d.ts.map +1 -0
  233. package/script/validator/pipeline.js +118 -0
  234. package/script/validator/traceability.d.ts +48 -0
  235. package/script/validator/traceability.d.ts.map +1 -0
  236. package/script/validator/traceability.js +146 -0
  237. package/script/validator/types.d.ts +48 -0
  238. package/script/validator/types.d.ts.map +1 -0
  239. package/script/validator/types.js +144 -0
  240. package/script/validator/value_types.d.ts +20 -0
  241. package/script/validator/value_types.d.ts.map +1 -0
  242. package/script/validator/value_types.js +129 -0
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
3
+ * but instead of using npm to install additional dependencies,
4
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
5
+ *
6
+ * Note that this code might be imported multiple times
7
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
8
+ * or Node.js might dynamically clear the cache and then force a require).
9
+ * Therefore, it's important to avoid redundant writes to global objects.
10
+ * Additionally, consider that commonjs is used alongside esm,
11
+ * so the two ponyfill functions are stored independently in two separate global objects.
12
+ */
13
+ import { createRequire } from "node:module";
14
+ import { type URL } from "node:url";
15
+ declare global {
16
+ interface ImportMeta {
17
+ /** A string representation of the fully qualified module URL. When the
18
+ * module is loaded locally, the value will be a file URL (e.g.
19
+ * `file:///path/module.ts`).
20
+ *
21
+ * You can also parse the string as a URL to determine more information about
22
+ * how the current module was loaded. For example to determine if a module was
23
+ * local or not:
24
+ *
25
+ * ```ts
26
+ * const url = new URL(import.meta.url);
27
+ * if (url.protocol === "file:") {
28
+ * console.log("this module was loaded locally");
29
+ * }
30
+ * ```
31
+ */
32
+ url: string;
33
+ /**
34
+ * A function that returns resolved specifier as if it would be imported
35
+ * using `import(specifier)`.
36
+ *
37
+ * ```ts
38
+ * console.log(import.meta.resolve("./foo.js"));
39
+ * // file:///dev/foo.js
40
+ * ```
41
+ *
42
+ * @param specifier The module specifier to resolve relative to `parent`.
43
+ * @param parent The absolute parent module URL to resolve from.
44
+ * @returns The absolute (`file:`) URL string for the resolved module.
45
+ */
46
+ resolve(specifier: string, parent?: string | URL | undefined): string;
47
+ /** A flag that indicates if the current module is the main module that was
48
+ * called when starting the program under Deno.
49
+ *
50
+ * ```ts
51
+ * if (import.meta.main) {
52
+ * // this was loaded as the main module, maybe do some bootstrapping
53
+ * }
54
+ * ```
55
+ */
56
+ main: boolean;
57
+ /** The absolute path of the current module.
58
+ *
59
+ * This property is only provided for local modules (ie. using `file://` URLs).
60
+ *
61
+ * Example:
62
+ * ```
63
+ * // Unix
64
+ * console.log(import.meta.filename); // /home/alice/my_module.ts
65
+ *
66
+ * // Windows
67
+ * console.log(import.meta.filename); // C:\alice\my_module.ts
68
+ * ```
69
+ */
70
+ filename: string;
71
+ /** The absolute path of the directory containing the current module.
72
+ *
73
+ * This property is only provided for local modules (ie. using `file://` URLs).
74
+ *
75
+ * * Example:
76
+ * ```
77
+ * // Unix
78
+ * console.log(import.meta.dirname); // /home/alice
79
+ *
80
+ * // Windows
81
+ * console.log(import.meta.dirname); // C:\alice
82
+ * ```
83
+ */
84
+ dirname: string;
85
+ }
86
+ }
87
+ type NodeRequest = ReturnType<typeof createRequire>;
88
+ type NodeModule = NonNullable<NodeRequest["main"]>;
89
+ interface ImportMetaPonyfillCommonjs {
90
+ (require: NodeRequest, module: NodeModule): ImportMeta;
91
+ }
92
+ interface ImportMetaPonyfillEsmodule {
93
+ (importMeta: ImportMeta): ImportMeta;
94
+ }
95
+ interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
96
+ }
97
+ export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
98
+ export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
99
+ export declare let import_meta_ponyfill: ImportMetaPonyfill;
100
+ export {};
101
+ //# sourceMappingURL=_dnt.polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
4
+ /**
5
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
6
+ * but instead of using npm to install additional dependencies,
7
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
8
+ *
9
+ * Note that this code might be imported multiple times
10
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
11
+ * or Node.js might dynamically clear the cache and then force a require).
12
+ * Therefore, it's important to avoid redundant writes to global objects.
13
+ * Additionally, consider that commonjs is used alongside esm,
14
+ * so the two ponyfill functions are stored independently in two separate global objects.
15
+ */
16
+ //@ts-ignore
17
+ const node_module_1 = require("node:module");
18
+ //@ts-ignore
19
+ const node_url_1 = require("node:url");
20
+ //@ts-ignore
21
+ const node_path_1 = require("node:path");
22
+ const defineGlobalPonyfill = (symbolFor, fn) => {
23
+ if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
24
+ Object.defineProperty(globalThis, Symbol.for(symbolFor), {
25
+ configurable: true,
26
+ get() {
27
+ return fn;
28
+ },
29
+ });
30
+ }
31
+ };
32
+ exports.import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
33
+ (() => {
34
+ const moduleImportMetaWM = new WeakMap();
35
+ return (require, module) => {
36
+ let importMetaCache = moduleImportMetaWM.get(module);
37
+ if (importMetaCache == null) {
38
+ const importMeta = Object.assign(Object.create(null), {
39
+ url: (0, node_url_1.pathToFileURL)(module.filename).href,
40
+ main: require.main == module,
41
+ resolve: (specifier, parentURL = importMeta.url) => {
42
+ return (0, node_url_1.pathToFileURL)((importMeta.url === parentURL
43
+ ? require
44
+ : (0, node_module_1.createRequire)(parentURL))
45
+ .resolve(specifier)).href;
46
+ },
47
+ filename: module.filename,
48
+ dirname: module.path,
49
+ });
50
+ moduleImportMetaWM.set(module, importMeta);
51
+ importMetaCache = importMeta;
52
+ }
53
+ return importMetaCache;
54
+ };
55
+ })());
56
+ defineGlobalPonyfill("import-meta-ponyfill-commonjs", exports.import_meta_ponyfill_commonjs);
57
+ exports.import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
58
+ ((importMeta) => {
59
+ const resolveFunStr = String(importMeta.resolve);
60
+ const shimWs = new WeakSet();
61
+ //@ts-ignore
62
+ const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
63
+ .replace(/\/{3,}/, "///");
64
+ const commonShim = (importMeta) => {
65
+ if (typeof importMeta.main !== "boolean") {
66
+ importMeta.main = importMeta.url === mainUrl;
67
+ }
68
+ if (typeof importMeta.filename !== "string") {
69
+ importMeta.filename = (0, node_url_1.fileURLToPath)(importMeta.url);
70
+ importMeta.dirname = (0, node_path_1.dirname)(importMeta.filename);
71
+ }
72
+ };
73
+ if (
74
+ // v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
75
+ resolveFunStr === "undefined" ||
76
+ // v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
77
+ resolveFunStr.startsWith("async")
78
+ // enable by --experimental-import-meta-resolve flag
79
+ ) {
80
+ exports.import_meta_ponyfill_esmodule = (importMeta) => {
81
+ if (!shimWs.has(importMeta)) {
82
+ shimWs.add(importMeta);
83
+ const importMetaUrlRequire = {
84
+ url: importMeta.url,
85
+ require: (0, node_module_1.createRequire)(importMeta.url),
86
+ };
87
+ importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
88
+ return (0, node_url_1.pathToFileURL)((importMetaUrlRequire.url === parentURL
89
+ ? importMetaUrlRequire.require
90
+ : (0, node_module_1.createRequire)(parentURL)).resolve(specifier)).href;
91
+ };
92
+ commonShim(importMeta);
93
+ }
94
+ return importMeta;
95
+ };
96
+ }
97
+ else {
98
+ /// native support
99
+ exports.import_meta_ponyfill_esmodule = (importMeta) => {
100
+ if (!shimWs.has(importMeta)) {
101
+ shimWs.add(importMeta);
102
+ commonShim(importMeta);
103
+ }
104
+ return importMeta;
105
+ };
106
+ }
107
+ return (0, exports.import_meta_ponyfill_esmodule)(importMeta);
108
+ }));
109
+ defineGlobalPonyfill("import-meta-ponyfill-esmodule", exports.import_meta_ponyfill_esmodule);
110
+ exports.import_meta_ponyfill = ((...args) => {
111
+ const _MODULE = (() => {
112
+ if (typeof require === "function" && typeof module === "object") {
113
+ return "commonjs";
114
+ }
115
+ else {
116
+ // eval("typeof import.meta");
117
+ return "esmodule";
118
+ }
119
+ })();
120
+ if (_MODULE === "commonjs") {
121
+ //@ts-ignore
122
+ exports.import_meta_ponyfill = (r, m) => (0, exports.import_meta_ponyfill_commonjs)(r, m);
123
+ }
124
+ else {
125
+ //@ts-ignore
126
+ exports.import_meta_ponyfill = (im) => (0, exports.import_meta_ponyfill_esmodule)(im);
127
+ }
128
+ //@ts-ignore
129
+ return (0, exports.import_meta_ponyfill)(...args);
130
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module compiler/inverses
3
+ *
4
+ * Inverse attribute generation — walks forward link attributes that carry
5
+ * an `inverse:` declaration and emits synthetic back-link values on target
6
+ * entries.
7
+ */
8
+ import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
9
+ /** Result of inverse generation. */
10
+ export interface GenerateInversesResult {
11
+ readonly entries: readonly Entry[];
12
+ readonly diagnostics: readonly Diagnostic[];
13
+ }
14
+ /**
15
+ * Generate inverse (back-link) attributes from forward link declarations.
16
+ *
17
+ * Walks every identified entry's `typedAttributes` for attributes that match
18
+ * an `inverse:` declaration in the effective profile, then accumulates
19
+ * back-links on target entries.
20
+ */
21
+ export declare function generateInverses(entries: readonly Entry[], profile: EffectiveProfile): GenerateInversesResult;
22
+ //# sourceMappingURL=inverses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inverses.d.ts","sourceRoot":"","sources":["../../src/compiler/inverses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEN,MAAM,iBAAiB,CAAC;AAEzB,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,sBAAsB,CA4GxB"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ /**
3
+ * @module compiler/inverses
4
+ *
5
+ * Inverse attribute generation — walks forward link attributes that carry
6
+ * an `inverse:` declaration and emits synthetic back-link values on target
7
+ * entries.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.generateInverses = generateInverses;
11
+ /**
12
+ * Generate inverse (back-link) attributes from forward link declarations.
13
+ *
14
+ * Walks every identified entry's `typedAttributes` for attributes that match
15
+ * an `inverse:` declaration in the effective profile, then accumulates
16
+ * back-links on target entries.
17
+ */
18
+ function generateInverses(entries, profile) {
19
+ if (entries.length === 0) {
20
+ return { entries: [], diagnostics: [] };
21
+ }
22
+ // Step 1: Collect all inverse declarations from the profile
23
+ const inverseSpecs = collectInverseSpecs(profile);
24
+ if (inverseSpecs.length === 0) {
25
+ return { entries: [...entries], diagnostics: [] };
26
+ }
27
+ // Step 2: Index entries by id
28
+ const byId = new Map();
29
+ for (const e of entries) {
30
+ if (e.id !== undefined) {
31
+ byId.set(e.id, e);
32
+ }
33
+ }
34
+ // Step 3–5: Walk entries, accumulate back-links
35
+ // Map: targetId → Map<inverseAttrName, Set<sourceId>>
36
+ const generated = new Map();
37
+ for (const source of entries) {
38
+ if (source.shape !== "identified" || source.id === undefined)
39
+ continue;
40
+ const applicableSpecs = resolveApplicableSpecs(inverseSpecs, source.type);
41
+ for (const spec of applicableSpecs) {
42
+ const forwardValues = source.typedAttributes.get(spec.attrName);
43
+ if (!forwardValues)
44
+ continue;
45
+ for (const targetId of forwardValues) {
46
+ const target = byId.get(targetId);
47
+ if (!target || target.type !== spec.inverse.category)
48
+ continue;
49
+ let targetMap = generated.get(targetId);
50
+ if (!targetMap) {
51
+ targetMap = new Map();
52
+ generated.set(targetId, targetMap);
53
+ }
54
+ let idSet = targetMap.get(spec.inverse.name);
55
+ if (!idSet) {
56
+ idSet = new Set();
57
+ targetMap.set(spec.inverse.name, idSet);
58
+ }
59
+ idSet.add(source.id);
60
+ }
61
+ }
62
+ }
63
+ // Step 6–7: Merge generated values into entries, emit diagnostics
64
+ const diagnostics = [];
65
+ const result = [];
66
+ for (const e of entries) {
67
+ const targetInverses = e.id ? generated.get(e.id) : undefined;
68
+ if (!targetInverses) {
69
+ result.push(e);
70
+ continue;
71
+ }
72
+ const newAttrs = new Map(e.typedAttributes);
73
+ let changed = false;
74
+ for (const [inverseName, generatedIds] of targetInverses) {
75
+ const generatedArr = [...generatedIds];
76
+ const authored = e.typedAttributes.get(inverseName);
77
+ if (authored && authored.length > 0) {
78
+ const authoredSet = new Set(authored);
79
+ const genSet = generatedIds;
80
+ const match = authoredSet.size === genSet.size &&
81
+ [...authoredSet].every((v) => genSet.has(v));
82
+ if (!match) {
83
+ diagnostics.push({
84
+ code: "MSL-L005",
85
+ severity: "warning",
86
+ message: `authored "${inverseName}" on ${e.displayId} differs from generated inverse values`,
87
+ location: e.location,
88
+ });
89
+ // Union authored + generated
90
+ const union = new Set([...authored, ...generatedArr]);
91
+ newAttrs.set(inverseName, [...union]);
92
+ changed = true;
93
+ }
94
+ // If match, keep as-is
95
+ }
96
+ else {
97
+ newAttrs.set(inverseName, generatedArr);
98
+ changed = true;
99
+ }
100
+ }
101
+ if (changed) {
102
+ result.push({ ...e, typedAttributes: newAttrs });
103
+ }
104
+ else {
105
+ result.push(e);
106
+ }
107
+ }
108
+ return { entries: result, diagnostics };
109
+ }
110
+ /** Collect all inverse-bearing attribute declarations from the profile. */
111
+ function collectInverseSpecs(profile) {
112
+ const specs = [];
113
+ // Universal scope
114
+ for (const [, entry] of profile.attributes) {
115
+ if (entry.value.inverse) {
116
+ specs.push({
117
+ attrName: entry.value.name,
118
+ inverse: entry.value.inverse,
119
+ sourceType: null,
120
+ });
121
+ }
122
+ }
123
+ // Identified shape scope
124
+ for (const [, entry] of profile.identified.attributes) {
125
+ if (entry.value.inverse) {
126
+ specs.push({
127
+ attrName: entry.value.name,
128
+ inverse: entry.value.inverse,
129
+ sourceType: null,
130
+ });
131
+ }
132
+ }
133
+ // Type scopes
134
+ for (const [typeName, typeEntry] of profile.types) {
135
+ for (const [, attrEntry] of typeEntry.value.attributes) {
136
+ if (attrEntry.value.inverse) {
137
+ specs.push({
138
+ attrName: attrEntry.value.name,
139
+ inverse: attrEntry.value.inverse,
140
+ sourceType: typeName,
141
+ });
142
+ }
143
+ }
144
+ }
145
+ return specs;
146
+ }
147
+ /** Filter specs applicable to a source entry's type. */
148
+ function resolveApplicableSpecs(specs, sourceType) {
149
+ return specs.filter((s) => s.sourceType === null || s.sourceType === sourceType);
150
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module core/compiler/link_target
3
+ *
4
+ * MSL-T013: Tiered link-target severity. After links are extracted and
5
+ * inverses generated, check the state of each link target:
6
+ *
7
+ * | Target state | Severity |
8
+ * |---|---|
9
+ * | Active | OK (no diagnostic) |
10
+ * | Draft (Labels: DRAFT) | info |
11
+ * | Retired (Superseded-by: set OR Deprecated: set) | warning |
12
+ */
13
+ import type { Diagnostic, DisplayId, Entry, Link } from "../model/mod.js";
14
+ /**
15
+ * Check all link targets for retirement/draft state.
16
+ * Run after inverse generation so `Superseded-by:` is available.
17
+ */
18
+ export declare function checkLinkTargets(entries: ReadonlyMap<DisplayId, Entry>, links: readonly Link[]): Diagnostic[];
19
+ //# sourceMappingURL=link_target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link_target.d.ts","sourceRoot":"","sources":["../../src/compiler/link_target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,EACtC,KAAK,EAAE,SAAS,IAAI,EAAE,GACrB,UAAU,EAAE,CA4Bd"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/compiler/link_target
4
+ *
5
+ * MSL-T013: Tiered link-target severity. After links are extracted and
6
+ * inverses generated, check the state of each link target:
7
+ *
8
+ * | Target state | Severity |
9
+ * |---|---|
10
+ * | Active | OK (no diagnostic) |
11
+ * | Draft (Labels: DRAFT) | info |
12
+ * | Retired (Superseded-by: set OR Deprecated: set) | warning |
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.checkLinkTargets = checkLinkTargets;
16
+ /**
17
+ * Check all link targets for retirement/draft state.
18
+ * Run after inverse generation so `Superseded-by:` is available.
19
+ */
20
+ function checkLinkTargets(entries, links) {
21
+ const diagnostics = [];
22
+ for (const link of links) {
23
+ const target = entries.get(link.to);
24
+ if (!target)
25
+ continue; // Unresolved — handled by MSL-T005/MSL-T012
26
+ const state = classifyTargetState(target);
27
+ if (state === "active")
28
+ continue;
29
+ if (state === "draft") {
30
+ diagnostics.push({
31
+ code: "MSL-T013",
32
+ severity: "info",
33
+ message: `${link.from}: link target '${link.to}' is marked DRAFT`,
34
+ location: link.location,
35
+ });
36
+ }
37
+ else {
38
+ diagnostics.push({
39
+ code: "MSL-T013",
40
+ severity: "warning",
41
+ message: `${link.from}: link target '${link.to}' is retired`,
42
+ location: link.location,
43
+ });
44
+ }
45
+ }
46
+ return diagnostics;
47
+ }
48
+ function classifyTargetState(entry) {
49
+ // Check for retirement markers
50
+ const hasDeprecated = entry.rawAttributes.some((a) => a.key === "Deprecated");
51
+ if (hasDeprecated)
52
+ return "retired";
53
+ const supersededBy = entry.typedAttributes.get("Superseded-by");
54
+ if (supersededBy && supersededBy.length > 0)
55
+ return "retired";
56
+ // Check for DRAFT label via typedAttributes
57
+ const labels = entry.typedAttributes.get("Labels");
58
+ if (labels && labels.includes("DRAFT"))
59
+ return "draft";
60
+ // Also check raw attributes for Labels containing DRAFT
61
+ for (const attr of entry.rawAttributes) {
62
+ if (attr.key === "Labels") {
63
+ const values = attr.value.split(",").map((s) => s.trim());
64
+ if (values.includes("DRAFT"))
65
+ return "draft";
66
+ }
67
+ }
68
+ return "active";
69
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module compiler
3
+ *
4
+ * Compiler pipeline. Takes file paths, parses all entries, validates them,
5
+ * builds a bidirectional traceability graph, and returns the compiled model.
6
+ */
7
+ import type { Diagnostic, DisplayId, Document, EffectiveProfile, Entry, Link } from "../model/mod.js";
8
+ /** Options for {@linkcode compile}. */
9
+ export interface CompileOptions {
10
+ /** File reader function. Required — no default to avoid Deno dependency in library code. */
11
+ readonly readFile: (path: string) => Promise<string>;
12
+ /** Active profile for inverse attribute generation. Optional — when absent, inverses are skipped. */
13
+ readonly profile?: EffectiveProfile;
14
+ }
15
+ /** Compiled project output with resolved traceability graph. */
16
+ export interface CompileResult {
17
+ /** All entries keyed by display ID. */
18
+ readonly entries: ReadonlyMap<DisplayId, Entry>;
19
+ /** All traceability links. */
20
+ readonly links: readonly Link[];
21
+ /** Outgoing links per entry (entry → targets). */
22
+ readonly forward: ReadonlyMap<DisplayId, readonly Link[]>;
23
+ /** Incoming links per entry (entry → sources pointing to it). */
24
+ readonly reverse: ReadonlyMap<DisplayId, readonly Link[]>;
25
+ /** Documents keyed by file path. A file appears here only when it carried YAML front matter per ADR-007. */
26
+ readonly documents: ReadonlyMap<string, Document>;
27
+ /** Diagnostics from parsing and validation. */
28
+ readonly diagnostics: readonly Diagnostic[];
29
+ }
30
+ /**
31
+ * Compile MarkSpec files from the given paths into a resolved
32
+ * traceability graph.
33
+ *
34
+ * @param paths - File paths to compile
35
+ * @param options - Compile options
36
+ * @returns Compiled entries, links, and diagnostics
37
+ */
38
+ export declare function compile(paths: readonly string[], options: CompileOptions): Promise<CompileResult>;
39
+ export { serializeCompileResult } from "./schema.js";
40
+ export type { SerializedCompileResult } from "./schema.js";
41
+ export { generateInverses } from "./inverses.js";
42
+ export type { GenerateInversesResult } from "./inverses.js";
43
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,IAAI,EAGL,MAAM,iBAAiB,CAAC;AAMzB,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAChD,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1D,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1D,4GAA4G;IAC5G,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CA4ExB;AAmGD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}