Repository navigation
Expand file tree
/
Copy pathpackage.json
More file actions
697 lines (697 loc) · 23 KB
/
Copy pathpackage.json
File metadata and controls
697 lines (697 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
{
"private": true,
"name": "observable-js",
"version": "0.4.66",
"publisher": "GordonSmith",
"displayName": "Observable JS",
"description": "An unofficial VS Code extension that wraps Observable's official notebook-kit to bring Observable Notebook 2.0 to VS Code: author .onb.html notebooks, switch between HTML/notebook views, edit legacy .ojsnb/.ojs/.omd files, preview, import/export, and build static sites.",
"icon": "images/ObservableJS.png",
"readme": "README.md",
"categories": [
"Programming Languages",
"Data Science",
"Notebooks",
"Formatters",
"Visualization"
],
"tags": [
"Observable",
"notebook-kit",
"@observablehq/parser",
"@observablehq/runtime",
"@observablehq/inspector",
"@observablehq/stdlib",
"@observablehq/notebook-kit",
"@hpcc-js/observable-compiler"
],
"main": "./dist/extension.js",
"scripts": {
"clean": "rimraf --glob out lib* dist* types *.vsix",
"install-deps": "npx playwright install --with-deps",
"gen-node-types": "tsc --project tsconfig.json --emitDeclarationOnly",
"gen-node-watch": "npm run gen-node-types -- -w",
"gen-webview-types": "tsc --project tsconfig.webview.json --emitDeclarationOnly",
"gen-webview-watch": "npm run gen-webview-types -- -w",
"gen-types": "run-p gen-node-types gen-webview-types",
"build-ts": "node esbuild.mjs --production",
"build-ts-dev": "node esbuild.mjs --development",
"build-ts-watch": "node esbuild.mjs --watch --development",
"build": "run-p gen-types build-ts",
"watch": "run-p gen-types-watch build-ts-watch",
"lint": "eslint ./src",
"lint-fix": "npm run lint -- --fix",
"unit-test": "vitest run",
"integration-test": "tsc -p tests/integration/tsconfig.json && node out/tests/integration/runTest.js",
"test": "run-s lint build unit-test integration-test package",
"vscode:prepublish": "run-s clean build",
"publish": "vsce publish",
"package": "vsce package -o ./observable-js.vsix",
"rm-hpcc": "rimraf ./node_modules/@hpcc-js",
"update-major": "npx -y npm-check-updates -u",
"update": "npx -y npm-check-updates -u -t minor"
},
"devDependencies": {
"@eslint/js": "10.0.1",
"@hpcc-js/esbuild-plugins": "1.13.2",
"@hpcc-js/observable-shim": "3.1.0",
"@hpcc-js/observablehq-compiler": "3.12.4",
"@hpcc-js/util": "3.8.2",
"@observablehq/inspector": "5.0.1",
"@observablehq/notebook-kit": "2.11.0",
"@observablehq/runtime": "6.1.0",
"@observablehq/stdlib": "5.8.8",
"@types/mocha": "10.0.10",
"@types/node": "26.6.6",
"@types/vscode": "1.102.0",
"@types/vscode-notebook-renderer": "1.72.4",
"@typescript/native": "npm:typescript@7.0.2",
"@vscode/extension-telemetry": "1.5.2",
"@vscode/test-electron": "3.1.0",
"@vscode/vsce": "4.1.1",
"acorn": "8.19.0",
"acorn-walk": "8.3.5",
"assert": "2.1.0",
"browserify-zlib": "0.2.0",
"buffer": "6.0.3",
"esbuild": "0.28.2",
"esbuild-copy-static-files": "0.1.0",
"esbuild-plugin-text-replace": "1.3.0",
"esbuild-plugin-umd-wrapper": "3.0.0",
"eslint": "10.15.0",
"eslint-plugin-react-hooks": "7.1.1",
"eslint-plugin-unused-imports": "4.4.1",
"globals": "17.14.0",
"node-fetch": "3.3.2",
"npm-run-all": "4.1.5",
"mocha": "12.0.3",
"os-browserify": "0.3.0",
"path-browserify": "1.0.1",
"prettier": "3.10.1",
"rimraf": "6.1.4",
"stream-browserify": "3.0.0",
"tslib": "2.9.1",
"typescript": "npm:@typescript/typescript6@6.0.2",
"typescript-eslint": "8.72.2",
"uuid": "14.0.3",
"vitest": "5.1.0",
"glob": "14.0.6",
"minimatch": "11.0.8"
},
"overrides": {
"glob": "14.0.6",
"minimatch": "11.0.8"
},
"author": {
"name": "Gordon Smith"
},
"repository": {
"type": "git",
"url": "https://github.com/GordonSmith/vscode-ojs.git"
},
"engines": {
"vscode": "^1.102.0"
},
"extensionDependencies": [],
"activationEvents": [
"onNotebook:ojs-notebook",
"onNotebook:notebook-kit-default",
"onNotebook:notebook-kit-option",
"onLanguage:html",
"workspaceContains:**/*.html",
"onWebviewPanel:OJSPreview"
],
"contributes": {
"languages": [
{
"id": "ojs",
"extensions": [
"ojs",
"OJS"
],
"aliases": [
"Observable JavaScript (OJS)"
],
"configuration": "./ojs.configuration.json"
},
{
"id": "omd",
"extensions": [
"omd",
"OMD"
],
"aliases": [
"Observable Markdown (OMD)"
],
"configuration": "./omd.configuration.json"
},
{
"id": "dot",
"extensions": [
"dot",
"gv"
],
"aliases": [
"Graphviz (DOT)",
"dot"
]
}
],
"grammars": [
{
"language": "ojs",
"scopeName": "source.ojs",
"path": "./syntaxes/ojs.tmLanguage.json"
},
{
"language": "omd",
"scopeName": "text.html.markdown",
"path": "./syntaxes/omd.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.block.html": "html",
"source.js": "javascript",
"source.css": "css",
"meta.embedded.block.frontmatter": "yaml",
"meta.embedded.block.css": "css",
"meta.embedded.block.ini": "ini",
"meta.embedded.block.java": "java",
"meta.embedded.block.lua": "lua",
"meta.embedded.block.makefile": "makefile",
"meta.embedded.block.perl": "perl",
"meta.embedded.block.r": "r",
"meta.embedded.block.ruby": "ruby",
"meta.embedded.block.php": "php",
"meta.embedded.block.sql": "sql",
"meta.embedded.block.vs_net": "vs_net",
"meta.embedded.block.xml": "xml",
"meta.embedded.block.xsl": "xsl",
"meta.embedded.block.yaml": "yaml",
"meta.embedded.block.dosbatch": "dosbatch",
"meta.embedded.block.clojure": "clojure",
"meta.embedded.block.coffee": "coffee",
"meta.embedded.block.c": "c",
"meta.embedded.block.cpp": "cpp",
"meta.embedded.block.diff": "diff",
"meta.embedded.block.dockerfile": "dockerfile",
"meta.embedded.block.go": "go",
"meta.embedded.block.groovy": "groovy",
"meta.embedded.block.pug": "jade",
"meta.embedded.block.javascript": "javascript",
"meta.embedded.block.json": "json",
"meta.embedded.block.less": "less",
"meta.embedded.block.objc": "objc",
"meta.embedded.block.scss": "scss",
"meta.embedded.block.perl6": "perl6",
"meta.embedded.block.powershell": "powershell",
"meta.embedded.block.python": "python",
"meta.embedded.block.rust": "rust",
"meta.embedded.block.scala": "scala",
"meta.embedded.block.shellscript": "shellscript",
"meta.embedded.block.typescript": "typescript",
"meta.embedded.block.typescriptreact": "typescriptreact",
"meta.embedded.block.csharp": "csharp",
"meta.embedded.block.fsharp": "fsharp"
}
}
],
"commands": [
{
"category": "OJS",
"command": "ojs.checkSyntax",
"title": "Check Syntax.",
"description": "Syntax check OJS code."
},
{
"category": "OJS",
"command": "ojs.preview",
"title": "Preview Web Page",
"description": "Preview Observable Page.",
"icon": {
"dark": "./images/preview-dark.svg",
"light": "./images/preview.svg"
}
},
{
"category": "OJS",
"command": "ojs.import",
"title": "Import notebook cells",
"description": "Imports notebook cells from Observable."
},
{
"category": "OJS",
"command": "ojs.export",
"title": "Export to HTML",
"description": "Export as a self contained HTML file.",
"icon": {
"dark": "./images/export-dark.svg",
"light": "./images/export.svg"
}
},
{
"category": "OJS",
"command": "ojs.exportECL",
"title": "Export to ECL",
"description": "Export as a self contained ECL file.",
"icon": {
"dark": "./images/export-dark.svg",
"light": "./images/export.svg"
}
},
{
"category": "OJS",
"command": "ojs.download",
"title": "Download Notebook",
"description": "Download notebook from observalehq.com"
},
{
"category": "Observable Kit",
"command": "observable-kit.build",
"title": "Build Static Site",
"description": "Build static site using Notebook Kit"
},
{
"category": "Observable Kit",
"command": "observable-kit.createNotebook",
"title": "Observable Kit Notebook",
"description": "Create a new Observable Notebook notebook"
},
{
"category": "Observable Kit",
"command": "observable-kit.convertFromLegacy",
"title": "Convert from Legacy Format",
"description": "Convert .ojsnb file to Observable Notebook format"
},
{
"category": "Observable Kit",
"command": "observable-kit.setupWorkspace",
"title": "Setup Workspace",
"description": "Setup Observable Notebook in current workspace"
},
{
"category": "Observable Kit",
"command": "observable-kit.export",
"title": "Export",
"description": "Export the current Observable Notebook",
"icon": {
"dark": "./images/export-dark.svg",
"light": "./images/export.svg"
}
},
{
"category": "Observable Kit",
"command": "observable-kit.notebook.setTitle",
"title": "Title",
"description": "Edit the notebook title metadata",
"icon": "$(edit)"
},
{
"category": "Observable Kit",
"command": "observable-kit.notebook.setTheme",
"title": "Theme",
"description": "Choose the visual theme for this notebook",
"icon": "$(symbol-color)"
},
{
"category": "Observable Kit",
"command": "observable-kit.notebook.setReadOnly",
"title": "read/write",
"description": "Switch notebook to read-only mode",
"icon": "$(unlock)"
},
{
"category": "Observable Kit",
"command": "observable-kit.notebook.setReadWrite",
"title": "read only",
"description": "Switch notebook to read/write mode",
"icon": "$(lock)"
},
{
"category": "Observable Kit",
"command": "observable-kit.openHtmlAsNotebook",
"title": "Open HTML as Observable Notebook",
"description": "Open HTML file as Observable Notebook (without renaming)"
},
{
"category": "Observable Kit",
"command": "observable-kit.switchToNotebookView",
"title": "Switch to Notebook View",
"description": "Switch HTML file to notebook view",
"icon": "$(book)"
},
{
"category": "Observable Kit",
"command": "observable-kit.switchToTextView",
"title": "Switch to Text View",
"description": "Switch notebook back to HTML text view",
"icon": "$(edit)"
},
{
"command": "ojs.cell.name",
"title": "Result Name",
"icon": {
"dark": "./resources/dark/string.svg",
"light": "./resources/light/string.svg"
}
},
{
"command": "ojs.cell.db",
"title": "Database Name",
"icon": {
"dark": "./resources/dark/server-process.svg",
"light": "./resources/light/server-process.svg"
}
},
{
"command": "observable-kit.cell.setDatabase",
"title": "Set SQL Database",
"description": "Set the database variable used by this SQL cell",
"icon": "$(database)"
},
{
"command": "observable-kit.cell.setOutput",
"title": "Set Output Name",
"description": "Set the output variable name for this SQL cell",
"icon": "$(symbol-variable)"
},
{
"command": "observable-kit.cell.pin",
"title": "Pin Source Code",
"description": "Pin this cell to make its source code visible in the output",
"icon": "$(pin)"
},
{
"command": "observable-kit.cell.unpin",
"title": "Unpin Source Code",
"description": "Unpin this cell to hide its source code from the output",
"icon": "$(pinned)"
},
{
"command": "observable-kit.cell.hide",
"title": "Hide Cell",
"description": "Hide this cell's output in the notebook",
"icon": "$(eye)"
},
{
"command": "observable-kit.cell.show",
"title": "Show Cell",
"description": "Show this cell's output in the notebook",
"icon": "$(eye-closed)"
},
{
"command": "observable-kit.cell.setNodeMode",
"title": "Run in Node.js",
"description": "Set this JavaScript cell to run in Node.js mode",
"icon": "$(globe)"
},
{
"command": "observable-kit.cell.setJsMode",
"title": "Run in Browser JS",
"description": "Set this cell to run in browser JavaScript mode",
"icon": "$(terminal)"
}
],
"menus": {
"file/newFile": [
{
"command": "observable-kit.createNotebook"
}
],
"commandPalette": [
{
"command": "ojs.checkSyntax",
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook"
},
{
"command": "ojs.preview",
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook"
},
{
"command": "ojs.export",
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook"
},
{
"command": "ojs.exportECL",
"when": "resourceLangId == ojs || resourceLangId == omd"
},
{
"command": "observable-kit.openHtmlAsNotebook",
"when": "resourceLangId == html"
},
{
"command": "observable-kit.export",
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option"
},
{
"command": "observable-kit.switchToNotebookView",
"when": "resourceLangId == html || resourceLangId == javascript"
},
{
"command": "observable-kit.switchToTextView",
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option"
}
],
"explorer/context": [
{
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook",
"command": "ojs.preview",
"group": "navigation@998"
},
{
"when": "resourceLangId == html",
"command": "observable-kit.openHtmlAsNotebook",
"group": "observable@101"
}
],
"editor/context": [
{
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook",
"command": "ojs.preview",
"group": "navigation@960"
},
{
"when": "resourceLangId == ojs || resourceLangId == omd",
"command": "ojs.import",
"group": "navigation@970"
},
{
"when": "resourceLangId == ojs || resourceLangId == omd",
"command": "ojs.export",
"group": "navigation@980"
},
{
"when": "resourceLangId == ojs || resourceLangId == omd",
"command": "ojs.exportECL",
"group": "navigation@990"
},
{
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option",
"command": "observable-kit.export",
"group": "navigation@980"
}
],
"editor/title": [
{
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook",
"command": "ojs.export",
"group": "navigation@997"
},
{
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook",
"command": "ojs.preview",
"group": "navigation@998"
},
{
"when": "(resourceLangId == html || resourceLangId == javascript) && observable-kit.isObservableNotebook",
"command": "observable-kit.switchToNotebookView",
"group": "navigation@999"
},
{
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option",
"command": "observable-kit.switchToTextView",
"group": "navigation@999"
},
{
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option",
"command": "observable-kit.export",
"group": "navigation@997"
}
],
"notebook/cell/title": [
{
"command": "ojs.cell.name",
"when": "notebookType == ojs-notebook && cellLangId == sql",
"group": "inline@400"
},
{
"command": "ojs.cell.db",
"when": "notebookType == ojs-notebook && cellLangId == sql",
"group": "inline@401"
},
{
"command": "observable-kit.cell.pin",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && !observable-kit.currentCellPinned",
"group": "inline@100"
},
{
"command": "observable-kit.cell.unpin",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && observable-kit.currentCellPinned",
"group": "inline@100"
},
{
"command": "observable-kit.cell.hide",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && !observable-kit.currentCellHidden",
"group": "inline@101"
},
{
"command": "observable-kit.cell.show",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && observable-kit.currentCellHidden",
"group": "inline@101"
},
{
"command": "observable-kit.cell.setNodeMode",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && cellLangId == javascript && observable-kit.cellMode != node",
"group": "inline@102"
},
{
"command": "observable-kit.cell.setJsMode",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && cellLangId == javascript && observable-kit.cellMode == node",
"group": "inline@102"
},
{
"command": "observable-kit.cell.setDatabase",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && cellLangId == sql",
"group": "inline@103"
},
{
"command": "observable-kit.cell.setOutput",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && cellLangId == sql",
"group": "inline@104"
}
],
"notebook/toolbar": [
{
"command": "observable-kit.notebook.setTitle",
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option",
"group": "navigation@100"
},
{
"command": "observable-kit.notebook.setTheme",
"when": "notebookType == notebook-kit-default || notebookType == notebook-kit-option",
"group": "navigation@101"
},
{
"command": "observable-kit.notebook.setReadOnly",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && !observable-kit.notebook.readOnly",
"group": "navigation@102"
},
{
"command": "observable-kit.notebook.setReadWrite",
"when": "(notebookType == notebook-kit-default || notebookType == notebook-kit-option) && observable-kit.notebook.readOnly",
"group": "navigation@102"
}
]
},
"keybindings": [
{
"command": "ojs.checkSyntax",
"key": "f7",
"when": "resourceLangId == ojs || resourceLangId == omd"
},
{
"command": "ojs.preview",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "resourceLangId == ojs || resourceLangId == omd || notebookType == ojs-notebook"
}
],
"configuration": {
"type": "object",
"title": "OJS (Observable JS)",
"properties": {
"ojs.refreshPreviewOnSave": {
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Refresh preview on save."
},
"ojs.showRuntimeValues": {
"type": "boolean",
"scope": "resource",
"default": false,
"description": "Show runtime values as diagnostic info."
},
"ojs.autoDetectObservableNotebooks": {
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Automatically detect Observable notebooks in HTML files and prompt to open as notebook."
},
"observableKit.format.enable": {
"type": "boolean",
"scope": "resource",
"default": true,
"description": "Enable formatting for supported Observable Notebook Kit cells."
}
}
},
"notebooks": [
{
"id": "ojs-notebook",
"type": "ojs-notebook",
"displayName": "OJS Notebook",
"selector": [
{
"filenamePattern": "*.ojsnb"
}
]
},
{
"id": "notebook-kit-default",
"type": "notebook-kit-default",
"displayName": "Observable Notebook",
"selector": [
{
"filenamePattern": "*.observable.html"
},
{
"filenamePattern": "*.observable.js"
}
],
"priority": "default"
},
{
"id": "notebook-kit-option",
"type": "notebook-kit-option",
"displayName": "Observable Notebook",
"selector": [
{
"filenamePattern": "*.html"
},
{
"filenamePattern": "*.js"
}
],
"priority": "option"
}
],
"notebookRenderer": [
{
"id": "ojs-notebook-renderer",
"displayName": "ObservableJS Renderer",
"entrypoint": "./dist/ojsRenderer.js",
"mimeTypes": [
"application/gordonsmith.ojs+json"
],
"requiresMessaging": "always"
},
{
"id": "observable-kit-renderer",
"displayName": "Observable Notebook Renderer",
"entrypoint": "./dist/observable-kit-renderer.js",
"mimeTypes": [
"application/observable-kit+json"
],
"requiresMessaging": "optional"
}
]
}
}