@thxgg/steward 0.1.24 → 0.1.26
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.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{Bc2V3wPK.js → B2ow85x_.js} +2 -2
- package/.output/public/_nuxt/{U78rMDmo.js → B6CbIr08.js} +1 -1
- package/.output/public/_nuxt/{BknRrWsw.js → BLQAF8wp.js} +1 -1
- package/.output/public/_nuxt/BXuwtOqb.js +1 -0
- package/.output/public/_nuxt/CAMiEhze.js +1 -0
- package/.output/public/_nuxt/{BRQ9Cxaw.js → CIBCqZF5.js} +1 -1
- package/.output/public/_nuxt/Ce0-nlm9.js +1 -0
- package/.output/public/_nuxt/{T11EuTtn.js → ConzneVY.js} +1 -1
- package/.output/public/_nuxt/D0qxz_Pn.js +1310 -0
- package/.output/public/_nuxt/D3PDtLSF.js +3 -0
- package/.output/public/_nuxt/{C73kduX-.js → DdKC0UAK.js} +1 -1
- package/.output/public/_nuxt/Detail.BGdvrJGh.css +1 -0
- package/.output/public/_nuxt/{C53_p0K1.js → Dkh9ic1y.js} +1 -1
- package/.output/public/_nuxt/LEjJTR7-.js +1 -0
- package/.output/public/_nuxt/{BTmXUZ_s.js → UqZfMfrZ.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/25438e34-19a2-421d-aede-53fd18f1ccd4.json +1 -0
- package/.output/public/_nuxt/dckrK0oj.js +1 -0
- package/.output/public/_nuxt/entry.DT4p6_uW.css +1 -0
- package/.output/public/_nuxt/pIWeVmPw.js +1 -0
- package/.output/public/_nuxt/xrHaPo1U.js +60 -0
- package/.output/server/chunks/_/prd-service.mjs.map +1 -1
- package/.output/server/chunks/build/{Detail-DMMUwTWr.mjs → Detail-rpcemNXe.mjs} +674 -481
- package/.output/server/chunks/build/Detail-rpcemNXe.mjs.map +1 -0
- package/.output/server/chunks/build/DiffViewer-styles.B1FB5NJj.mjs +8 -0
- package/.output/server/chunks/build/DiffViewer-styles.B1FB5NJj.mjs.map +1 -0
- package/.output/server/chunks/build/{_prd_-ByugK4Yi.mjs → _prd_-CeibvZOH.mjs} +67 -233
- package/.output/server/chunks/build/_prd_-CeibvZOH.mjs.map +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{default-BKKgG7HJ.mjs → default-iq8SaDDN.mjs} +3 -3
- package/.output/server/chunks/build/default-iq8SaDDN.mjs.map +1 -0
- package/.output/server/chunks/build/{error-404-Bf6kdO80.mjs → error-404-DFale9A5.mjs} +2 -2
- package/.output/server/chunks/build/error-404-DFale9A5.mjs.map +1 -0
- package/.output/server/chunks/build/{index-DE1tjHAd.mjs → index-Po00RvHm.mjs} +2 -2
- package/.output/server/chunks/build/index-Po00RvHm.mjs.map +1 -0
- package/.output/server/chunks/build/{nuxt-link-SvT1nf8Z.mjs → nuxt-link-B4oWFn7n.mjs} +2 -2
- package/.output/server/chunks/build/nuxt-link-B4oWFn7n.mjs.map +1 -0
- package/.output/server/chunks/build/{repo-graph-DzT45gSB.mjs → repo-graph-BQVFpA-w.mjs} +5 -4
- package/.output/server/chunks/build/repo-graph-BQVFpA-w.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +7 -7
- package/.output/server/chunks/build/styles.mjs +4 -5
- package/.output/server/chunks/build/{usePrd-hXZOmvAv.mjs → usePrd-Bb6jlnNZ.mjs} +2 -2
- package/.output/server/chunks/build/usePrd-Bb6jlnNZ.mjs.map +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +983 -678
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/node_modules/@pierre/diffs/dist/components/File.js +324 -0
- package/.output/server/node_modules/@pierre/diffs/dist/components/FileDiff.js +395 -0
- package/.output/server/node_modules/@pierre/diffs/dist/components/FileStream.js +161 -0
- package/.output/server/node_modules/@pierre/diffs/dist/components/web-components.js +25 -0
- package/.output/server/node_modules/@pierre/diffs/dist/constants.js +23 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/areLanguagesAttached.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/attachResolvedLanguages.js +20 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/cleanUpResolvedLanguages.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/constants.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedLanguages.js +16 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedOrResolveLanguage.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/hasResolvedLanguages.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguage.js +30 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguages.js +25 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/shared_highlighter.js +71 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/areThemesAttached.js +12 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/attachResolvedThemes.js +24 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/cleanUpResolvedThemes.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/constants.js +9 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedOrResolveTheme.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedThemes.js +16 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/hasResolvedThemes.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/registerCustomCSSVariableTheme.js +18 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/registerCustomTheme.js +14 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/resolveTheme.js +35 -0
- package/.output/server/node_modules/@pierre/diffs/dist/highlighter/themes/resolveThemes.js +21 -0
- package/.output/server/node_modules/@pierre/diffs/dist/index.js +84 -0
- package/.output/server/node_modules/@pierre/diffs/dist/managers/LineSelectionManager.js +282 -0
- package/.output/server/node_modules/@pierre/diffs/dist/managers/MouseEventManager.js +244 -0
- package/.output/server/node_modules/@pierre/diffs/dist/managers/ResizeManager.js +132 -0
- package/.output/server/node_modules/@pierre/diffs/dist/managers/ScrollSyncManager.js +62 -0
- package/.output/server/node_modules/@pierre/diffs/dist/managers/UniversalRenderingManager.js +32 -0
- package/.output/server/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.js +655 -0
- package/.output/server/node_modules/@pierre/diffs/dist/renderers/FileRenderer.js +243 -0
- package/.output/server/node_modules/@pierre/diffs/dist/shiki-stream/stream.js +32 -0
- package/.output/server/node_modules/@pierre/diffs/dist/shiki-stream/tokenizer.js +71 -0
- package/.output/server/node_modules/@pierre/diffs/dist/sprite.js +55 -0
- package/.output/server/node_modules/@pierre/diffs/dist/style.js +6 -0
- package/.output/server/node_modules/@pierre/diffs/dist/themes/pierre-dark.js +1328 -0
- package/.output/server/node_modules/@pierre/diffs/dist/themes/pierre-light.js +1328 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/areFilesEqual.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/areObjectsEqual.js +18 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/areOptionsEqual.js +12 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/areSelectionsEqual.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/areThemesEqual.js +9 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/cleanLastNewline.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createAnnotationElement.js +21 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createAnnotationWrapperNode.js +12 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createCodeNode.js +12 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createEmptyRowBuffer.js +16 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createFileHeaderElement.js +84 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createHoverContentNode.js +15 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createNoNewlineElement.js +24 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createPreElement.js +28 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createRowNodes.js +20 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createSeparator.js +69 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createSpanNodeFromToken.js +13 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createStyleElement.js +19 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createTransformerWithState.js +56 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/createUnsafeCSSStyleNode.js +12 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/cssWrappers.js +21 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/diffAcceptRejectHunk.js +82 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/formatCSSVariablePrefix.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getFiletypeFromFileName.js +343 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getHighlighterOptions.js +13 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getHighlighterThemeStyles.js +40 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getHunkSeparatorSlotName.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getIconForType.js +15 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getLineAnnotationName.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getLineEndingType.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getLineNodes.js +15 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getSingularPatch.js +20 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getThemes.js +16 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/getTotalLineCountFromHunks.js +10 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/hast_utils.js +42 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/isWorkerContext.js +8 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/parseDiffDecorations.js +34 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.js +23 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/parseLineType.js +17 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js +211 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/prerenderHTMLIfNecessary.js +10 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/processLine.js +42 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.js +339 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/renderFileWithHighlighter.js +52 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/setLanguageOverride.js +11 -0
- package/.output/server/node_modules/@pierre/diffs/dist/utils/setWrapperNodeProps.js +29 -0
- package/.output/server/node_modules/@pierre/diffs/package.json +89 -0
- package/.output/server/node_modules/@shikijs/transformers/dist/index.mjs +831 -0
- package/.output/server/node_modules/@shikijs/transformers/package.json +37 -0
- package/.output/server/node_modules/diff/libesm/convert/dmp.js +21 -0
- package/.output/server/node_modules/diff/libesm/convert/xml.js +31 -0
- package/.output/server/node_modules/diff/libesm/diff/array.js +16 -0
- package/.output/server/node_modules/diff/libesm/diff/base.js +253 -0
- package/.output/server/node_modules/diff/libesm/diff/character.js +7 -0
- package/.output/server/node_modules/diff/libesm/diff/css.js +10 -0
- package/.output/server/node_modules/diff/libesm/diff/json.js +78 -0
- package/.output/server/node_modules/diff/libesm/diff/line.js +65 -0
- package/.output/server/node_modules/diff/libesm/diff/sentence.js +43 -0
- package/.output/server/node_modules/diff/libesm/diff/word.js +296 -0
- package/.output/server/node_modules/diff/libesm/index.js +30 -0
- package/.output/server/node_modules/diff/libesm/package.json +1 -0
- package/.output/server/node_modules/diff/libesm/patch/apply.js +257 -0
- package/.output/server/node_modules/diff/libesm/patch/create.js +228 -0
- package/.output/server/node_modules/diff/libesm/patch/line-endings.js +44 -0
- package/.output/server/node_modules/diff/libesm/patch/parse.js +147 -0
- package/.output/server/node_modules/diff/libesm/patch/reverse.js +23 -0
- package/.output/server/node_modules/diff/libesm/util/distance-iterator.js +37 -0
- package/.output/server/node_modules/diff/libesm/util/params.js +14 -0
- package/.output/server/node_modules/diff/libesm/util/string.js +128 -0
- package/.output/server/node_modules/diff/package.json +132 -0
- package/.output/server/package.json +4 -1
- package/README.md +41 -0
- package/bin/prd +1 -1
- package/dist/host/src/index.js +10 -0
- package/dist/host/src/sync.js +201 -0
- package/dist/server/utils/db.js +64 -0
- package/dist/server/utils/git.js +8 -6
- package/dist/server/utils/prd-state.js +24 -2
- package/dist/server/utils/repos.js +12 -2
- package/dist/server/utils/state-migration.js +4 -3
- package/dist/server/utils/sync-apply.js +380 -0
- package/dist/server/utils/sync-export.js +183 -0
- package/dist/server/utils/sync-identity.js +231 -0
- package/dist/server/utils/sync-inspect.js +103 -0
- package/dist/server/utils/sync-merge.js +579 -0
- package/dist/server/utils/sync-schema.js +100 -0
- package/package.json +2 -1
- package/.output/public/_nuxt/6tINjQEd.js +0 -141
- package/.output/public/_nuxt/B2mIQf5X.js +0 -3
- package/.output/public/_nuxt/C0BBSDJ7.js +0 -1
- package/.output/public/_nuxt/CN46Bgts.js +0 -1
- package/.output/public/_nuxt/CTJgb0zb.js +0 -1
- package/.output/public/_nuxt/Cce168lk.js +0 -30
- package/.output/public/_nuxt/CyVSeLw5.js +0 -1
- package/.output/public/_nuxt/Detail.CYc96mGf.css +0 -1
- package/.output/public/_nuxt/ZNypZshD.js +0 -13
- package/.output/public/_nuxt/builds/meta/8c342d49-fe70-4f67-a987-821c16f86125.json +0 -1
- package/.output/public/_nuxt/entry.Bw0CE6Iz.css +0 -1
- package/.output/public/_nuxt/pYJYAY-W.js +0 -60
- package/.output/server/chunks/build/Detail-DMMUwTWr.mjs.map +0 -1
- package/.output/server/chunks/build/DiffViewer-styles-1.mjs-d2dQvARr.mjs +0 -4
- package/.output/server/chunks/build/DiffViewer-styles-1.mjs-d2dQvARr.mjs.map +0 -1
- package/.output/server/chunks/build/DiffViewer-styles-2.mjs-X6QKNjM0.mjs +0 -4
- package/.output/server/chunks/build/DiffViewer-styles-2.mjs-X6QKNjM0.mjs.map +0 -1
- package/.output/server/chunks/build/DiffViewer-styles.0AbHFl6N.mjs +0 -8
- package/.output/server/chunks/build/DiffViewer-styles.0AbHFl6N.mjs.map +0 -1
- package/.output/server/chunks/build/DiffViewer-styles.BDwAqkTk.mjs +0 -8
- package/.output/server/chunks/build/DiffViewer-styles.BDwAqkTk.mjs.map +0 -1
- package/.output/server/chunks/build/DiffViewer-styles.DRJh5Ui4.mjs +0 -10
- package/.output/server/chunks/build/DiffViewer-styles.DRJh5Ui4.mjs.map +0 -1
- package/.output/server/chunks/build/_prd_-ByugK4Yi.mjs.map +0 -1
- package/.output/server/chunks/build/default-BKKgG7HJ.mjs.map +0 -1
- package/.output/server/chunks/build/error-404-Bf6kdO80.mjs.map +0 -1
- package/.output/server/chunks/build/index-DE1tjHAd.mjs.map +0 -1
- package/.output/server/chunks/build/nuxt-link-SvT1nf8Z.mjs.map +0 -1
- package/.output/server/chunks/build/repo-graph-DzT45gSB.mjs.map +0 -1
- package/.output/server/chunks/build/usePrd-hXZOmvAv.mjs.map +0 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
//#region src/utils/getFiletypeFromFileName.ts
|
|
2
|
+
const EXTENSION_TO_FILE_FORMAT = {
|
|
3
|
+
"1c": "1c",
|
|
4
|
+
abap: "abap",
|
|
5
|
+
as: "actionscript-3",
|
|
6
|
+
ada: "ada",
|
|
7
|
+
adb: "ada",
|
|
8
|
+
ads: "ada",
|
|
9
|
+
adoc: "asciidoc",
|
|
10
|
+
asciidoc: "asciidoc",
|
|
11
|
+
"component.html": "angular-html",
|
|
12
|
+
"component.ts": "angular-ts",
|
|
13
|
+
conf: "nginx",
|
|
14
|
+
htaccess: "apache",
|
|
15
|
+
cls: "tex",
|
|
16
|
+
trigger: "apex",
|
|
17
|
+
apl: "apl",
|
|
18
|
+
applescript: "applescript",
|
|
19
|
+
scpt: "applescript",
|
|
20
|
+
ara: "ara",
|
|
21
|
+
asm: "asm",
|
|
22
|
+
s: "riscv",
|
|
23
|
+
astro: "astro",
|
|
24
|
+
awk: "awk",
|
|
25
|
+
bal: "ballerina",
|
|
26
|
+
sh: "zsh",
|
|
27
|
+
bash: "zsh",
|
|
28
|
+
bat: "cmd",
|
|
29
|
+
cmd: "cmd",
|
|
30
|
+
be: "berry",
|
|
31
|
+
beancount: "beancount",
|
|
32
|
+
bib: "bibtex",
|
|
33
|
+
bicep: "bicep",
|
|
34
|
+
"blade.php": "blade",
|
|
35
|
+
bsl: "bsl",
|
|
36
|
+
c: "c",
|
|
37
|
+
h: "objective-cpp",
|
|
38
|
+
cs: "csharp",
|
|
39
|
+
cpp: "cpp",
|
|
40
|
+
hpp: "cpp",
|
|
41
|
+
cc: "cpp",
|
|
42
|
+
cxx: "cpp",
|
|
43
|
+
hh: "cpp",
|
|
44
|
+
cdc: "cdc",
|
|
45
|
+
cairo: "cairo",
|
|
46
|
+
clar: "clarity",
|
|
47
|
+
clj: "clojure",
|
|
48
|
+
cljs: "clojure",
|
|
49
|
+
cljc: "clojure",
|
|
50
|
+
soy: "soy",
|
|
51
|
+
cmake: "cmake",
|
|
52
|
+
"CMakeLists.txt": "cmake",
|
|
53
|
+
cob: "cobol",
|
|
54
|
+
cbl: "cobol",
|
|
55
|
+
cobol: "cobol",
|
|
56
|
+
CODEOWNERS: "codeowners",
|
|
57
|
+
ql: "ql",
|
|
58
|
+
coffee: "coffeescript",
|
|
59
|
+
lisp: "lisp",
|
|
60
|
+
cl: "lisp",
|
|
61
|
+
lsp: "lisp",
|
|
62
|
+
log: "log",
|
|
63
|
+
v: "verilog",
|
|
64
|
+
cql: "cql",
|
|
65
|
+
cr: "crystal",
|
|
66
|
+
css: "css",
|
|
67
|
+
csv: "csv",
|
|
68
|
+
cue: "cue",
|
|
69
|
+
cypher: "cypher",
|
|
70
|
+
cyp: "cypher",
|
|
71
|
+
d: "d",
|
|
72
|
+
dart: "dart",
|
|
73
|
+
dax: "dax",
|
|
74
|
+
desktop: "desktop",
|
|
75
|
+
diff: "diff",
|
|
76
|
+
patch: "diff",
|
|
77
|
+
Dockerfile: "dockerfile",
|
|
78
|
+
dockerfile: "dockerfile",
|
|
79
|
+
env: "dotenv",
|
|
80
|
+
dm: "dream-maker",
|
|
81
|
+
edge: "edge",
|
|
82
|
+
el: "emacs-lisp",
|
|
83
|
+
ex: "elixir",
|
|
84
|
+
exs: "elixir",
|
|
85
|
+
elm: "elm",
|
|
86
|
+
erb: "erb",
|
|
87
|
+
erl: "erlang",
|
|
88
|
+
hrl: "erlang",
|
|
89
|
+
f: "fortran-fixed-form",
|
|
90
|
+
for: "fortran-fixed-form",
|
|
91
|
+
fs: "fsharp",
|
|
92
|
+
fsi: "fsharp",
|
|
93
|
+
fsx: "fsharp",
|
|
94
|
+
f03: "f03",
|
|
95
|
+
f08: "f08",
|
|
96
|
+
f18: "f18",
|
|
97
|
+
f77: "f77",
|
|
98
|
+
f90: "fortran-free-form",
|
|
99
|
+
f95: "fortran-free-form",
|
|
100
|
+
fnl: "fennel",
|
|
101
|
+
fish: "fish",
|
|
102
|
+
ftl: "ftl",
|
|
103
|
+
tres: "gdresource",
|
|
104
|
+
res: "gdresource",
|
|
105
|
+
gd: "gdscript",
|
|
106
|
+
gdshader: "gdshader",
|
|
107
|
+
gs: "genie",
|
|
108
|
+
feature: "gherkin",
|
|
109
|
+
COMMIT_EDITMSG: "git-commit",
|
|
110
|
+
"git-rebase-todo": "git-rebase",
|
|
111
|
+
gjs: "glimmer-js",
|
|
112
|
+
gleam: "gleam",
|
|
113
|
+
gts: "glimmer-ts",
|
|
114
|
+
glsl: "glsl",
|
|
115
|
+
vert: "glsl",
|
|
116
|
+
frag: "glsl",
|
|
117
|
+
shader: "shaderlab",
|
|
118
|
+
gp: "gnuplot",
|
|
119
|
+
plt: "gnuplot",
|
|
120
|
+
gnuplot: "gnuplot",
|
|
121
|
+
go: "go",
|
|
122
|
+
graphql: "graphql",
|
|
123
|
+
gql: "graphql",
|
|
124
|
+
groovy: "groovy",
|
|
125
|
+
gvy: "groovy",
|
|
126
|
+
hack: "hack",
|
|
127
|
+
haml: "haml",
|
|
128
|
+
hbs: "handlebars",
|
|
129
|
+
handlebars: "handlebars",
|
|
130
|
+
hs: "haskell",
|
|
131
|
+
lhs: "haskell",
|
|
132
|
+
hx: "haxe",
|
|
133
|
+
hcl: "hcl",
|
|
134
|
+
hjson: "hjson",
|
|
135
|
+
hlsl: "hlsl",
|
|
136
|
+
fx: "hlsl",
|
|
137
|
+
html: "html",
|
|
138
|
+
htm: "html",
|
|
139
|
+
http: "http",
|
|
140
|
+
rest: "http",
|
|
141
|
+
hxml: "hxml",
|
|
142
|
+
hy: "hy",
|
|
143
|
+
imba: "imba",
|
|
144
|
+
ini: "ini",
|
|
145
|
+
cfg: "ini",
|
|
146
|
+
jade: "pug",
|
|
147
|
+
pug: "pug",
|
|
148
|
+
java: "java",
|
|
149
|
+
js: "javascript",
|
|
150
|
+
mjs: "javascript",
|
|
151
|
+
cjs: "javascript",
|
|
152
|
+
jinja: "jinja",
|
|
153
|
+
jinja2: "jinja",
|
|
154
|
+
j2: "jinja",
|
|
155
|
+
jison: "jison",
|
|
156
|
+
jl: "julia",
|
|
157
|
+
json: "json",
|
|
158
|
+
json5: "json5",
|
|
159
|
+
jsonc: "jsonc",
|
|
160
|
+
jsonl: "jsonl",
|
|
161
|
+
jsonnet: "jsonnet",
|
|
162
|
+
libsonnet: "jsonnet",
|
|
163
|
+
jssm: "jssm",
|
|
164
|
+
jsx: "jsx",
|
|
165
|
+
kt: "kotlin",
|
|
166
|
+
kts: "kts",
|
|
167
|
+
kql: "kusto",
|
|
168
|
+
tex: "tex",
|
|
169
|
+
ltx: "tex",
|
|
170
|
+
lean: "lean4",
|
|
171
|
+
less: "less",
|
|
172
|
+
liquid: "liquid",
|
|
173
|
+
lit: "lit",
|
|
174
|
+
ll: "llvm",
|
|
175
|
+
logo: "logo",
|
|
176
|
+
lua: "lua",
|
|
177
|
+
luau: "luau",
|
|
178
|
+
Makefile: "makefile",
|
|
179
|
+
mk: "makefile",
|
|
180
|
+
makefile: "makefile",
|
|
181
|
+
md: "markdown",
|
|
182
|
+
markdown: "markdown",
|
|
183
|
+
marko: "marko",
|
|
184
|
+
m: "wolfram",
|
|
185
|
+
mat: "matlab",
|
|
186
|
+
mdc: "mdc",
|
|
187
|
+
mdx: "mdx",
|
|
188
|
+
wiki: "wikitext",
|
|
189
|
+
mediawiki: "wikitext",
|
|
190
|
+
mmd: "mermaid",
|
|
191
|
+
mermaid: "mermaid",
|
|
192
|
+
mips: "mipsasm",
|
|
193
|
+
mojo: "mojo",
|
|
194
|
+
"🔥": "mojo",
|
|
195
|
+
move: "move",
|
|
196
|
+
nar: "narrat",
|
|
197
|
+
nf: "nextflow",
|
|
198
|
+
nim: "nim",
|
|
199
|
+
nims: "nim",
|
|
200
|
+
nimble: "nim",
|
|
201
|
+
nix: "nix",
|
|
202
|
+
nu: "nushell",
|
|
203
|
+
mm: "objective-cpp",
|
|
204
|
+
ml: "ocaml",
|
|
205
|
+
mli: "ocaml",
|
|
206
|
+
mll: "ocaml",
|
|
207
|
+
mly: "ocaml",
|
|
208
|
+
pas: "pascal",
|
|
209
|
+
p: "pascal",
|
|
210
|
+
pl: "prolog",
|
|
211
|
+
pm: "perl",
|
|
212
|
+
t: "perl",
|
|
213
|
+
raku: "raku",
|
|
214
|
+
p6: "raku",
|
|
215
|
+
pl6: "raku",
|
|
216
|
+
php: "php",
|
|
217
|
+
phtml: "php",
|
|
218
|
+
pls: "plsql",
|
|
219
|
+
sql: "sql",
|
|
220
|
+
po: "po",
|
|
221
|
+
polar: "polar",
|
|
222
|
+
pcss: "postcss",
|
|
223
|
+
pot: "pot",
|
|
224
|
+
potx: "potx",
|
|
225
|
+
pq: "powerquery",
|
|
226
|
+
pqm: "powerquery",
|
|
227
|
+
ps1: "powershell",
|
|
228
|
+
psm1: "powershell",
|
|
229
|
+
psd1: "powershell",
|
|
230
|
+
prisma: "prisma",
|
|
231
|
+
pro: "prolog",
|
|
232
|
+
P: "prolog",
|
|
233
|
+
properties: "properties",
|
|
234
|
+
proto: "protobuf",
|
|
235
|
+
pp: "puppet",
|
|
236
|
+
purs: "purescript",
|
|
237
|
+
py: "python",
|
|
238
|
+
pyw: "python",
|
|
239
|
+
pyi: "python",
|
|
240
|
+
qml: "qml",
|
|
241
|
+
qmldir: "qmldir",
|
|
242
|
+
qss: "qss",
|
|
243
|
+
r: "r",
|
|
244
|
+
R: "r",
|
|
245
|
+
rkt: "racket",
|
|
246
|
+
rktl: "racket",
|
|
247
|
+
razor: "razor",
|
|
248
|
+
cshtml: "razor",
|
|
249
|
+
rb: "ruby",
|
|
250
|
+
rbw: "ruby",
|
|
251
|
+
reg: "reg",
|
|
252
|
+
regex: "regexp",
|
|
253
|
+
rel: "rel",
|
|
254
|
+
rs: "rust",
|
|
255
|
+
rst: "rst",
|
|
256
|
+
rake: "ruby",
|
|
257
|
+
gemspec: "ruby",
|
|
258
|
+
sas: "sas",
|
|
259
|
+
sass: "sass",
|
|
260
|
+
scala: "scala",
|
|
261
|
+
sc: "scala",
|
|
262
|
+
scm: "scheme",
|
|
263
|
+
ss: "scheme",
|
|
264
|
+
sld: "scheme",
|
|
265
|
+
scss: "scss",
|
|
266
|
+
sdbl: "sdbl",
|
|
267
|
+
shadergraph: "shader",
|
|
268
|
+
st: "smalltalk",
|
|
269
|
+
sol: "solidity",
|
|
270
|
+
sparql: "sparql",
|
|
271
|
+
rq: "sparql",
|
|
272
|
+
spl: "splunk",
|
|
273
|
+
config: "ssh-config",
|
|
274
|
+
do: "stata",
|
|
275
|
+
ado: "stata",
|
|
276
|
+
dta: "stata",
|
|
277
|
+
styl: "stylus",
|
|
278
|
+
stylus: "stylus",
|
|
279
|
+
svelte: "svelte",
|
|
280
|
+
swift: "swift",
|
|
281
|
+
sv: "system-verilog",
|
|
282
|
+
svh: "system-verilog",
|
|
283
|
+
service: "systemd",
|
|
284
|
+
socket: "systemd",
|
|
285
|
+
device: "systemd",
|
|
286
|
+
timer: "systemd",
|
|
287
|
+
talon: "talonscript",
|
|
288
|
+
tasl: "tasl",
|
|
289
|
+
tcl: "tcl",
|
|
290
|
+
templ: "templ",
|
|
291
|
+
tf: "tf",
|
|
292
|
+
tfvars: "tfvars",
|
|
293
|
+
toml: "toml",
|
|
294
|
+
ts: "typescript",
|
|
295
|
+
tsp: "typespec",
|
|
296
|
+
tsv: "tsv",
|
|
297
|
+
tsx: "tsx",
|
|
298
|
+
ttl: "turtle",
|
|
299
|
+
twig: "twig",
|
|
300
|
+
typ: "typst",
|
|
301
|
+
vv: "v",
|
|
302
|
+
vala: "vala",
|
|
303
|
+
vapi: "vala",
|
|
304
|
+
vb: "vb",
|
|
305
|
+
vbs: "vb",
|
|
306
|
+
bas: "vb",
|
|
307
|
+
vh: "verilog",
|
|
308
|
+
vhd: "vhdl",
|
|
309
|
+
vhdl: "vhdl",
|
|
310
|
+
vim: "vimscript",
|
|
311
|
+
vue: "vue",
|
|
312
|
+
"vine.ts": "vue-vine",
|
|
313
|
+
vy: "vyper",
|
|
314
|
+
wasm: "wasm",
|
|
315
|
+
wat: "wasm",
|
|
316
|
+
wy: "文言",
|
|
317
|
+
wgsl: "wgsl",
|
|
318
|
+
wit: "wit",
|
|
319
|
+
wl: "wolfram",
|
|
320
|
+
nb: "wolfram",
|
|
321
|
+
xml: "xml",
|
|
322
|
+
xsl: "xsl",
|
|
323
|
+
xslt: "xsl",
|
|
324
|
+
yaml: "yaml",
|
|
325
|
+
yml: "yml",
|
|
326
|
+
zs: "zenscript",
|
|
327
|
+
zig: "zig",
|
|
328
|
+
zsh: "zsh",
|
|
329
|
+
sty: "tex"
|
|
330
|
+
};
|
|
331
|
+
function getFiletypeFromFileName(fileName) {
|
|
332
|
+
if (EXTENSION_TO_FILE_FORMAT[fileName] != null) return EXTENSION_TO_FILE_FORMAT[fileName];
|
|
333
|
+
const compoundMatch = fileName.match(/\.([^/\\]+\.[^/\\]+)$/);
|
|
334
|
+
if (compoundMatch != null && EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] != null) return EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] ?? "text";
|
|
335
|
+
return EXTENSION_TO_FILE_FORMAT[fileName.match(/\.([^.]+)$/)?.[1] ?? ""] ?? "text";
|
|
336
|
+
}
|
|
337
|
+
function extendFileFormatMap(map) {
|
|
338
|
+
for (const key in map) EXTENSION_TO_FILE_FORMAT[key] = map[key];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
//#endregion
|
|
342
|
+
export { EXTENSION_TO_FILE_FORMAT, extendFileFormatMap, getFiletypeFromFileName };
|
|
343
|
+
//# sourceMappingURL=getFiletypeFromFileName.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getThemes } from "./getThemes.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/getHighlighterOptions.ts
|
|
4
|
+
function getHighlighterOptions(lang, options) {
|
|
5
|
+
return {
|
|
6
|
+
langs: [lang ?? "text"],
|
|
7
|
+
themes: getThemes(options.theme)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getHighlighterOptions };
|
|
13
|
+
//# sourceMappingURL=getHighlighterOptions.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DEFAULT_THEMES } from "../constants.js";
|
|
2
|
+
import { formatCSSVariablePrefix } from "./formatCSSVariablePrefix.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/getHighlighterThemeStyles.ts
|
|
5
|
+
function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter, prefix }) {
|
|
6
|
+
let styles = "";
|
|
7
|
+
if (typeof theme === "string") {
|
|
8
|
+
const themeData = highlighter.getTheme(theme);
|
|
9
|
+
styles += `color:${themeData.fg};`;
|
|
10
|
+
styles += `background-color:${themeData.bg};`;
|
|
11
|
+
styles += `${formatCSSVariablePrefix("global")}fg:${themeData.fg};`;
|
|
12
|
+
styles += `${formatCSSVariablePrefix("global")}bg:${themeData.bg};`;
|
|
13
|
+
styles += getThemeVariables(themeData, prefix);
|
|
14
|
+
} else {
|
|
15
|
+
let themeData = highlighter.getTheme(theme.dark);
|
|
16
|
+
styles += `${formatCSSVariablePrefix("global")}dark:${themeData.fg};`;
|
|
17
|
+
styles += `${formatCSSVariablePrefix("global")}dark-bg:${themeData.bg};`;
|
|
18
|
+
styles += getThemeVariables(themeData, "dark");
|
|
19
|
+
themeData = highlighter.getTheme(theme.light);
|
|
20
|
+
styles += `${formatCSSVariablePrefix("global")}light:${themeData.fg};`;
|
|
21
|
+
styles += `${formatCSSVariablePrefix("global")}light-bg:${themeData.bg};`;
|
|
22
|
+
styles += getThemeVariables(themeData, "light");
|
|
23
|
+
}
|
|
24
|
+
return styles;
|
|
25
|
+
}
|
|
26
|
+
function getThemeVariables(themeData, modePrefix) {
|
|
27
|
+
modePrefix = modePrefix != null ? `${modePrefix}-` : "";
|
|
28
|
+
let styles = "";
|
|
29
|
+
const additionGreen = themeData.colors?.["gitDecoration.addedResourceForeground"] ?? themeData.colors?.["terminal.ansiGreen"];
|
|
30
|
+
if (additionGreen != null) styles += `${formatCSSVariablePrefix("global")}${modePrefix}addition-color:${additionGreen};`;
|
|
31
|
+
const deletionRed = themeData.colors?.["gitDecoration.deletedResourceForeground"] ?? themeData.colors?.["terminal.ansiRed"];
|
|
32
|
+
if (deletionRed != null) styles += `${formatCSSVariablePrefix("global")}${modePrefix}deletion-color:${deletionRed};`;
|
|
33
|
+
const modifiedBlue = themeData.colors?.["gitDecoration.modifiedResourceForeground"] ?? themeData.colors?.["terminal.ansiBlue"];
|
|
34
|
+
if (modifiedBlue != null) styles += `${formatCSSVariablePrefix("global")}${modePrefix}modified-color:${modifiedBlue};`;
|
|
35
|
+
return styles;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { getHighlighterThemeStyles };
|
|
40
|
+
//# sourceMappingURL=getHighlighterThemeStyles.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/getIconForType.ts
|
|
2
|
+
function getIconForType(type) {
|
|
3
|
+
switch (type) {
|
|
4
|
+
case "file": return "diffs-icon-file-code";
|
|
5
|
+
case "change": return "diffs-icon-symbol-modified";
|
|
6
|
+
case "new": return "diffs-icon-symbol-added";
|
|
7
|
+
case "deleted": return "diffs-icon-symbol-deleted";
|
|
8
|
+
case "rename-pure":
|
|
9
|
+
case "rename-changed": return "diffs-icon-symbol-moved";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getIconForType };
|
|
15
|
+
//# sourceMappingURL=getIconForType.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/getLineAnnotationName.ts
|
|
2
|
+
function getLineAnnotationName(annotation) {
|
|
3
|
+
return `annotation-${"side" in annotation ? `${annotation.side}-` : ""}${annotation.lineNumber}`;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getLineAnnotationName };
|
|
8
|
+
//# sourceMappingURL=getLineAnnotationName.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/getLineEndingType.ts
|
|
2
|
+
function getLineEndingType(content) {
|
|
3
|
+
if (content.includes("\r\n")) return "CRLF";
|
|
4
|
+
if (content.includes("\r")) return "CR";
|
|
5
|
+
if (content.includes("\n")) return "LF";
|
|
6
|
+
return "none";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getLineEndingType };
|
|
11
|
+
//# sourceMappingURL=getLineEndingType.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/getLineNodes.ts
|
|
2
|
+
function getLineNodes(nodes) {
|
|
3
|
+
let firstChild = nodes.children[0];
|
|
4
|
+
while (firstChild != null) {
|
|
5
|
+
if (firstChild.type === "element" && firstChild.tagName === "code") return firstChild.children;
|
|
6
|
+
if ("children" in firstChild) firstChild = firstChild.children[0];
|
|
7
|
+
else firstChild = null;
|
|
8
|
+
}
|
|
9
|
+
console.error(nodes);
|
|
10
|
+
throw new Error("getLineNodes: Unable to find children");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getLineNodes };
|
|
15
|
+
//# sourceMappingURL=getLineNodes.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parsePatchFiles } from "./parsePatchFiles.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/getSingularPatch.ts
|
|
4
|
+
function getSingularPatch(patch) {
|
|
5
|
+
const parsedPatches = parsePatchFiles(patch);
|
|
6
|
+
if (parsedPatches.length !== 1) {
|
|
7
|
+
console.error(parsedPatches);
|
|
8
|
+
throw new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");
|
|
9
|
+
}
|
|
10
|
+
const { files } = parsedPatches[0];
|
|
11
|
+
if (files.length !== 1) {
|
|
12
|
+
console.error(files);
|
|
13
|
+
throw new Error("FileDiff: Provided patch must contain exactly 1 file diff");
|
|
14
|
+
}
|
|
15
|
+
return files[0];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getSingularPatch };
|
|
20
|
+
//# sourceMappingURL=getSingularPatch.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DEFAULT_THEMES } from "../constants.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/getThemes.ts
|
|
4
|
+
function getThemes(theme = DEFAULT_THEMES) {
|
|
5
|
+
const themesArr = [];
|
|
6
|
+
if (typeof theme === "string") themesArr.push(theme);
|
|
7
|
+
else {
|
|
8
|
+
themesArr.push(theme.dark);
|
|
9
|
+
themesArr.push(theme.light);
|
|
10
|
+
}
|
|
11
|
+
return themesArr;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getThemes };
|
|
16
|
+
//# sourceMappingURL=getThemes.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/utils/getTotalLineCountFromHunks.ts
|
|
2
|
+
function getTotalLineCountFromHunks(hunks) {
|
|
3
|
+
const lastHunk = hunks[hunks.length - 1];
|
|
4
|
+
if (lastHunk == null) return 0;
|
|
5
|
+
return Math.max(lastHunk.additionStart + lastHunk.additionCount, lastHunk.deletionStart + lastHunk.deletionCount);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getTotalLineCountFromHunks };
|
|
10
|
+
//# sourceMappingURL=getTotalLineCountFromHunks.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/utils/hast_utils.ts
|
|
2
|
+
function createTextNodeElement(value) {
|
|
3
|
+
return {
|
|
4
|
+
type: "text",
|
|
5
|
+
value
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function createHastElement({ tagName, children = [], properties = {} }) {
|
|
9
|
+
return {
|
|
10
|
+
type: "element",
|
|
11
|
+
tagName,
|
|
12
|
+
properties,
|
|
13
|
+
children
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createIconElement({ name, width = 16, height = 16, properties }) {
|
|
17
|
+
return createHastElement({
|
|
18
|
+
tagName: "svg",
|
|
19
|
+
properties: {
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
viewBox: "0 0 16 16",
|
|
23
|
+
...properties
|
|
24
|
+
},
|
|
25
|
+
children: [createHastElement({
|
|
26
|
+
tagName: "use",
|
|
27
|
+
properties: { href: `#${name.replace(/^#/, "")}` }
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function findCodeElement(nodes) {
|
|
32
|
+
let firstChild = nodes.children[0];
|
|
33
|
+
while (firstChild != null) {
|
|
34
|
+
if (firstChild.type === "element" && firstChild.tagName === "code") return firstChild;
|
|
35
|
+
if ("children" in firstChild) firstChild = firstChild.children[0];
|
|
36
|
+
else firstChild = null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createHastElement, createIconElement, createTextNodeElement, findCodeElement };
|
|
42
|
+
//# sourceMappingURL=hast_utils.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/isWorkerContext.ts
|
|
2
|
+
function isWorkerContext() {
|
|
3
|
+
return typeof WorkerGlobalScope !== "undefined" && typeof self !== "undefined" && self instanceof WorkerGlobalScope;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { isWorkerContext };
|
|
8
|
+
//# sourceMappingURL=isWorkerContext.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "diff";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/parseDiffDecorations.ts
|
|
4
|
+
function createDiffSpanDecoration({ line, spanStart, spanLength }) {
|
|
5
|
+
return {
|
|
6
|
+
start: {
|
|
7
|
+
line,
|
|
8
|
+
character: spanStart
|
|
9
|
+
},
|
|
10
|
+
end: {
|
|
11
|
+
line,
|
|
12
|
+
character: spanStart + spanLength
|
|
13
|
+
},
|
|
14
|
+
properties: { "data-diff-span": "" },
|
|
15
|
+
alwaysWrap: true
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function pushOrJoinSpan({ item, arr, enableJoin, isNeutral = false, isLastItem = false }) {
|
|
19
|
+
const lastItem = arr[arr.length - 1];
|
|
20
|
+
if (lastItem == null || isLastItem || !enableJoin) {
|
|
21
|
+
arr.push([isNeutral ? 0 : 1, item.value]);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const isLastItemNeutral = lastItem[0] === 0;
|
|
25
|
+
if (isNeutral === isLastItemNeutral || isNeutral && item.value.length === 1 && !isLastItemNeutral) {
|
|
26
|
+
lastItem[1] += item.value;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
arr.push([isNeutral ? 0 : 1, item.value]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { createDiffSpanDecoration, pushOrJoinSpan };
|
|
34
|
+
//# sourceMappingURL=parseDiffDecorations.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SPLIT_WITH_NEWLINES } from "../constants.js";
|
|
2
|
+
import { parsePatchFiles } from "./parsePatchFiles.js";
|
|
3
|
+
import { createTwoFilesPatch } from "diff";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/parseDiffFromFile.ts
|
|
6
|
+
/**
|
|
7
|
+
* Parses a diff from two file contents objects.
|
|
8
|
+
*
|
|
9
|
+
* If both `oldFile` and `newFile` have a `cacheKey`, the resulting diff will
|
|
10
|
+
* automatically get a combined cache key in the format `oldKey:newKey`.
|
|
11
|
+
*/
|
|
12
|
+
function parseDiffFromFile(oldFile, newFile, options) {
|
|
13
|
+
const fileData = parsePatchFiles(createTwoFilesPatch(oldFile.name, newFile.name, oldFile.contents, newFile.contents, oldFile.header, newFile.header, options))[0]?.files[0];
|
|
14
|
+
if (fileData == null) throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");
|
|
15
|
+
fileData.oldLines = oldFile.contents.split(SPLIT_WITH_NEWLINES);
|
|
16
|
+
fileData.newLines = newFile.contents.split(SPLIT_WITH_NEWLINES);
|
|
17
|
+
if (oldFile.cacheKey != null && newFile.cacheKey != null) fileData.cacheKey = `${oldFile.cacheKey}:${newFile.cacheKey}`;
|
|
18
|
+
return fileData;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { parseDiffFromFile };
|
|
23
|
+
//# sourceMappingURL=parseDiffFromFile.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/parseLineType.ts
|
|
2
|
+
function parseLineType(line) {
|
|
3
|
+
const firstChar = line[0];
|
|
4
|
+
if (firstChar !== "+" && firstChar !== "-" && firstChar !== " " && firstChar !== "\\") {
|
|
5
|
+
console.error(`parseLineType: Invalid firstChar: "${firstChar}", full line: "${line}"`);
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const processedLine = line.substring(1);
|
|
9
|
+
return {
|
|
10
|
+
line: processedLine === "" ? "\n" : processedLine,
|
|
11
|
+
type: firstChar === " " ? "context" : firstChar === "\\" ? "metadata" : firstChar === "+" ? "addition" : "deletion"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { parseLineType };
|
|
17
|
+
//# sourceMappingURL=parseLineType.js.map
|