chrome-devtools-frontend 1.0.1636056 → 1.0.1640418
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/front_end/core/common/Color.ts +0 -4
- package/front_end/core/host/AidaClientTypes.ts +8 -6
- package/front_end/core/root/Runtime.ts +2 -2
- package/front_end/core/sdk/DOMStorageModel.ts +1 -1
- package/front_end/core/sdk/SourceMap.ts +8 -3
- package/front_end/core/sdk/TargetManager.ts +14 -1
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +147 -0
- package/front_end/generated/ARIAProperties.js +17 -4
- package/front_end/generated/InspectorBackendCommands.ts +13 -7
- package/front_end/generated/SupportedCSSProperties.js +1 -0
- package/front_end/generated/protocol-mapping.d.ts +7 -0
- package/front_end/generated/protocol-proxy-api.d.ts +14 -0
- package/front_end/generated/protocol.ts +120 -2
- package/front_end/global_typings/global_defs.d.ts +13 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +116 -0
- package/front_end/models/ai_assistance/AiConversation.ts +22 -36
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +0 -1
- package/front_end/models/ai_assistance/AiOrigins.ts +46 -0
- package/front_end/models/ai_assistance/AiUtils.ts +9 -0
- package/front_end/models/ai_assistance/README.md +16 -0
- package/front_end/models/ai_assistance/StorageItem.ts +30 -26
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +12 -5
- package/front_end/models/ai_assistance/agents/AiAgent.ts +86 -32
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +31 -10
- package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/FileAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +1 -3
- package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +19 -0
- package/front_end/models/ai_assistance/agents/NetworkAgent.ts +9 -4
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +41 -12
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +442 -122
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -2
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/performance/AIContext.ts +7 -8
- package/front_end/models/ai_assistance/skills/README.md +40 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +13 -0
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +10 -0
- package/front_end/models/ai_assistance/skills/styling.md +6 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +12 -4
- package/front_end/models/breakpoints/BreakpointManager.ts +54 -2
- package/front_end/models/greendev/Prototypes.ts +0 -7
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +20 -0
- package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +5 -0
- package/front_end/models/issues_manager/EmailVerificationRequestIssue.ts +293 -0
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +1748 -1739
- package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +1 -1
- package/front_end/models/stack_trace/DetailedErrorStackParser.ts +9 -1
- package/front_end/models/stack_trace/StackTraceImpl.ts +29 -9
- package/front_end/models/stack_trace/StackTraceModel.ts +23 -11
- package/front_end/models/stack_trace/Trie.ts +11 -1
- package/front_end/models/trace/extras/TraceTree.ts +20 -1
- package/front_end/models/trace/insights/Common.ts +9 -0
- package/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +21 -25
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +19 -75
- package/front_end/panels/ai_assistance/components/AccessibilityAgentMarkdownRenderer.ts +10 -3
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +148 -2
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +2 -3
- package/front_end/panels/ai_assistance/components/chatMessage.css +27 -0
- package/front_end/panels/application/CookieItemsView.ts +24 -0
- package/front_end/panels/application/DOMStorageItemsView.ts +9 -4
- package/front_end/panels/application/preloading/components/PreloadingString.ts +6 -0
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -4
- package/front_end/panels/console/ConsoleViewMessage.ts +13 -102
- package/front_end/panels/elements/StandaloneStylesContainer.ts +10 -0
- package/front_end/panels/elements/StylePropertiesSection.ts +6 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +30 -1
- package/front_end/panels/elements/StylesContainer.ts +3 -0
- package/front_end/panels/elements/StylesSidebarPane.ts +54 -4
- package/front_end/panels/elements/elements-meta.ts +14 -0
- package/front_end/panels/layer_viewer/layerDetailsView.css +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +4 -4
- package/front_end/panels/network/NetworkDataGridNode.ts +14 -0
- package/front_end/panels/network/NetworkLogViewColumns.ts +2 -2
- package/front_end/panels/network/RequestHeadersView.ts +55 -19
- package/front_end/panels/network/networkTimingTable.css +2 -4
- package/front_end/panels/recorder/components/ReplaySection.ts +28 -16
- package/front_end/panels/recorder/converters/LighthouseConverter.snapshot.txt +47 -0
- package/front_end/panels/recorder/converters/PuppeteerConverter.snapshot.txt +49 -0
- package/front_end/panels/recorder/converters/PuppeteerReplayConverter.snapshot.txt +33 -0
- package/front_end/panels/settings/SettingsScreen.ts +1 -2
- package/front_end/panels/sources/BreakpointsView.ts +23 -42
- package/front_end/panels/sources/DebuggerPlugin.ts +12 -5
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +169 -106
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +2 -2
- package/front_end/third_party/marked/README.chromium +3 -6
- package/front_end/third_party/marked/package/README.md +5 -5
- package/front_end/third_party/marked/package/bin/main.js +27 -22
- package/front_end/third_party/marked/package/bin/marked.js +2 -1
- package/front_end/third_party/marked/package/lib/marked.esm.d.ts +346 -256
- package/front_end/third_party/marked/package/lib/marked.esm.js +67 -2698
- package/front_end/third_party/marked/package/lib/marked.esm.js.map +7 -1
- package/front_end/third_party/marked/package/lib/marked.umd.js +69 -2722
- package/front_end/third_party/marked/package/lib/marked.umd.js.map +7 -1
- package/front_end/third_party/marked/package/man/marked.1 +4 -2
- package/front_end/third_party/marked/package/man/marked.1.md +2 -1
- package/front_end/third_party/marked/package/package.json +49 -57
- package/front_end/third_party/puppeteer-replay/README.chromium +2 -2
- package/front_end/third_party/puppeteer-replay/package/lib/cli.js +84 -80
- package/front_end/third_party/puppeteer-replay/package/lib/cli.js.map +1 -1
- package/front_end/third_party/puppeteer-replay/package/lib/extension-test.js +79 -83
- package/front_end/third_party/puppeteer-replay/package/lib/extension-test.js.map +1 -1
- package/front_end/third_party/puppeteer-replay/package/lib/main.d.ts +43 -171
- package/front_end/third_party/puppeteer-replay/package/lib/main.js +51 -206
- package/front_end/third_party/puppeteer-replay/package/lib/main.js.map +1 -1
- package/front_end/third_party/puppeteer-replay/package/package.json +37 -67
- package/front_end/tsconfig.json +1 -1
- package/front_end/ui/components/markdown_view/CodeBlock.ts +17 -6
- package/front_end/ui/components/markdown_view/MarkdownView.ts +39 -3
- package/front_end/ui/components/markdown_view/codeBlock.css +11 -0
- package/front_end/ui/components/markdown_view/markdownView.css +17 -0
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +0 -79
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +16 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
- package/inspector_overlay/testing/InspectorOverlayHelpers.ts +2 -0
- package/mcp/mcp.ts +1 -6
- package/package.json +14 -16
- package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1015
- package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgentOverlay.ts +0 -87
- package/front_end/third_party/marked/package/bin/marked +0 -215
- package/front_end/third_party/marked/package/lib/marked.cjs +0 -2726
- package/front_end/third_party/marked/package/lib/marked.cjs.map +0 -1
- package/front_end/third_party/marked/package/lib/marked.d.cts +0 -670
- package/front_end/third_party/marked/package/lib/marked.js +0 -2780
- package/front_end/third_party/marked/package/man/marked.1.txt +0 -86
- package/front_end/third_party/marked/package/marked.min.js +0 -6
- package/front_end/third_party/marked/package/src/Lexer.js +0 -492
- package/front_end/third_party/marked/package/src/Parser.js +0 -286
- package/front_end/third_party/marked/package/src/Renderer.js +0 -166
- package/front_end/third_party/marked/package/src/Slugger.js +0 -49
- package/front_end/third_party/marked/package/src/TextRenderer.js +0 -42
- package/front_end/third_party/marked/package/src/Tokenizer.js +0 -755
- package/front_end/third_party/marked/package/src/defaults.js +0 -29
- package/front_end/third_party/marked/package/src/helpers.js +0 -249
- package/front_end/third_party/marked/package/src/marked.js +0 -350
- package/front_end/third_party/marked/package/src/rules.js +0 -285
- package/front_end/third_party/puppeteer-replay/package/lib/cjs/main.cjs +0 -2099
- package/front_end/third_party/puppeteer-replay/package/lib/cjs/main.cjs.map +0 -1
- package/front_end/third_party/puppeteer-replay/package/lib/cjs/main.d.cts +0 -686
- package/front_end/third_party/puppeteer-replay/package/lib/cjs/main.d.ts +0 -35
- package/mcp/HostBindings.ts +0 -319
- /package/front_end/third_party/marked/package/{LICENSE.md → LICENSE} +0 -0
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This file contains the overlay script that is injected into the page when the
|
|
7
|
-
* BreakpointDebuggerAgent is waiting for a user action.
|
|
8
|
-
*
|
|
9
|
-
* This is a temporary solution for the prototype. In the long term, we should
|
|
10
|
-
* use a proper overlay or a different mechanism to communicate with the user,
|
|
11
|
-
* rather than injecting a script into the page. This approach is fine for the
|
|
12
|
-
* prototype but should be replaced before production.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import * as SDK from '../../../core/sdk/sdk.js';
|
|
16
|
-
|
|
17
|
-
export async function injectOverlay(): Promise<void> {
|
|
18
|
-
const targetManager = SDK.TargetManager.TargetManager.instance();
|
|
19
|
-
const primaryTarget = targetManager.primaryPageTarget();
|
|
20
|
-
|
|
21
|
-
await primaryTarget?.runtimeAgent().invoke_evaluate({
|
|
22
|
-
expression: WAIT_FOR_USER_ACTION_OVERLAY_SCRIPT,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function removeOverlay(): Promise<void> {
|
|
27
|
-
const targetManager = SDK.TargetManager.TargetManager.instance();
|
|
28
|
-
const primaryTarget = targetManager.primaryPageTarget();
|
|
29
|
-
|
|
30
|
-
await primaryTarget?.runtimeAgent().invoke_evaluate({
|
|
31
|
-
expression: REMOVE_OVERLAY_SCRIPT,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const WAIT_FOR_USER_ACTION_OVERLAY_SCRIPT = `
|
|
36
|
-
(function() {
|
|
37
|
-
const devtoolsOverlayId = 'devtools-waiting-overlay';
|
|
38
|
-
let overlay = document.getElementById(devtoolsOverlayId);
|
|
39
|
-
if (!overlay) {
|
|
40
|
-
overlay = document.createElement('div');
|
|
41
|
-
overlay.id = devtoolsOverlayId;
|
|
42
|
-
overlay.style.position = 'fixed';
|
|
43
|
-
overlay.style.top = '0';
|
|
44
|
-
overlay.style.left = '0';
|
|
45
|
-
overlay.style.width = '100vw';
|
|
46
|
-
overlay.style.height = '100vh';
|
|
47
|
-
overlay.style.pointerEvents = 'none';
|
|
48
|
-
overlay.style.zIndex = '2147483647';
|
|
49
|
-
overlay.style.boxSizing = 'border-box';
|
|
50
|
-
overlay.style.border = '10px solid red';
|
|
51
|
-
overlay.style.animation = 'devtools-fade 1.5s infinite alternate';
|
|
52
|
-
const text = document.createElement('div');
|
|
53
|
-
text.innerText = 'Trigger the breakpoint again';
|
|
54
|
-
text.style.position = 'absolute';
|
|
55
|
-
text.style.top = '10px';
|
|
56
|
-
text.style.left = '50%';
|
|
57
|
-
text.style.transform = 'translateX(-50%)';
|
|
58
|
-
text.style.backgroundColor = 'red';
|
|
59
|
-
text.style.color = 'white';
|
|
60
|
-
text.style.padding = '10px 20px';
|
|
61
|
-
text.style.borderRadius = '5px';
|
|
62
|
-
text.style.fontFamily = 'system-ui, sans-serif';
|
|
63
|
-
text.style.fontSize = '16px';
|
|
64
|
-
text.style.fontWeight = 'bold';
|
|
65
|
-
text.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
|
|
66
|
-
overlay.appendChild(text);
|
|
67
|
-
|
|
68
|
-
const style = document.createElement('style');
|
|
69
|
-
style.id = devtoolsOverlayId + '-style';
|
|
70
|
-
style.innerText = '@keyframes devtools-fade { from { opacity: 0.5; } to { opacity: 1; } }';
|
|
71
|
-
// Head might not exist immediately on a completely blank page, fallback to documentElement
|
|
72
|
-
(document.head || document.documentElement).appendChild(style);
|
|
73
|
-
|
|
74
|
-
document.documentElement.appendChild(overlay);
|
|
75
|
-
}
|
|
76
|
-
})();
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
const REMOVE_OVERLAY_SCRIPT = `
|
|
80
|
-
(function() {
|
|
81
|
-
const devtoolsOverlayId = 'devtools-waiting-overlay';
|
|
82
|
-
const overlay = document.getElementById(devtoolsOverlayId);
|
|
83
|
-
if (overlay) overlay.remove();
|
|
84
|
-
const style = document.getElementById(devtoolsOverlayId + '-style');
|
|
85
|
-
if (style) style.remove();
|
|
86
|
-
})();
|
|
87
|
-
`;
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Marked CLI
|
|
5
|
-
* Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const fs = require('fs'),
|
|
9
|
-
path = require('path'),
|
|
10
|
-
marked = require('../');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Man Page
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function help() {
|
|
17
|
-
const spawn = require('child_process').spawn;
|
|
18
|
-
|
|
19
|
-
const options = {
|
|
20
|
-
cwd: process.cwd(),
|
|
21
|
-
env: process.env,
|
|
22
|
-
setsid: false,
|
|
23
|
-
stdio: 'inherit'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
spawn('man', [path.resolve(__dirname, '../man/marked.1')], options)
|
|
27
|
-
.on('error', function() {
|
|
28
|
-
fs.readFile(path.resolve(__dirname, '../man/marked.1.txt'), 'utf8', function(err, data) {
|
|
29
|
-
if (err) throw err;
|
|
30
|
-
console.log(data);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function version() {
|
|
36
|
-
const pkg = require('../package.json');
|
|
37
|
-
console.log(pkg.version);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Main
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
function main(argv, callback) {
|
|
45
|
-
const files = [],
|
|
46
|
-
options = {};
|
|
47
|
-
let input,
|
|
48
|
-
output,
|
|
49
|
-
string,
|
|
50
|
-
arg,
|
|
51
|
-
tokens,
|
|
52
|
-
opt;
|
|
53
|
-
|
|
54
|
-
function getarg() {
|
|
55
|
-
let arg = argv.shift();
|
|
56
|
-
|
|
57
|
-
if (arg.indexOf('--') === 0) {
|
|
58
|
-
// e.g. --opt
|
|
59
|
-
arg = arg.split('=');
|
|
60
|
-
if (arg.length > 1) {
|
|
61
|
-
// e.g. --opt=val
|
|
62
|
-
argv.unshift(arg.slice(1).join('='));
|
|
63
|
-
}
|
|
64
|
-
arg = arg[0];
|
|
65
|
-
} else if (arg[0] === '-') {
|
|
66
|
-
if (arg.length > 2) {
|
|
67
|
-
// e.g. -abc
|
|
68
|
-
argv = arg.substring(1).split('').map(function(ch) {
|
|
69
|
-
return '-' + ch;
|
|
70
|
-
}).concat(argv);
|
|
71
|
-
arg = argv.shift();
|
|
72
|
-
} else {
|
|
73
|
-
// e.g. -a
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
// e.g. foo
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return arg;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
while (argv.length) {
|
|
83
|
-
arg = getarg();
|
|
84
|
-
switch (arg) {
|
|
85
|
-
case '--test':
|
|
86
|
-
return require('../test').main(process.argv.slice());
|
|
87
|
-
case '-o':
|
|
88
|
-
case '--output':
|
|
89
|
-
output = argv.shift();
|
|
90
|
-
break;
|
|
91
|
-
case '-i':
|
|
92
|
-
case '--input':
|
|
93
|
-
input = argv.shift();
|
|
94
|
-
break;
|
|
95
|
-
case '-s':
|
|
96
|
-
case '--string':
|
|
97
|
-
string = argv.shift();
|
|
98
|
-
break;
|
|
99
|
-
case '-t':
|
|
100
|
-
case '--tokens':
|
|
101
|
-
tokens = true;
|
|
102
|
-
break;
|
|
103
|
-
case '-h':
|
|
104
|
-
case '--help':
|
|
105
|
-
return help();
|
|
106
|
-
case '-v':
|
|
107
|
-
case '--version':
|
|
108
|
-
return version();
|
|
109
|
-
default:
|
|
110
|
-
if (arg.indexOf('--') === 0) {
|
|
111
|
-
opt = camelize(arg.replace(/^--(no-)?/, ''));
|
|
112
|
-
if (!marked.defaults.hasOwnProperty(opt)) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (arg.indexOf('--no-') === 0) {
|
|
116
|
-
options[opt] = typeof marked.defaults[opt] !== 'boolean'
|
|
117
|
-
? null
|
|
118
|
-
: false;
|
|
119
|
-
} else {
|
|
120
|
-
options[opt] = typeof marked.defaults[opt] !== 'boolean'
|
|
121
|
-
? argv.shift()
|
|
122
|
-
: true;
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
files.push(arg);
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function getData(callback) {
|
|
132
|
-
if (!input) {
|
|
133
|
-
if (files.length <= 2) {
|
|
134
|
-
if (string) {
|
|
135
|
-
return callback(null, string);
|
|
136
|
-
}
|
|
137
|
-
return getStdin(callback);
|
|
138
|
-
}
|
|
139
|
-
input = files.pop();
|
|
140
|
-
}
|
|
141
|
-
return fs.readFile(input, 'utf8', callback);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return getData(function(err, data) {
|
|
145
|
-
if (err) return callback(err);
|
|
146
|
-
|
|
147
|
-
data = tokens
|
|
148
|
-
? JSON.stringify(marked.lexer(data, options), null, 2)
|
|
149
|
-
: marked(data, options);
|
|
150
|
-
|
|
151
|
-
if (!output) {
|
|
152
|
-
process.stdout.write(data + '\n');
|
|
153
|
-
return callback();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return fs.writeFile(output, data, callback);
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Helpers
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
function getStdin(callback) {
|
|
165
|
-
const stdin = process.stdin;
|
|
166
|
-
let buff = '';
|
|
167
|
-
|
|
168
|
-
stdin.setEncoding('utf8');
|
|
169
|
-
|
|
170
|
-
stdin.on('data', function(data) {
|
|
171
|
-
buff += data;
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
stdin.on('error', function(err) {
|
|
175
|
-
return callback(err);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
stdin.on('end', function() {
|
|
179
|
-
return callback(null, buff);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
try {
|
|
183
|
-
stdin.resume();
|
|
184
|
-
} catch (e) {
|
|
185
|
-
callback(e);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function camelize(text) {
|
|
190
|
-
return text.replace(/(\w)-(\w)/g, function(_, a, b) {
|
|
191
|
-
return a + b.toUpperCase();
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function handleError(err) {
|
|
196
|
-
if (err.code === 'ENOENT') {
|
|
197
|
-
console.error('marked: output to ' + err.path + ': No such directory');
|
|
198
|
-
return process.exit(1);
|
|
199
|
-
}
|
|
200
|
-
throw err;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Expose / Entry Point
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
if (!module.parent) {
|
|
208
|
-
process.title = 'marked';
|
|
209
|
-
main(process.argv.slice(), function(err, code) {
|
|
210
|
-
if (err) return handleError(err);
|
|
211
|
-
return process.exit(code || 0);
|
|
212
|
-
});
|
|
213
|
-
} else {
|
|
214
|
-
module.exports = main;
|
|
215
|
-
}
|