mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Compare commits
No commits in common. "main" and "v0.55.0-dev-20251013" have entirely different histories.
main
...
v0.55.0-de
85 changed files with 188485 additions and 202099 deletions
|
|
@ -62,9 +62,6 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: npx playwright install --with-deps
|
|
||||||
displayName: Install Playwright Dependencies
|
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
|
||||||
env:
|
env:
|
||||||
VSCODE_REF: ${{ parameters.vscodeRef }}
|
VSCODE_REF: ${{ parameters.vscodeRef }}
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,6 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: npx playwright install --with-deps
|
|
||||||
displayName: Install Playwright Dependencies
|
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg stable
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg stable
|
||||||
displayName: Setup, Build & Test monaco-editor-core
|
displayName: Setup, Build & Test monaco-editor-core
|
||||||
|
|
||||||
|
|
|
||||||
150
.github/commands.json
vendored
150
.github/commands.json
vendored
|
|
@ -1,150 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "question",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "*question"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "*question",
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"comment": "We closed this issue because it is a question about using Monaco Editor rather than an issue or feature request. Please search for help on [StackOverflow](https://stackoverflow.com/questions/tagged/monaco-editor), where the community has already answered many similar questions. See also our [issue reporting guidelines](https://github.com/microsoft/monaco-editor#contributing).\n\nHappy Coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "*out-of-scope",
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"comment": "We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.\n\nThanks for your understanding, and happy coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "wont-fix",
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"comment": "We closed this issue because we don't plan to address it.\n\nThanks for your understanding, and happy coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "duplicate",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "*duplicate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "*duplicate",
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"comment": "Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for [existing issues](https://github.com/microsoft/monaco-editor/issues).\n\nHappy Coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "verified",
|
|
||||||
"allowUsers": [
|
|
||||||
"@author"
|
|
||||||
],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "verified",
|
|
||||||
"removeLabel": "author-verification-requested",
|
|
||||||
"requireLabel": "author-verification-requested",
|
|
||||||
"disallowLabel": "unreleased"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "confirm",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "confirmed",
|
|
||||||
"removeLabel": "confirmation-pending"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "confirmationPending",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "confirmation-pending",
|
|
||||||
"removeLabel": "confirmed"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "needsMoreInfo",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "~info-needed"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "closedWith",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "close",
|
|
||||||
"reason": "completed",
|
|
||||||
"addLabel": "unreleased"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "spam",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"addLabel": "invalid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__comment__": "Allows folks on the team to label issues by commenting: `\\label My-Label` ",
|
|
||||||
"type": "comment",
|
|
||||||
"name": "label",
|
|
||||||
"allowUsers": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "~verification-steps-needed",
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "verification-steps-needed",
|
|
||||||
"removeLabel": "~verification-steps-needed",
|
|
||||||
"comment": "Friendly ping! Looks like this issue requires some further steps to be verified. Please provide us with the steps necessary to verify this issue."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "~info-needed",
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "info-needed",
|
|
||||||
"removeLabel": "~info-needed",
|
|
||||||
"comment": "Thanks for creating this issue! We figured it's missing some basic information or doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.\n\nHappy Coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "~version-info-needed",
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "info-needed",
|
|
||||||
"removeLabel": "~version-info-needed",
|
|
||||||
"comment": "Thanks for creating this issue! We figured it's missing some basic information, such as a version number. Please take the time to update the issue with the Monaco Editor version you're using.\n\nHappy Coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "label",
|
|
||||||
"name": "~confirmation-needed",
|
|
||||||
"action": "updateLabels",
|
|
||||||
"addLabel": "info-needed",
|
|
||||||
"removeLabel": "~confirmation-needed",
|
|
||||||
"comment": "Please try to reproduce this issue with the latest version of Monaco Editor. If the issue persists, please update the issue with confirmation.\n\nHappy Coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "gifPlease",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "comment",
|
|
||||||
"addLabel": "info-needed",
|
|
||||||
"comment": "Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, `.gif` files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.\n\nHappy coding!"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "comment",
|
|
||||||
"name": "upstream",
|
|
||||||
"allowUsers": [],
|
|
||||||
"action": "close",
|
|
||||||
"reason": "not_planned",
|
|
||||||
"addLabel": "upstream",
|
|
||||||
"comment": "This issue is caused by an upstream dependency (VS Code editor core). The fix needs to happen in the [VS Code repository](https://github.com/microsoft/vscode). Please check if there's already an issue filed there, or create one if not.\n\nHappy Coding!"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
|
|
@ -83,18 +83,14 @@ jobs:
|
||||||
- name: Run smoke test
|
- name: Run smoke test
|
||||||
run: npm run smoketest
|
run: npm run smoketest
|
||||||
|
|
||||||
- name: Install website node modules
|
# - name: Install website node modules
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: npm ci
|
# run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Install most recent version of monaco-editor
|
# - name: Build website
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: npm install monaco-editor
|
# run: yarn run build
|
||||||
|
|
||||||
- name: Build website
|
# - name: Test website
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: npm run build
|
# run: yarn test
|
||||||
|
|
||||||
- name: Test website
|
|
||||||
working-directory: website
|
|
||||||
run: npm run test
|
|
||||||
|
|
|
||||||
8
.github/workflows/website.yml
vendored
8
.github/workflows/website.yml
vendored
|
|
@ -39,10 +39,8 @@ jobs:
|
||||||
- name: execute `npm ci` (1)
|
- name: execute `npm ci` (1)
|
||||||
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
# For TypeDoc
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build-monaco-editor
|
||||||
|
|
||||||
- name: Install website node modules
|
- name: Install website node modules
|
||||||
working-directory: website
|
working-directory: website
|
||||||
|
|
@ -56,10 +54,6 @@ jobs:
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Test website
|
|
||||||
working-directory: website
|
|
||||||
run: npm run test
|
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
|
|
||||||
2
.nvmrc
2
.nvmrc
|
|
@ -1 +1 @@
|
||||||
22.21.1
|
22.18.0
|
||||||
|
|
|
||||||
15
CHANGELOG.md
15
CHANGELOG.md
|
|
@ -1,20 +1,5 @@
|
||||||
# Monaco Editor Changelog
|
# Monaco Editor Changelog
|
||||||
|
|
||||||
## [0.55.1]
|
|
||||||
|
|
||||||
- Fixes missing language exports (monaco.json/typescript/...) due to wrong "types" path - [#5123](https://github.com/microsoft/monaco-editor/issues/5123)
|
|
||||||
|
|
||||||
## [0.55.0]
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
- Moves nested namespaces (`languages.css`, `languages.html`, `languages.json`, `languages.typescript`) to top level namespaces (`css`, `html`, `json`, `typescript`) to simplify the build process and align with typescript recommendations.
|
|
||||||
|
|
||||||
### New Features
|
|
||||||
- Adds native LSP support (see new `lsp` namespace).
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
- Updates dompurify to 3.2.7
|
|
||||||
|
|
||||||
## [0.54.0]
|
## [0.54.0]
|
||||||
|
|
||||||
- Adds option `editor.mouseMiddleClickAction`
|
- Adds option `editor.mouseMiddleClickAction`
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,6 @@ You will get:
|
||||||
|
|
||||||
:warning: The monaco editor also ships an `AMD` build for backwards-compatibility reasons, but the `AMD` support is deprecated and will be removed in future versions.
|
:warning: The monaco editor also ships an `AMD` build for backwards-compatibility reasons, but the `AMD` support is deprecated and will be removed in future versions.
|
||||||
|
|
||||||
## Localization
|
|
||||||
|
|
||||||
To load the editor in a specific language, make sure that the corresponding nls script file is loaded before the main monaco editor script. For example, to load the editor in German, include the following script tag:
|
|
||||||
```html
|
|
||||||
<script src="path/to/monaco-editor/esm/nls.messages.de.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Check the sources for available languages.
|
|
||||||
|
|
||||||
## Concepts
|
## Concepts
|
||||||
|
|
||||||
Monaco editor is best known for being the text editor that powers VS Code. However, it's a bit more nuanced. Some basic understanding about the underlying concepts is needed to use Monaco editor effectively.
|
Monaco editor is best known for being the text editor that powers VS Code. However, it's a bit more nuanced. Some basic understanding about the underlying concepts is needed to use Monaco editor effectively.
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,45 @@ import nodeResolve from '@rollup/plugin-node-resolve';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { defineConfig } from 'rollup';
|
import { defineConfig } from 'rollup';
|
||||||
import { dts } from 'rollup-plugin-dts';
|
import { dts } from 'rollup-plugin-dts';
|
||||||
import { dtsDeprecationWarning, mapModuleId } from '../shared.mjs';
|
|
||||||
|
const root = join(import.meta.dirname, '../../');
|
||||||
|
const outDir = join(import.meta.dirname, './out');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} filePath
|
||||||
|
* @param {string} newExt
|
||||||
|
*/
|
||||||
|
function changeExt(filePath, newExt) {
|
||||||
|
const idx = filePath.lastIndexOf('.');
|
||||||
|
if (idx === -1) {
|
||||||
|
return filePath + newExt;
|
||||||
|
} else {
|
||||||
|
return filePath.substring(0, idx) + newExt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mappedPaths = {
|
||||||
|
[join(root, 'node_modules/monaco-editor-core/esm/')]: '.',
|
||||||
|
[join(root, 'node_modules/')]: 'external/',
|
||||||
|
[join(root, 'src/')]: 'vs/'
|
||||||
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
input: {
|
input: {
|
||||||
types: join(import.meta.dirname, './src/types.ts')
|
types: join(import.meta.dirname, './src/types.ts')
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
dir: join(import.meta.dirname, './out'),
|
dir: outDir,
|
||||||
format: 'es',
|
format: 'es',
|
||||||
preserveModules: false,
|
preserveModules: false,
|
||||||
entryFileNames: function (chunkInfo) {
|
entryFileNames: function (chunkInfo) {
|
||||||
const moduleId = chunkInfo.facadeModuleId;
|
const moduleId = chunkInfo.facadeModuleId;
|
||||||
if (moduleId) {
|
if (moduleId) {
|
||||||
const m = mapModuleId(moduleId, '.d.ts');
|
for (const [key, val] of Object.entries(mappedPaths)) {
|
||||||
if (m !== undefined) {
|
if (moduleId.startsWith(key)) {
|
||||||
return m;
|
const relativePath = moduleId.substring(key.length);
|
||||||
|
return changeExt(join(val, relativePath), '.d.ts');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '[name].d.ts';
|
return '[name].d.ts';
|
||||||
|
|
@ -38,7 +61,6 @@ export default defineConfig({
|
||||||
stripInternal: true
|
stripInternal: true
|
||||||
},
|
},
|
||||||
includeExternal: ['monaco-editor-core', '@vscode/monaco-lsp-client']
|
includeExternal: ['monaco-editor-core', '@vscode/monaco-lsp-client']
|
||||||
}),
|
})
|
||||||
dtsDeprecationWarning(),
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,6 @@
|
||||||
/// @ts-ignore
|
/// @ts-ignore
|
||||||
import * as require from 'require';
|
import * as require from 'require';
|
||||||
|
|
||||||
if (typeof (globalThis as any).require !== 'undefined' && typeof (globalThis as any).require.config === 'function') {
|
|
||||||
(globalThis as any).require.config({
|
|
||||||
ignoreDuplicateModules: [
|
|
||||||
'vscode-languageserver-types',
|
|
||||||
'vscode-languageserver-types/main',
|
|
||||||
'vscode-languageserver-textdocument',
|
|
||||||
'vscode-languageserver-textdocument/main',
|
|
||||||
'vscode-nls',
|
|
||||||
'vscode-nls/vscode-nls',
|
|
||||||
'jsonc-parser',
|
|
||||||
'jsonc-parser/main',
|
|
||||||
'vscode-uri',
|
|
||||||
'vscode-uri/index',
|
|
||||||
'vs/basic-languages/typescript/typescript'
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
self.MonacoEnvironment = {
|
self.MonacoEnvironment = {
|
||||||
getWorker: function (_moduleId, label) {
|
getWorker: function (_moduleId, label) {
|
||||||
if (label === 'json') {
|
if (label === 'json') {
|
||||||
|
|
@ -81,10 +63,16 @@ function getWorkerBootstrapUrl(workerScriptUrl: string | URL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
import 'vs/nls.messages-loader!';
|
import 'vs/nls.messages-loader!';
|
||||||
import * as monaco from '../../../src/editor/editor.main';
|
|
||||||
export * from '../../../src/editor/editor.main';
|
export * from '../../../src/editor/editor.main';
|
||||||
|
|
||||||
globalThis.monaco = monaco;
|
// for now, lsp is only available to amd build
|
||||||
|
import * as lsp from '@vscode/monaco-lsp-client';
|
||||||
|
export { lsp };
|
||||||
|
|
||||||
|
// TODO@hediet get rid of the monaco global
|
||||||
|
if ((globalThis as any).monaco) {
|
||||||
|
(globalThis as any).monaco.lsp = lsp;
|
||||||
|
}
|
||||||
|
|
||||||
const styleSheetUrl = require.toUrl('vs/editor/editor.main.css');
|
const styleSheetUrl = require.toUrl('vs/editor/editor.main.css');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,23 @@
|
||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
import { dirname, resolve } from 'node:path';
|
import { glob } from 'node:fs/promises';
|
||||||
|
import { basename, dirname, join, resolve } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { urlToEsmPlugin } from './plugin';
|
import { urlToEsmPlugin } from './plugin';
|
||||||
import { getNlsEntryPoints } from '../shared.mjs';
|
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
export default defineConfig(async (args) => {
|
export default defineConfig(async (args) => {
|
||||||
|
const monacoEditorCoreDir = join(
|
||||||
|
dirname(require.resolve('monaco-editor-core/package.json')),
|
||||||
|
'esm'
|
||||||
|
);
|
||||||
|
const nlsEntries = {};
|
||||||
|
for await (const path of glob(`${monacoEditorCoreDir}/nls.messages.*.js`)) {
|
||||||
|
const entryName = basename(path).replace('.js', '');
|
||||||
|
nlsEntries[entryName] = path;
|
||||||
|
}
|
||||||
|
|
||||||
/** @type {import('vite').UserConfig} */
|
/** @type {import('vite').UserConfig} */
|
||||||
return {
|
return {
|
||||||
base: './',
|
base: './',
|
||||||
|
|
@ -18,7 +28,7 @@ export default defineConfig(async (args) => {
|
||||||
lib: {
|
lib: {
|
||||||
cssFileName: 'editor/editor.main',
|
cssFileName: 'editor/editor.main',
|
||||||
entry: {
|
entry: {
|
||||||
...getNlsEntryPoints(),
|
...nlsEntries,
|
||||||
'nls.messages-loader': resolve(__dirname, 'src/nls.messages-loader.js'),
|
'nls.messages-loader': resolve(__dirname, 'src/nls.messages-loader.js'),
|
||||||
'editor/editor.main': resolve(__dirname, 'src/editor.main.ts'),
|
'editor/editor.main': resolve(__dirname, 'src/editor.main.ts'),
|
||||||
'basic-languages/monaco.contribution': resolve(
|
'basic-languages/monaco.contribution': resolve(
|
||||||
127
build/build-languages.ts
Normal file
127
build/build-languages.ts
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import glob from 'glob';
|
||||||
|
import { runTsc, massageAndCopyDts, buildESM } from './utils';
|
||||||
|
import { removeDir } from './fs';
|
||||||
|
|
||||||
|
removeDir(`out/languages`);
|
||||||
|
|
||||||
|
runTsc(`src/tsconfig.json`);
|
||||||
|
|
||||||
|
//#region Type Defintion
|
||||||
|
|
||||||
|
massageAndCopyDts(
|
||||||
|
`out/languages/tsc/language/css/monaco.contribution.d.ts`,
|
||||||
|
`out/languages/bundled/css.d.ts`,
|
||||||
|
'monaco.languages.css'
|
||||||
|
);
|
||||||
|
massageAndCopyDts(
|
||||||
|
`out/languages/tsc/language/html/monaco.contribution.d.ts`,
|
||||||
|
`out/languages/bundled/html.d.ts`,
|
||||||
|
'monaco.languages.html'
|
||||||
|
);
|
||||||
|
massageAndCopyDts(
|
||||||
|
`out/languages/tsc/language/json/monaco.contribution.d.ts`,
|
||||||
|
`out/languages/bundled/json.d.ts`,
|
||||||
|
'monaco.languages.json'
|
||||||
|
);
|
||||||
|
massageAndCopyDts(
|
||||||
|
`out/languages/tsc/language/typescript/monaco.contribution.d.ts`,
|
||||||
|
`out/languages/bundled/typescript.d.ts`,
|
||||||
|
'monaco.languages.typescript'
|
||||||
|
);
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region css
|
||||||
|
|
||||||
|
buildESM({
|
||||||
|
base: 'language/css',
|
||||||
|
entryPoints: [
|
||||||
|
'src/language/css/monaco.contribution.ts',
|
||||||
|
'src/language/css/cssMode.ts',
|
||||||
|
'src/language/css/css.worker.ts'
|
||||||
|
],
|
||||||
|
external: ['monaco-editor-core', '*/cssMode', '*/monaco.contribution']
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region html
|
||||||
|
|
||||||
|
buildESM({
|
||||||
|
base: 'language/html',
|
||||||
|
entryPoints: [
|
||||||
|
'src/language/html/monaco.contribution.ts',
|
||||||
|
'src/language/html/htmlMode.ts',
|
||||||
|
'src/language/html/html.worker.ts'
|
||||||
|
],
|
||||||
|
external: ['monaco-editor-core', '*/htmlMode', '*/monaco.contribution']
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region json
|
||||||
|
|
||||||
|
buildESM({
|
||||||
|
base: 'language/json',
|
||||||
|
entryPoints: [
|
||||||
|
'src/language/json/monaco.contribution.ts',
|
||||||
|
'src/language/json/jsonMode.ts',
|
||||||
|
'src/language/json/json.worker.ts'
|
||||||
|
],
|
||||||
|
external: ['monaco-editor-core', '*/jsonMode', '*/monaco.contribution']
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region typescript
|
||||||
|
|
||||||
|
buildESM({
|
||||||
|
base: 'language/typescript',
|
||||||
|
entryPoints: [
|
||||||
|
'src/language/typescript/monaco.contribution.ts',
|
||||||
|
'src/language/typescript/tsMode.ts',
|
||||||
|
'src/language/typescript/ts.worker.ts'
|
||||||
|
],
|
||||||
|
external: ['monaco-editor-core', '*/tsMode', '*/monaco.contribution']
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region basic-languages
|
||||||
|
|
||||||
|
glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const languages = files.map((file) => file.split('/')[3]);
|
||||||
|
|
||||||
|
// ESM
|
||||||
|
{
|
||||||
|
/** @type {string[]} */
|
||||||
|
const entryPoints = [
|
||||||
|
'src/basic-languages/monaco.contribution.ts',
|
||||||
|
'src/basic-languages/_.contribution.ts'
|
||||||
|
];
|
||||||
|
const external = ['monaco-editor-core', '*/_.contribution'];
|
||||||
|
for (const language of languages) {
|
||||||
|
entryPoints.push(`src/basic-languages/${language}/${language}.contribution.ts`);
|
||||||
|
entryPoints.push(`src/basic-languages/${language}/${language}.ts`);
|
||||||
|
external.push(`*/${language}.contribution`);
|
||||||
|
external.push(`*/${language}`);
|
||||||
|
}
|
||||||
|
buildESM({
|
||||||
|
base: 'basic-languages',
|
||||||
|
entryPoints,
|
||||||
|
external
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
@ -5,18 +5,31 @@
|
||||||
|
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import { REPO_ROOT, readFiles, writeFiles } from '../build/utils';
|
import {
|
||||||
import { generateEsmMetadataJsAndDTs } from './releaseMetadata';
|
REPO_ROOT,
|
||||||
import { buildESM } from './esm/build.script';
|
readFiles,
|
||||||
|
writeFiles,
|
||||||
|
IFile,
|
||||||
|
readFile,
|
||||||
|
build,
|
||||||
|
bundledFileHeader
|
||||||
|
} from '../build/utils';
|
||||||
|
import { removeDir } from '../build/fs';
|
||||||
|
import { generateMetadata } from './releaseMetadata';
|
||||||
import { buildAmdMinDev } from './amd/build.script';
|
import { buildAmdMinDev } from './amd/build.script';
|
||||||
import { rm } from 'fs/promises';
|
import ts = require('typescript');
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
await rm(path.join(REPO_ROOT, './out/monaco-editor'), { recursive: true, force: true });
|
removeDir(`out/monaco-editor`);
|
||||||
|
|
||||||
await buildESM();
|
|
||||||
await buildAmdMinDev();
|
await buildAmdMinDev();
|
||||||
|
|
||||||
|
// esm folder
|
||||||
|
ESM_release();
|
||||||
|
|
||||||
|
// monaco.d.ts, editor.api.d.ts
|
||||||
|
releaseDTS();
|
||||||
|
|
||||||
// copy types.d.ts from build/amd/out/ to out/monaco-editor/monaco.d.ts (and append `declare global { export import monaco = editor_main; }`)
|
// copy types.d.ts from build/amd/out/ to out/monaco-editor/monaco.d.ts (and append `declare global { export import monaco = editor_main; }`)
|
||||||
(() => {
|
(() => {
|
||||||
let contents = fs.readFileSync('build/amd/out/types.d.ts', { encoding: 'utf8' });
|
let contents = fs.readFileSync('build/amd/out/types.d.ts', { encoding: 'utf8' });
|
||||||
|
|
@ -24,8 +37,11 @@ async function run() {
|
||||||
fs.writeFileSync('out/monaco-editor/monaco.d.ts', contents);
|
fs.writeFileSync('out/monaco-editor/monaco.d.ts', contents);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
createThirdPartyNoticesDotTxt();
|
// ThirdPartyNotices.txt
|
||||||
generateEsmMetadataJsAndDTs();
|
releaseThirdPartyNotices();
|
||||||
|
|
||||||
|
// esm/metadata.d.ts, esm/metadata.js
|
||||||
|
generateMetadata();
|
||||||
|
|
||||||
// package.json
|
// package.json
|
||||||
(() => {
|
(() => {
|
||||||
|
|
@ -55,11 +71,281 @@ async function run() {
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ESM_release() {
|
||||||
|
const coreFiles = readFiles(`node_modules/monaco-editor-core/esm/**/*`, {
|
||||||
|
base: 'node_modules/monaco-editor-core/esm',
|
||||||
|
// we will create our own editor.api.d.ts which also contains the plugins API
|
||||||
|
ignore: ['node_modules/monaco-editor-core/esm/vs/editor/editor.api.d.ts']
|
||||||
|
});
|
||||||
|
ESM_addImportSuffix(coreFiles);
|
||||||
|
ESM_addPluginContribs(coreFiles);
|
||||||
|
writeFiles(coreFiles, `out/monaco-editor/esm`);
|
||||||
|
|
||||||
|
ESM_releasePlugins();
|
||||||
|
|
||||||
|
build({
|
||||||
|
entryPoints: ['src/editor/editor.main.ts', 'src/editor/editor.worker.ts'],
|
||||||
|
bundle: true,
|
||||||
|
target: 'esnext',
|
||||||
|
format: 'esm',
|
||||||
|
drop: ['debugger'],
|
||||||
|
banner: {
|
||||||
|
js: bundledFileHeader
|
||||||
|
},
|
||||||
|
external: ['./src/basic-languages/*', './edcore.main.js', './editor.worker.start'],
|
||||||
|
alias: {
|
||||||
|
'monaco-editor-core/esm/vs/editor/editor.worker.start': './editor.worker.start',
|
||||||
|
'monaco-editor-core': './edcore.main.js'
|
||||||
|
},
|
||||||
|
outbase: `src/`,
|
||||||
|
outdir: `out/monaco-editor/esm/vs/`,
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
name: 'example',
|
||||||
|
setup(build) {
|
||||||
|
build.onResolve({ filter: /\/language\/|\/basic-languages\// }, (args) => {
|
||||||
|
if (args.path.includes('monaco-editor-core')) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return { external: true };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release a plugin to `esm`.
|
||||||
|
* Adds a dependency to 'vs/editor/editor.api' in contrib files in order for `monaco` to be defined.
|
||||||
|
* Rewrites imports for 'monaco-editor-core/**'
|
||||||
|
*/
|
||||||
|
function ESM_releasePlugins() {
|
||||||
|
const files = readFiles(`out/languages/bundled/esm/**/*`, { base: 'out/languages/bundled/esm/' });
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
if (!/(\.js$)|(\.ts$)/.test(file.path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = file.contents.toString();
|
||||||
|
|
||||||
|
// replace all `from "monaco-editor-core"` with from relativePath
|
||||||
|
let relativePath = path
|
||||||
|
.relative(path.dirname(file.path), 'vs/editor/editor.api')
|
||||||
|
.replace(/\\/g, '/');
|
||||||
|
|
||||||
|
contents = contents.replace(
|
||||||
|
/from "monaco-editor-core"/g,
|
||||||
|
`from ${JSON.stringify(relativePath)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
file.contents = Buffer.from(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
if (!/monaco\.contribution\.js$/.test(file.path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const apiFilePath = 'vs/editor/editor.api';
|
||||||
|
let relativePath = path.relative(path.dirname(file.path), apiFilePath).replace(/\\/g, '/');
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = file.contents.toString();
|
||||||
|
contents = `import '${relativePath}';\n` + contents;
|
||||||
|
file.contents = Buffer.from(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
ESM_addImportSuffix(files);
|
||||||
|
writeFiles(files, `out/monaco-editor/esm`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds `.js` to all import statements.
|
||||||
|
*/
|
||||||
|
function ESM_addImportSuffix(files: IFile[]) {
|
||||||
|
for (const file of files) {
|
||||||
|
if (!/\.js$/.test(file.path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contents = file.contents.toString();
|
||||||
|
|
||||||
|
const info = ts.preProcessFile(contents);
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importText = info.importedFiles[i].fileName;
|
||||||
|
const pos = info.importedFiles[i].pos;
|
||||||
|
const end = info.importedFiles[i].end;
|
||||||
|
|
||||||
|
if (/(\.css)|(\.js)$/.test(importText)) {
|
||||||
|
// A CSS import or an import already using .js
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents = contents.substring(0, pos + 1) + importText + '.js' + contents.substring(end + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
file.contents = Buffer.from(contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - Rename esm/vs/editor/editor.main.js to esm/vs/editor/edcore.main.js
|
||||||
|
* - Create esm/vs/editor/editor.main.js that that stiches things together
|
||||||
|
*/
|
||||||
|
function ESM_addPluginContribs(files: IFile[]) {
|
||||||
|
for (const file of files) {
|
||||||
|
if (!/editor\.main\.js$/.test(file.path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.path = file.path.replace(/editor\.main/, 'edcore.main');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit monaco.d.ts:
|
||||||
|
* - append monaco.d.ts from plugins
|
||||||
|
*/
|
||||||
|
function releaseDTS() {
|
||||||
|
const monacodts = readFiles('node_modules/monaco-editor-core/monaco.d.ts', {
|
||||||
|
base: 'node_modules/monaco-editor-core'
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
let contents = monacodts.contents.toString();
|
||||||
|
|
||||||
|
const additionalDtsFiles: Record<string, string> = {
|
||||||
|
'out/languages/tsc/common/workers.d.ts': 'monaco.editor'
|
||||||
|
};
|
||||||
|
Object.entries(additionalDtsFiles).forEach(([filePath, namespace]) => {
|
||||||
|
try {
|
||||||
|
const dtsFile = readFile(filePath);
|
||||||
|
let dtsContent = dtsFile.contents.toString();
|
||||||
|
|
||||||
|
// Remove imports
|
||||||
|
dtsContent = dtsContent.replace(/import .*\n/gm, '');
|
||||||
|
dtsContent = dtsContent.replace(/export declare function/gm, 'export function');
|
||||||
|
|
||||||
|
// Wrap in namespace if specified
|
||||||
|
if (namespace) {
|
||||||
|
dtsContent = `declare namespace ${namespace} {\n${dtsContent
|
||||||
|
.split('\n')
|
||||||
|
.map((line) => (line ? ` ${line}` : line))
|
||||||
|
.join('\n')}\n}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents += '\n' + dtsContent;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Could not read d.ts file: ${filePath}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const extraContent = readFiles('out/languages/bundled/*.d.ts', {
|
||||||
|
base: 'out/languages/bundled/'
|
||||||
|
}).map((file) => {
|
||||||
|
return file.contents.toString().replace(/\/\/\/ <reference.*\n/m, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
contents =
|
||||||
|
[
|
||||||
|
'/*!-----------------------------------------------------------',
|
||||||
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
|
' * Type definitions for monaco-editor',
|
||||||
|
' * Released under the MIT license',
|
||||||
|
'*-----------------------------------------------------------*/'
|
||||||
|
].join('\n') +
|
||||||
|
'\n' +
|
||||||
|
contents +
|
||||||
|
'\n' +
|
||||||
|
extraContent.join('\n');
|
||||||
|
|
||||||
|
// Ensure consistent indentation and line endings
|
||||||
|
contents = cleanFile(contents);
|
||||||
|
|
||||||
|
monacodts.contents = Buffer.from(contents);
|
||||||
|
|
||||||
|
const editorapidts = {
|
||||||
|
path: 'esm/vs/editor/editor.api.d.ts',
|
||||||
|
contents: Buffer.from(toExternalDTS(contents))
|
||||||
|
};
|
||||||
|
|
||||||
|
writeFiles([monacodts, editorapidts], `out/monaco-editor`);
|
||||||
|
|
||||||
|
// fs.writeFileSync('website/typedoc/monaco.d.ts', contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms a .d.ts which uses internal modules (namespaces) to one which is usable with external modules
|
||||||
|
* This function is duplicated in the `vscode` repo.
|
||||||
|
* @param {string} contents
|
||||||
|
*/
|
||||||
|
function toExternalDTS(contents) {
|
||||||
|
const lines = contents.split(/\r\n|\r|\n/);
|
||||||
|
let killNextCloseCurlyBrace = false;
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const line = lines[i];
|
||||||
|
|
||||||
|
if (killNextCloseCurlyBrace) {
|
||||||
|
if ('}' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf(' ') === 0) {
|
||||||
|
lines[i] = line.substr(4);
|
||||||
|
} else if (line.charAt(0) === '\t') {
|
||||||
|
lines[i] = line.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('declare namespace monaco {' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf('declare namespace monaco.') === 0) {
|
||||||
|
lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf('declare var MonacoEnvironment') === 0) {
|
||||||
|
lines[i] = `declare global {\n var MonacoEnvironment: Environment | undefined;\n}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lines.join('\n').replace(/\n\n\n+/g, '\n\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize line endings and ensure consistent 4 spaces indentation
|
||||||
|
*/
|
||||||
|
function cleanFile(contents: string): string {
|
||||||
|
return contents
|
||||||
|
.split(/\r\n|\r|\n/)
|
||||||
|
.map(function (line) {
|
||||||
|
const m = line.match(/^(\t+)/);
|
||||||
|
if (!m) {
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
const tabsCount = m[1].length;
|
||||||
|
let newIndent = '';
|
||||||
|
for (let i = 0; i < 4 * tabsCount; i++) {
|
||||||
|
newIndent += ' ';
|
||||||
|
}
|
||||||
|
return newIndent + line.substring(tabsCount);
|
||||||
|
})
|
||||||
|
.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit ThirdPartyNotices.txt:
|
* Edit ThirdPartyNotices.txt:
|
||||||
* - append ThirdPartyNotices.txt from plugins
|
* - append ThirdPartyNotices.txt from plugins
|
||||||
*/
|
*/
|
||||||
function createThirdPartyNoticesDotTxt() {
|
function releaseThirdPartyNotices() {
|
||||||
const tpn = readFiles('node_modules/monaco-editor-core/ThirdPartyNotices.txt', {
|
const tpn = readFiles('node_modules/monaco-editor-core/ThirdPartyNotices.txt', {
|
||||||
base: 'node_modules/monaco-editor-core'
|
base: 'node_modules/monaco-editor-core'
|
||||||
})[0];
|
})[0];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
import { run } from '../../scripts/lib/index';
|
|
||||||
|
|
||||||
export async function buildESM() {
|
|
||||||
const rootPath = __dirname;
|
|
||||||
await run('npx rollup -c rollup.config.mjs', { cwd: rootPath });
|
|
||||||
await run('npx rollup -c rollup-types.config.mjs', { cwd: rootPath });
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
!dist
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2024 Alexandr Yeskov
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
See https://www.npmjs.com/package/rollup-plugin-keep-css-imports.
|
|
||||||
Compare index.mjs with index.original.mjs to see the patch.
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import MagicString from "magic-string";
|
|
||||||
import type { RenderedChunk } from "rollup";
|
|
||||||
import { OutputOptions, KeepCssImportsPluginContext } from "./types";
|
|
||||||
interface ChunkDetails {
|
|
||||||
chunk: RenderedChunk;
|
|
||||||
bundleOutDir: string;
|
|
||||||
moduleRoot: string;
|
|
||||||
}
|
|
||||||
export declare class ImportUpdater {
|
|
||||||
private _outputOptions;
|
|
||||||
private _pluginContext;
|
|
||||||
constructor(pluginContext: KeepCssImportsPluginContext, outputOptions: OutputOptions);
|
|
||||||
getMagicId(id: string): string;
|
|
||||||
updateImports(code: string, chunk: RenderedChunk, bundleOutDir: string, moduleRoot: string): {
|
|
||||||
code: string;
|
|
||||||
map: import("magic-string").SourceMap;
|
|
||||||
};
|
|
||||||
updateMatchedImport(m: RegExpMatchArray, magicString: MagicString, chunkDetails: ChunkDetails): void;
|
|
||||||
private addImportAndGetNewId;
|
|
||||||
private updateChunk;
|
|
||||||
private saveAndGetUpdatedImportPath;
|
|
||||||
private shouldAddPrefixCurrentDir;
|
|
||||||
private resolveOutputPath;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import type { AsyncCompiler, Options } from "sass";
|
|
||||||
type SassAsyncCompiler = Pick<AsyncCompiler, "compileAsync" | "compileStringAsync">;
|
|
||||||
export type PostCssCompatible = {
|
|
||||||
process: (css: string, opt: {
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
map: {
|
|
||||||
prev: string;
|
|
||||||
inline: boolean;
|
|
||||||
} | null;
|
|
||||||
}) => string | {
|
|
||||||
css: string;
|
|
||||||
map?: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export interface CompilationOptions {
|
|
||||||
outputExt: string;
|
|
||||||
sass?: SassAsyncCompiler;
|
|
||||||
postProcessor?: (css: string, map: string) => Promise<PostCssCompatible | string | {
|
|
||||||
css: string;
|
|
||||||
map?: string;
|
|
||||||
}>;
|
|
||||||
loadPaths?: string[];
|
|
||||||
sourceMap?: boolean;
|
|
||||||
sassOptions: Options<"async">;
|
|
||||||
}
|
|
||||||
export declare const compileSass: (sassPath: string, outWatchList: string[] | undefined, { outputExt, sass, postProcessor, loadPaths, sourceMap, sassOptions }: CompilationOptions) => Promise<{
|
|
||||||
css: string;
|
|
||||||
map: string;
|
|
||||||
}>;
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export declare const PLUGIN_NAME = "keep-css-imports";
|
|
||||||
export declare const FILE_URL_PREFIX: string;
|
|
||||||
export declare const KEY_EXT_STRING = ".[keep-css-imports-plugin-ext]";
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
import { EmitFile } from "rollup";
|
|
||||||
import { StylesMap } from "./types";
|
|
||||||
export declare const escapeRegex: (val: any) => any;
|
|
||||||
export declare const assertDuplicates: (stylesToEmit: StylesMap) => void;
|
|
||||||
export declare const assertLocation: (outDir: any, assetPath: any) => void;
|
|
||||||
export declare const ensureSourceMap: ({ css, map }: {
|
|
||||||
css?: string | Uint8Array;
|
|
||||||
map?: string | Uint8Array;
|
|
||||||
}, includeSourceMap: boolean | "inline" | undefined, fileName: string, onEmit: EmitFile) => string | Uint8Array;
|
|
||||||
export declare const formatProcessedToCSS: (input: string | {
|
|
||||||
css: string;
|
|
||||||
map?: string | object;
|
|
||||||
}, sourceMap: boolean) => {
|
|
||||||
css: string;
|
|
||||||
map: string;
|
|
||||||
};
|
|
||||||
export declare const requireSass: () => Promise<{
|
|
||||||
default: typeof import("sass");
|
|
||||||
AsyncCompiler: typeof import("sass").AsyncCompiler;
|
|
||||||
Compiler: typeof import("sass").Compiler;
|
|
||||||
compile: typeof import("sass").compile;
|
|
||||||
compileAsync: typeof import("sass").compileAsync;
|
|
||||||
compileString: typeof import("sass").compileString;
|
|
||||||
compileStringAsync: typeof import("sass").compileStringAsync;
|
|
||||||
initCompiler: typeof import("sass").initCompiler;
|
|
||||||
initAsyncCompiler: typeof import("sass").initAsyncCompiler;
|
|
||||||
Exception: typeof import("sass").Exception;
|
|
||||||
Logger: typeof import("sass").Logger;
|
|
||||||
CalculationInterpolation: typeof import("sass").CalculationInterpolation;
|
|
||||||
CalculationOperation: typeof import("sass").CalculationOperation;
|
|
||||||
SassArgumentList: typeof import("sass").SassArgumentList;
|
|
||||||
SassBoolean: typeof import("sass").SassBoolean;
|
|
||||||
SassCalculation: typeof import("sass").SassCalculation;
|
|
||||||
SassColor: typeof import("sass").SassColor;
|
|
||||||
SassFunction: typeof import("sass").SassFunction;
|
|
||||||
SassList: typeof import("sass").SassList;
|
|
||||||
SassMap: typeof import("sass").SassMap;
|
|
||||||
SassMixin: typeof import("sass").SassMixin;
|
|
||||||
SassNumber: typeof import("sass").SassNumber;
|
|
||||||
SassString: typeof import("sass").SassString;
|
|
||||||
Value: typeof import("sass").Value;
|
|
||||||
sassFalse: import("sass").SassBoolean;
|
|
||||||
sassNull: import("sass").Value;
|
|
||||||
sassTrue: import("sass").SassBoolean;
|
|
||||||
FALSE: import("sass").types.Boolean<false>;
|
|
||||||
NULL: import("sass").types.Null;
|
|
||||||
TRUE: import("sass").types.Boolean<true>;
|
|
||||||
types: typeof import("sass").types;
|
|
||||||
render: typeof import("sass").render;
|
|
||||||
renderSync: typeof import("sass").renderSync;
|
|
||||||
info: string;
|
|
||||||
}>;
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
import type { Plugin } from "rollup";
|
|
||||||
import { KeepCssImportsOptions } from "./types";
|
|
||||||
declare function keepCssImports({ outputExt, outputPath, skipCurrentFolderPart, includeRegexp, sass, postProcessor, sassOptions, ...options }?: KeepCssImportsOptions): Plugin;
|
|
||||||
export default keepCssImports;
|
|
||||||
|
|
@ -1,487 +0,0 @@
|
||||||
import { readFile } from 'fs/promises';
|
|
||||||
import * as path from 'path';
|
|
||||||
import MagicString from 'magic-string';
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
||||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
***************************************************************************** */
|
|
||||||
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
||||||
|
|
||||||
|
|
||||||
var __assign = function () {
|
|
||||||
__assign = Object.assign || function __assign(t) {
|
|
||||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
||||||
s = arguments[i];
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
return __assign.apply(this, arguments);
|
|
||||||
};
|
|
||||||
|
|
||||||
function __rest(s, e) {
|
|
||||||
var t = {};
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
||||||
t[p] = s[p];
|
|
||||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
||||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
||||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
||||||
t[p[i]] = s[p[i]];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
function __awaiter(thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function __generator(thisArg, body) {
|
|
||||||
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
||||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
||||||
function step(op) {
|
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
|
||||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
||||||
switch (op[0]) {
|
|
||||||
case 0: case 1: t = op; break;
|
|
||||||
case 4: _.label++; return { value: op[1], done: false };
|
|
||||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
||||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
||||||
default:
|
|
||||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
||||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
||||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
||||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
||||||
if (t[2]) _.ops.pop();
|
|
||||||
_.trys.pop(); continue;
|
|
||||||
}
|
|
||||||
op = body.call(thisArg, _);
|
|
||||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
||||||
var e = new Error(message);
|
|
||||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
||||||
};
|
|
||||||
|
|
||||||
var escapeRegex = function (val) { return val.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&"); };
|
|
||||||
var assertDuplicates = function (stylesToEmit) {
|
|
||||||
Object.values(stylesToEmit).forEach(function (v, i, all) {
|
|
||||||
if (all.some(function (av, ai) { return !!v.output && v.output === av.output && ai != i; })) {
|
|
||||||
throw new Error("Two or more assets have conflicting output path ".concat(v.output));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var assertLocation = function (outDir, assetPath) {
|
|
||||||
if (!path.normalize(assetPath).startsWith(path.normalize(outDir))) {
|
|
||||||
throw new Error("Output path ".concat(assetPath, " must be in output directory ").concat(outDir));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var ensureSourceMap = function (_a, includeSourceMap, fileName, onEmit) {
|
|
||||||
var css = _a.css, map = _a.map;
|
|
||||||
if (map) {
|
|
||||||
if (includeSourceMap === "inline") {
|
|
||||||
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat((map instanceof Uint8Array ? Buffer.from(map) : Buffer.from(map, "utf8")).toString("base64"), "*/");
|
|
||||||
}
|
|
||||||
else if (includeSourceMap === true) {
|
|
||||||
css += "\n/*# sourceMappingURL=".concat(path.basename(fileName), ".map */");
|
|
||||||
}
|
|
||||||
if (includeSourceMap === true) {
|
|
||||||
onEmit({
|
|
||||||
type: "asset",
|
|
||||||
fileName: fileName + ".map",
|
|
||||||
source: map,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return css;
|
|
||||||
};
|
|
||||||
var formatProcessedToCSS = function (input, sourceMap) {
|
|
||||||
return typeof input === "string"
|
|
||||||
? { css: input, map: "" }
|
|
||||||
: typeof input === "object"
|
|
||||||
? {
|
|
||||||
css: input.css,
|
|
||||||
map: !sourceMap ? "" : typeof input.map === "object" ? JSON.stringify(input.map) : input.map,
|
|
||||||
}
|
|
||||||
: input;
|
|
||||||
};
|
|
||||||
var requireSass = function () {
|
|
||||||
try {
|
|
||||||
return import('sass');
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
throw new Error("You have to install `sass` package! Try running\n\t" +
|
|
||||||
"npm install --save-dev sass\nor\nyarn add sass --dev\n" +
|
|
||||||
"or use `sass` option to pass processor");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function ensureCompiler(sass) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var sassProcessor, _a;
|
|
||||||
return __generator(this, function (_b) {
|
|
||||||
switch (_b.label) {
|
|
||||||
case 0:
|
|
||||||
_a = sass;
|
|
||||||
if (_a) return [3 /*break*/, 2];
|
|
||||||
return [4 /*yield*/, requireSass()];
|
|
||||||
case 1:
|
|
||||||
_a = (_b.sent());
|
|
||||||
_b.label = 2;
|
|
||||||
case 2:
|
|
||||||
sassProcessor = _a;
|
|
||||||
if (!("compileAsync" in sassProcessor)) {
|
|
||||||
throw new Error("You have to install `sass` package! Or provide an object which implements `compileAsync` as `sass` option");
|
|
||||||
}
|
|
||||||
return [2 /*return*/, sassProcessor];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var isPostCssCompatible = function (result) {
|
|
||||||
return result && typeof result === "object" && "process" in result && typeof result.process === "function";
|
|
||||||
};
|
|
||||||
var compileSass = function (sassPath, outWatchList, _a) {
|
|
||||||
var outputExt = _a.outputExt, sass = _a.sass, postProcessor = _a.postProcessor, loadPaths = _a.loadPaths, sourceMap = _a.sourceMap, sassOptions = _a.sassOptions;
|
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var sassProcessor, watchListNeeded, compiled, css, mapObject, sources, map, result, _b, _c;
|
|
||||||
return __generator(this, function (_d) {
|
|
||||||
switch (_d.label) {
|
|
||||||
case 0:
|
|
||||||
if (!sassPath) {
|
|
||||||
return [2 /*return*/, { css: "", map: "" }];
|
|
||||||
}
|
|
||||||
return [4 /*yield*/, ensureCompiler(sass)];
|
|
||||||
case 1:
|
|
||||||
sassProcessor = _d.sent();
|
|
||||||
watchListNeeded = Array.isArray(outWatchList);
|
|
||||||
return [4 /*yield*/, sassProcessor.compileAsync(sassPath, __assign({ loadPaths: loadPaths, style: "expanded", sourceMap: !!sourceMap || watchListNeeded, sourceMapIncludeSources: !!sourceMap || watchListNeeded }, (sassOptions || [])))];
|
|
||||||
case 2:
|
|
||||||
compiled = _d.sent();
|
|
||||||
css = compiled.css.toString();
|
|
||||||
if (watchListNeeded && compiled.sourceMap && typeof compiled.sourceMap === "object") {
|
|
||||||
mapObject = "toJSON" in compiled.sourceMap && typeof compiled.sourceMap.toJSON === "function"
|
|
||||||
? compiled.sourceMap.toJSON()
|
|
||||||
: compiled.sourceMap;
|
|
||||||
sources = mapObject.sources || mapObject._sources;
|
|
||||||
outWatchList.push.apply(outWatchList, sources.filter(function (s) { return s && typeof s === "string"; }));
|
|
||||||
}
|
|
||||||
map = compiled.sourceMap
|
|
||||||
? typeof compiled.sourceMap === "object"
|
|
||||||
? JSON.stringify(compiled.sourceMap)
|
|
||||||
: compiled.sourceMap
|
|
||||||
: "";
|
|
||||||
if (!(typeof postProcessor === "function")) return [3 /*break*/, 7];
|
|
||||||
return [4 /*yield*/, postProcessor(css, map)];
|
|
||||||
case 3:
|
|
||||||
result = _d.sent();
|
|
||||||
if ((typeof result !== "string" && typeof result !== "object") || result === null) {
|
|
||||||
throw new Error("`postProcessor` must return string, object with `css` and `map` or PostCSS like object which implements `process` function");
|
|
||||||
}
|
|
||||||
_b = formatProcessedToCSS;
|
|
||||||
if (!isPostCssCompatible(result) // If PostCSS compatible result
|
|
||||||
) return [3 /*break*/, 5]; // If PostCSS compatible result
|
|
||||||
return [4 /*yield*/, Promise.resolve(result.process(css, {
|
|
||||||
from: sassPath,
|
|
||||||
to: path.parse(sassPath).name + outputExt,
|
|
||||||
map: map ? { prev: map, inline: false } : null,
|
|
||||||
}))];
|
|
||||||
case 4:
|
|
||||||
_c = _d.sent();
|
|
||||||
return [3 /*break*/, 6];
|
|
||||||
case 5:
|
|
||||||
_c = result;
|
|
||||||
_d.label = 6;
|
|
||||||
case 6: return [2 /*return*/, _b.apply(void 0, [_c, sourceMap])];
|
|
||||||
case 7: return [2 /*return*/, { css: css, map: sourceMap ? map : undefined }];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var PLUGIN_NAME = "keep-css-imports";
|
|
||||||
var FILE_URL_PREFIX = new URL("file://").toString();
|
|
||||||
var KEY_EXT_STRING = ".[keep-css-imports-plugin-ext]";
|
|
||||||
|
|
||||||
var createErrorMessage = function (message) { return "[".concat(PLUGIN_NAME, "] ").concat(message); };
|
|
||||||
var ImportUpdater = /** @class */ (function () {
|
|
||||||
function ImportUpdater(pluginContext, outputOptions) {
|
|
||||||
var _this = this;
|
|
||||||
this.addImportAndGetNewId = function (resolvedId) {
|
|
||||||
var moduleIndex = _this._pluginContext.allStyleImports.indexOf(resolvedId);
|
|
||||||
return !~moduleIndex ? _this._pluginContext.allStyleImports.push(resolvedId) - 1 : moduleIndex;
|
|
||||||
};
|
|
||||||
this._pluginContext = pluginContext;
|
|
||||||
this._outputOptions = outputOptions;
|
|
||||||
}
|
|
||||||
ImportUpdater.prototype.getMagicId = function (id) {
|
|
||||||
return "\0" + this.addImportAndGetNewId(id) + KEY_EXT_STRING;
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateImports = function (code, chunk, bundleOutDir, moduleRoot) {
|
|
||||||
var _this = this;
|
|
||||||
var magicString = new MagicString(code);
|
|
||||||
var matchRegex = new RegExp("\0([^\"']+)".concat(escapeRegex(KEY_EXT_STRING)), "g");
|
|
||||||
Array.from(code.matchAll(matchRegex))
|
|
||||||
.reverse()
|
|
||||||
.forEach(function (m) {
|
|
||||||
return _this.updateMatchedImport(m, magicString, {
|
|
||||||
chunk: chunk,
|
|
||||||
bundleOutDir: bundleOutDir,
|
|
||||||
moduleRoot: moduleRoot,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: magicString.toString(),
|
|
||||||
map: magicString.generateMap({ hires: true }),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateMatchedImport = function (m, magicString, chunkDetails) {
|
|
||||||
var importId = m[0];
|
|
||||||
var assetId = this._pluginContext.allStyleImports[m[1]];
|
|
||||||
if (!assetId || typeof assetId !== "string" || !this._pluginContext.stylesToEmit[assetId]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var updatedImport = this.saveAndGetUpdatedImportPath(assetId, chunkDetails);
|
|
||||||
var start = m.index;
|
|
||||||
var end = start + importId.length;
|
|
||||||
magicString.overwrite(start, end, updatedImport);
|
|
||||||
this.updateChunk(importId, updatedImport, chunkDetails.chunk);
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateChunk = function (importId, updatedImport, chunk) {
|
|
||||||
if (chunk.importedBindings[importId]) {
|
|
||||||
chunk.importedBindings[updatedImport] = chunk.importedBindings[importId];
|
|
||||||
if (updatedImport !== importId) {
|
|
||||||
delete chunk.importedBindings[importId];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var importIndex = chunk.imports.indexOf(importId);
|
|
||||||
if (~importIndex) {
|
|
||||||
chunk.imports[importIndex] = updatedImport;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.saveAndGetUpdatedImportPath = function (assetId, _a) {
|
|
||||||
var bundleOutDir = _a.bundleOutDir, moduleRoot = _a.moduleRoot, chunk = _a.chunk;
|
|
||||||
var assetOutput = this.resolveOutputPath(bundleOutDir, assetId, moduleRoot);
|
|
||||||
var updatedImport = path
|
|
||||||
.relative(path.dirname(path.resolve(bundleOutDir, chunk.fileName)), assetOutput)
|
|
||||||
.replace(/\\/g, "/");
|
|
||||||
this._pluginContext.stylesToEmit[assetId].output = path.relative(path.resolve(bundleOutDir), assetOutput);
|
|
||||||
if (this.shouldAddPrefixCurrentDir(updatedImport) &&
|
|
||||||
!updatedImport.startsWith("./") &&
|
|
||||||
!updatedImport.startsWith("../") &&
|
|
||||||
!updatedImport.match(/^[a-zA-Z]:/)) {
|
|
||||||
updatedImport = "./" + updatedImport;
|
|
||||||
}
|
|
||||||
return updatedImport;
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.shouldAddPrefixCurrentDir = function (updatedImport) {
|
|
||||||
var skip = this._outputOptions.skipCurrentFolderPart;
|
|
||||||
return !skip || (skip instanceof RegExp && !skip.test(updatedImport));
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.resolveOutputPath = function (bundleOutDir, assetId, moduleRoot) {
|
|
||||||
var _a = this._outputOptions, outputPath = _a.outputPath, outputDir = _a.outputDir, outputExt = _a.outputExt;
|
|
||||||
var newPath = undefined;
|
|
||||||
if (typeof outputPath === "function") {
|
|
||||||
newPath = outputPath(assetId);
|
|
||||||
assertLocation(bundleOutDir, newPath);
|
|
||||||
}
|
|
||||||
else if (typeof outputPath === "string") {
|
|
||||||
newPath = path.resolve(bundleOutDir, outputDir, outputPath !== "keep" ? outputPath : path.relative(moduleRoot, assetId));
|
|
||||||
assertLocation(bundleOutDir, newPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(createErrorMessage("Invalid outputPath option value!"));
|
|
||||||
}
|
|
||||||
return newPath.replace(/\.s[ca]ss$/, outputExt);
|
|
||||||
};
|
|
||||||
return ImportUpdater;
|
|
||||||
}());
|
|
||||||
|
|
||||||
var ensureStylesInfo = function (stylesMap, importer, resolvedId) {
|
|
||||||
stylesMap[resolvedId] = stylesMap[resolvedId] || { importers: [], watchList: [] };
|
|
||||||
stylesMap[resolvedId].importers.push(importer);
|
|
||||||
return stylesMap[resolvedId];
|
|
||||||
};
|
|
||||||
var ensureCodeAndWatchList = function (filePath, stylesInfo, isWatch, compilerOptions) {
|
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var outWatchList, _a, _b, css, map;
|
|
||||||
return __generator(this, function (_c) {
|
|
||||||
switch (_c.label) {
|
|
||||||
case 0:
|
|
||||||
outWatchList = [];
|
|
||||||
if (!filePath.endsWith(".css")) return [3 /*break*/, 2];
|
|
||||||
_a = stylesInfo;
|
|
||||||
return [4 /*yield*/, readFile(filePath, "utf8")];
|
|
||||||
case 1:
|
|
||||||
_a.css = _c.sent();
|
|
||||||
return [3 /*break*/, 4];
|
|
||||||
case 2: return [4 /*yield*/, compileSass(filePath, isWatch ? outWatchList : undefined, compilerOptions)];
|
|
||||||
case 3:
|
|
||||||
_b = _c.sent(), css = _b.css, map = _b.map;
|
|
||||||
stylesInfo.css = css;
|
|
||||||
stylesInfo.map = map;
|
|
||||||
_c.label = 4;
|
|
||||||
case 4:
|
|
||||||
outWatchList.push(filePath);
|
|
||||||
stylesInfo.watchList = outWatchList.map(function (watchFile) { return path.resolve(watchFile.replace(FILE_URL_PREFIX, "")); });
|
|
||||||
return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
function keepCssImports(_a) {
|
|
||||||
if (_a === void 0) { _a = {}; }
|
|
||||||
var _b = _a.outputExt, outputExt = _b === void 0 ? ".css" : _b, _c = _a.outputPath, outputPath = _c === void 0 ? "keep" : _c, _d = _a.skipCurrentFolderPart, skipCurrentFolderPart = _d === void 0 ? false : _d, _e = _a.includeRegexp, includeRegexp = _e === void 0 ? /\.(?:s[ca]|c)ss$/ : _e, sass = _a.sass, postProcessor = _a.postProcessor, sassOptions = _a.sassOptions, options = __rest(_a, ["outputExt", "outputPath", "skipCurrentFolderPart", "includeRegexp", "sass", "postProcessor", "sassOptions"]);
|
|
||||||
var stylesOutputOptions = {
|
|
||||||
outputPath: outputPath,
|
|
||||||
outputExt: outputExt,
|
|
||||||
outputDir: options.outputDir ? path.resolve(options.outputDir) : "./",
|
|
||||||
skipCurrentFolderPart: skipCurrentFolderPart,
|
|
||||||
};
|
|
||||||
var context = {
|
|
||||||
allStyleImports: [],
|
|
||||||
modulesWithCss: new Set(),
|
|
||||||
stylesToEmit: {},
|
|
||||||
};
|
|
||||||
var importUpdater = new ImportUpdater(context, stylesOutputOptions);
|
|
||||||
var loadPaths = options.includePaths || ["node_modules/"];
|
|
||||||
loadPaths.push(process.cwd());
|
|
||||||
loadPaths = loadPaths.filter(function (v, i, a) { return a.indexOf(v) === i; });
|
|
||||||
var compilerOptions = {
|
|
||||||
outputExt: outputExt,
|
|
||||||
sass: sass,
|
|
||||||
postProcessor: typeof postProcessor === "function"
|
|
||||||
? function (css, map) { return postProcessor(css, map, context.stylesToEmit); }
|
|
||||||
: undefined,
|
|
||||||
loadPaths: loadPaths,
|
|
||||||
sourceMap: !!options.sourceMap,
|
|
||||||
sassOptions: sassOptions,
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
name: PLUGIN_NAME,
|
|
||||||
resolveId: function (source, importer, resolveOptions) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var _a, custom, _b, _c, _d, _e, _f, alreadyResolving, resolved, styleInfo;
|
|
||||||
var _g, _h;
|
|
||||||
var _this = this;
|
|
||||||
return __generator(this, function (_j) {
|
|
||||||
switch (_j.label) {
|
|
||||||
case 0:
|
|
||||||
if (!importer || !includeRegexp.test(source) || /\0/.test(source)) {
|
|
||||||
return [2 /*return*/, null];
|
|
||||||
}
|
|
||||||
_a = resolveOptions.custom, custom = _a === void 0 ? {} : _a;
|
|
||||||
_b = custom, _c = PLUGIN_NAME, _d = _b[_c], _e = _d === void 0 ? {} : _d, _f = _e.resolving, alreadyResolving = _f === void 0 ? false : _f;
|
|
||||||
if (alreadyResolving) {
|
|
||||||
return [2 /*return*/, null];
|
|
||||||
}
|
|
||||||
return [4 /*yield*/, this.resolve(source, importer, __assign(__assign({ skipSelf: true }, resolveOptions), { custom: __assign(__assign({}, custom), (_g = {}, _g[PLUGIN_NAME] = __assign(__assign({}, custom[PLUGIN_NAME]), { resolving: true }), _g)) }))];
|
|
||||||
case 1:
|
|
||||||
resolved = _j.sent();
|
|
||||||
if (!resolved || resolved.external) {
|
|
||||||
return [2 /*return*/, resolved];
|
|
||||||
}
|
|
||||||
context.modulesWithCss.add(importer);
|
|
||||||
styleInfo = ensureStylesInfo(context.stylesToEmit, importer, resolved.id);
|
|
||||||
return [4 /*yield*/, ensureCodeAndWatchList(resolved.id, styleInfo, this.meta.watchMode, compilerOptions)];
|
|
||||||
case 2:
|
|
||||||
_j.sent();
|
|
||||||
styleInfo.watchList.forEach(function (watchFile) {
|
|
||||||
_this.addWatchFile(watchFile);
|
|
||||||
});
|
|
||||||
return [2 /*return*/, {
|
|
||||||
id: importUpdater.getMagicId(resolved.id),
|
|
||||||
meta: (_h = {}, _h[PLUGIN_NAME] = { sourceId: resolved.id }, _h),
|
|
||||||
external: true,
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buildStart: function () {
|
|
||||||
var _this = this;
|
|
||||||
// Every rebuild will refresh watcher, so we need to reattach
|
|
||||||
if (this.meta.watchMode) {
|
|
||||||
var allWatched_1 = this.getWatchFiles();
|
|
||||||
Object.values(context.stylesToEmit).forEach(function (styleInfo) {
|
|
||||||
return styleInfo.watchList.forEach(function (watchFile) {
|
|
||||||
if (!allWatched_1.find(function (watched) { return path.normalize(watched) === path.normalize(watchFile); })) {
|
|
||||||
_this.addWatchFile(watchFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watchChange: function (id) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var resolvedId, filesToUpdate;
|
|
||||||
var _this = this;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
switch (_a.label) {
|
|
||||||
case 0:
|
|
||||||
resolvedId = path.resolve(id);
|
|
||||||
filesToUpdate = Object.entries(context.stylesToEmit).filter(function (_a) {
|
|
||||||
var styleInfo = _a[1];
|
|
||||||
return styleInfo.watchList.includes(resolvedId);
|
|
||||||
});
|
|
||||||
return [4 /*yield*/, Promise.all(filesToUpdate.map(function (_a) {
|
|
||||||
var fileName = _a[0], styleInfo = _a[1];
|
|
||||||
return ensureCodeAndWatchList(fileName, styleInfo, _this.meta.watchMode, compilerOptions);
|
|
||||||
}))];
|
|
||||||
case 1:
|
|
||||||
_a.sent();
|
|
||||||
return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
renderChunk: function (code, chunk, outputOptions) {
|
|
||||||
var bundleOutDir = path.resolve(outputOptions.dir || path.dirname(outputOptions.file));
|
|
||||||
// Always do it, otherwise some modules are missed
|
|
||||||
var moduleRoot = outputOptions.preserveModulesRoot || process.cwd();
|
|
||||||
return importUpdater.updateImports(code, chunk, bundleOutDir, moduleRoot);
|
|
||||||
},
|
|
||||||
generateBundle: function (_, __, isWrite) {
|
|
||||||
if (!isWrite) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assertDuplicates(context.stylesToEmit);
|
|
||||||
for (var file in context.stylesToEmit) {
|
|
||||||
var stylesInfo = context.stylesToEmit[file];
|
|
||||||
var fileName = stylesInfo.output;
|
|
||||||
var source = file.endsWith(".css")
|
|
||||||
? stylesInfo.css
|
|
||||||
: ensureSourceMap(stylesInfo, options.sourceMap || (sassOptions === null || sassOptions === void 0 ? void 0 : sassOptions.sourceMap), fileName, this.emitFile);
|
|
||||||
this.emitFile({
|
|
||||||
type: "asset",
|
|
||||||
fileName: fileName,
|
|
||||||
source: source,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export { keepCssImports as default };
|
|
||||||
|
|
@ -1,489 +0,0 @@
|
||||||
import { readFile } from 'fs/promises';
|
|
||||||
import * as path from 'path';
|
|
||||||
import MagicString from 'magic-string';
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
Copyright (c) Microsoft Corporation.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
||||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
||||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
||||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
***************************************************************************** */
|
|
||||||
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
||||||
|
|
||||||
|
|
||||||
var __assign = function () {
|
|
||||||
__assign = Object.assign || function __assign(t) {
|
|
||||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
||||||
s = arguments[i];
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
return __assign.apply(this, arguments);
|
|
||||||
};
|
|
||||||
|
|
||||||
function __rest(s, e) {
|
|
||||||
var t = {};
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
||||||
t[p] = s[p];
|
|
||||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
||||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
||||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
||||||
t[p[i]] = s[p[i]];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
function __awaiter(thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function __generator(thisArg, body) {
|
|
||||||
var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
||||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
||||||
function step(op) {
|
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
|
||||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
||||||
switch (op[0]) {
|
|
||||||
case 0: case 1: t = op; break;
|
|
||||||
case 4: _.label++; return { value: op[1], done: false };
|
|
||||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
||||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
||||||
default:
|
|
||||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
||||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
||||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
||||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
||||||
if (t[2]) _.ops.pop();
|
|
||||||
_.trys.pop(); continue;
|
|
||||||
}
|
|
||||||
op = body.call(thisArg, _);
|
|
||||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
||||||
var e = new Error(message);
|
|
||||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
||||||
};
|
|
||||||
|
|
||||||
var escapeRegex = function (val) { return val.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&"); };
|
|
||||||
var assertDuplicates = function (stylesToEmit) {
|
|
||||||
Object.values(stylesToEmit).forEach(function (v, i, all) {
|
|
||||||
if (all.some(function (av, ai) { return !!v.output && v.output === av.output && ai != i; })) {
|
|
||||||
throw new Error("Two or more assets have conflicting output path ".concat(v.output));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var assertLocation = function (outDir, assetPath) {
|
|
||||||
if (!path.normalize(assetPath).startsWith(path.normalize(outDir))) {
|
|
||||||
throw new Error("Output path ".concat(assetPath, " must be in output directory ").concat(outDir));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var ensureSourceMap = function (_a, includeSourceMap, fileName, onEmit) {
|
|
||||||
var css = _a.css, map = _a.map;
|
|
||||||
if (map) {
|
|
||||||
if (includeSourceMap === "inline") {
|
|
||||||
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat((map instanceof Uint8Array ? Buffer.from(map) : Buffer.from(map, "utf8")).toString("base64"), "*/");
|
|
||||||
}
|
|
||||||
else if (includeSourceMap === true) {
|
|
||||||
css += "\n/*# sourceMappingURL=".concat(path.basename(fileName), ".map */");
|
|
||||||
}
|
|
||||||
if (includeSourceMap === true) {
|
|
||||||
onEmit({
|
|
||||||
type: "asset",
|
|
||||||
fileName: fileName + ".map",
|
|
||||||
source: map,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return css;
|
|
||||||
};
|
|
||||||
var formatProcessedToCSS = function (input, sourceMap) {
|
|
||||||
return typeof input === "string"
|
|
||||||
? { css: input, map: "" }
|
|
||||||
: typeof input === "object"
|
|
||||||
? {
|
|
||||||
css: input.css,
|
|
||||||
map: !sourceMap ? "" : typeof input.map === "object" ? JSON.stringify(input.map) : input.map,
|
|
||||||
}
|
|
||||||
: input;
|
|
||||||
};
|
|
||||||
var requireSass = function () {
|
|
||||||
try {
|
|
||||||
return import('sass');
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
throw new Error("You have to install `sass` package! Try running\n\t" +
|
|
||||||
"npm install --save-dev sass\nor\nyarn add sass --dev\n" +
|
|
||||||
"or use `sass` option to pass processor");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function ensureCompiler(sass) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var sassProcessor, _a;
|
|
||||||
return __generator(this, function (_b) {
|
|
||||||
switch (_b.label) {
|
|
||||||
case 0:
|
|
||||||
_a = sass;
|
|
||||||
if (_a) return [3 /*break*/, 2];
|
|
||||||
return [4 /*yield*/, requireSass()];
|
|
||||||
case 1:
|
|
||||||
_a = (_b.sent());
|
|
||||||
_b.label = 2;
|
|
||||||
case 2:
|
|
||||||
sassProcessor = _a;
|
|
||||||
if (!("compileAsync" in sassProcessor)) {
|
|
||||||
throw new Error("You have to install `sass` package! Or provide an object which implements `compileAsync` as `sass` option");
|
|
||||||
}
|
|
||||||
return [2 /*return*/, sassProcessor];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var isPostCssCompatible = function (result) {
|
|
||||||
return result && typeof result === "object" && "process" in result && typeof result.process === "function";
|
|
||||||
};
|
|
||||||
var compileSass = function (sassPath, outWatchList, _a) {
|
|
||||||
var outputExt = _a.outputExt, sass = _a.sass, postProcessor = _a.postProcessor, loadPaths = _a.loadPaths, sourceMap = _a.sourceMap, sassOptions = _a.sassOptions;
|
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var sassProcessor, watchListNeeded, compiled, css, mapObject, sources, map, result, _b, _c;
|
|
||||||
return __generator(this, function (_d) {
|
|
||||||
switch (_d.label) {
|
|
||||||
case 0:
|
|
||||||
if (!sassPath) {
|
|
||||||
return [2 /*return*/, { css: "", map: "" }];
|
|
||||||
}
|
|
||||||
return [4 /*yield*/, ensureCompiler(sass)];
|
|
||||||
case 1:
|
|
||||||
sassProcessor = _d.sent();
|
|
||||||
watchListNeeded = Array.isArray(outWatchList);
|
|
||||||
return [4 /*yield*/, sassProcessor.compileAsync(sassPath, __assign({ loadPaths: loadPaths, style: "expanded", sourceMap: !!sourceMap || watchListNeeded, sourceMapIncludeSources: !!sourceMap || watchListNeeded }, (sassOptions || [])))];
|
|
||||||
case 2:
|
|
||||||
compiled = _d.sent();
|
|
||||||
css = compiled.css.toString();
|
|
||||||
if (watchListNeeded && compiled.sourceMap && typeof compiled.sourceMap === "object") {
|
|
||||||
mapObject = "toJSON" in compiled.sourceMap && typeof compiled.sourceMap.toJSON === "function"
|
|
||||||
? compiled.sourceMap.toJSON()
|
|
||||||
: compiled.sourceMap;
|
|
||||||
sources = mapObject.sources || mapObject._sources;
|
|
||||||
outWatchList.push.apply(outWatchList, sources.filter(function (s) { return s && typeof s === "string"; }));
|
|
||||||
}
|
|
||||||
map = compiled.sourceMap
|
|
||||||
? typeof compiled.sourceMap === "object"
|
|
||||||
? JSON.stringify(compiled.sourceMap)
|
|
||||||
: compiled.sourceMap
|
|
||||||
: "";
|
|
||||||
if (!(typeof postProcessor === "function")) return [3 /*break*/, 7];
|
|
||||||
return [4 /*yield*/, postProcessor(css, map)];
|
|
||||||
case 3:
|
|
||||||
result = _d.sent();
|
|
||||||
if ((typeof result !== "string" && typeof result !== "object") || result === null) {
|
|
||||||
throw new Error("`postProcessor` must return string, object with `css` and `map` or PostCSS like object which implements `process` function");
|
|
||||||
}
|
|
||||||
_b = formatProcessedToCSS;
|
|
||||||
if (!isPostCssCompatible(result) // If PostCSS compatible result
|
|
||||||
) return [3 /*break*/, 5]; // If PostCSS compatible result
|
|
||||||
return [4 /*yield*/, Promise.resolve(result.process(css, {
|
|
||||||
from: sassPath,
|
|
||||||
to: path.parse(sassPath).name + outputExt,
|
|
||||||
map: map ? { prev: map, inline: false } : null,
|
|
||||||
}))];
|
|
||||||
case 4:
|
|
||||||
_c = _d.sent();
|
|
||||||
return [3 /*break*/, 6];
|
|
||||||
case 5:
|
|
||||||
_c = result;
|
|
||||||
_d.label = 6;
|
|
||||||
case 6: return [2 /*return*/, _b.apply(void 0, [_c, sourceMap])];
|
|
||||||
case 7: return [2 /*return*/, { css: css, map: sourceMap ? map : undefined }];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var PLUGIN_NAME = "keep-css-imports";
|
|
||||||
var FILE_URL_PREFIX = new URL("file://").toString();
|
|
||||||
var KEY_EXT_STRING = ".[keep-css-imports-plugin-ext]";
|
|
||||||
|
|
||||||
var createErrorMessage = function (message) { return "[".concat(PLUGIN_NAME, "] ").concat(message); };
|
|
||||||
var ImportUpdater = /** @class */ (function () {
|
|
||||||
function ImportUpdater(pluginContext, outputOptions) {
|
|
||||||
var _this = this;
|
|
||||||
this.addImportAndGetNewId = function (resolvedId) {
|
|
||||||
var moduleIndex = _this._pluginContext.allStyleImports.indexOf(resolvedId);
|
|
||||||
return !~moduleIndex ? _this._pluginContext.allStyleImports.push(resolvedId) - 1 : moduleIndex;
|
|
||||||
};
|
|
||||||
this._pluginContext = pluginContext;
|
|
||||||
this._outputOptions = outputOptions;
|
|
||||||
}
|
|
||||||
ImportUpdater.prototype.getMagicId = function (id) {
|
|
||||||
return "\0" + this.addImportAndGetNewId(id) + KEY_EXT_STRING;
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateImports = function (code, chunk, bundleOutDir, moduleRoot) {
|
|
||||||
var _this = this;
|
|
||||||
var magicString = new MagicString(code);
|
|
||||||
var matchRegex = new RegExp("\0([^\"']+)".concat(escapeRegex(KEY_EXT_STRING)), "g");
|
|
||||||
Array.from(code.matchAll(matchRegex))
|
|
||||||
.reverse()
|
|
||||||
.forEach(function (m) {
|
|
||||||
return _this.updateMatchedImport(m, magicString, {
|
|
||||||
chunk: chunk,
|
|
||||||
bundleOutDir: bundleOutDir,
|
|
||||||
moduleRoot: moduleRoot,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: magicString.toString(),
|
|
||||||
map: magicString.generateMap({ hires: true }),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateMatchedImport = function (m, magicString, chunkDetails) {
|
|
||||||
var importId = m[0];
|
|
||||||
var assetId = this._pluginContext.allStyleImports[m[1]];
|
|
||||||
if (!assetId || typeof assetId !== "string" || !this._pluginContext.stylesToEmit[assetId]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var updatedImport = this.saveAndGetUpdatedImportPath(assetId, chunkDetails);
|
|
||||||
var start = m.index;
|
|
||||||
var end = start + importId.length;
|
|
||||||
magicString.overwrite(start, end, updatedImport);
|
|
||||||
this.updateChunk(importId, updatedImport, chunkDetails.chunk);
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.updateChunk = function (importId, updatedImport, chunk) {
|
|
||||||
if (chunk.importedBindings[importId]) {
|
|
||||||
chunk.importedBindings[updatedImport] = chunk.importedBindings[importId];
|
|
||||||
if (updatedImport !== importId) {
|
|
||||||
delete chunk.importedBindings[importId];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var importIndex = chunk.imports.indexOf(importId);
|
|
||||||
if (~importIndex) {
|
|
||||||
chunk.imports[importIndex] = updatedImport;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.saveAndGetUpdatedImportPath = function (assetId, _a) {
|
|
||||||
var bundleOutDir = _a.bundleOutDir, moduleRoot = _a.moduleRoot, chunk = _a.chunk;
|
|
||||||
var assetOutput = this.resolveOutputPath(bundleOutDir, assetId, moduleRoot);
|
|
||||||
var updatedImport = path
|
|
||||||
.relative(path.dirname(path.resolve(bundleOutDir, chunk.fileName)), assetOutput)
|
|
||||||
.replace(/\\/g, "/");
|
|
||||||
this._pluginContext.stylesToEmit[assetId].output = path.relative(path.resolve(bundleOutDir), assetOutput);
|
|
||||||
if (this.shouldAddPrefixCurrentDir(updatedImport) &&
|
|
||||||
!updatedImport.startsWith("./") &&
|
|
||||||
!updatedImport.startsWith("../") &&
|
|
||||||
!updatedImport.match(/^[a-zA-Z]:/)) {
|
|
||||||
updatedImport = "./" + updatedImport;
|
|
||||||
}
|
|
||||||
return updatedImport;
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.shouldAddPrefixCurrentDir = function (updatedImport) {
|
|
||||||
var skip = this._outputOptions.skipCurrentFolderPart;
|
|
||||||
return !skip || (skip instanceof RegExp && !skip.test(updatedImport));
|
|
||||||
};
|
|
||||||
ImportUpdater.prototype.resolveOutputPath = function (bundleOutDir, assetId, moduleRoot) {
|
|
||||||
var _a = this._outputOptions, outputPath = _a.outputPath, outputDir = _a.outputDir, outputExt = _a.outputExt;
|
|
||||||
var newPath = undefined;
|
|
||||||
if (typeof outputPath === "function") {
|
|
||||||
newPath = outputPath(assetId);
|
|
||||||
assertLocation(bundleOutDir, newPath);
|
|
||||||
}
|
|
||||||
else if (typeof outputPath === "string") {
|
|
||||||
newPath = path.resolve(bundleOutDir, outputDir, outputPath !== "keep" ? outputPath : path.relative(moduleRoot, assetId));
|
|
||||||
assertLocation(bundleOutDir, newPath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(createErrorMessage("Invalid outputPath option value!"));
|
|
||||||
}
|
|
||||||
return newPath.replace(/\.s[ca]ss$/, outputExt);
|
|
||||||
};
|
|
||||||
return ImportUpdater;
|
|
||||||
}());
|
|
||||||
|
|
||||||
var ensureStylesInfo = function (stylesMap, importer, resolvedId) {
|
|
||||||
stylesMap[resolvedId] = stylesMap[resolvedId] || { importers: [], watchList: [] };
|
|
||||||
stylesMap[resolvedId].importers.push(importer);
|
|
||||||
return stylesMap[resolvedId];
|
|
||||||
};
|
|
||||||
var ensureCodeAndWatchList = function (filePath, stylesInfo, isWatch, compilerOptions) {
|
|
||||||
return __awaiter(void 0, void 0, void 0, function () {
|
|
||||||
var outWatchList, _a, _b, css, map;
|
|
||||||
return __generator(this, function (_c) {
|
|
||||||
switch (_c.label) {
|
|
||||||
case 0:
|
|
||||||
outWatchList = [];
|
|
||||||
if (!filePath.endsWith(".css")) return [3 /*break*/, 2];
|
|
||||||
_a = stylesInfo;
|
|
||||||
return [4 /*yield*/, readFile(filePath, "utf8")];
|
|
||||||
case 1:
|
|
||||||
_a.css = _c.sent();
|
|
||||||
return [3 /*break*/, 4];
|
|
||||||
case 2: return [4 /*yield*/, compileSass(filePath, isWatch ? outWatchList : undefined, compilerOptions)];
|
|
||||||
case 3:
|
|
||||||
_b = _c.sent(), css = _b.css, map = _b.map;
|
|
||||||
stylesInfo.css = css;
|
|
||||||
stylesInfo.map = map;
|
|
||||||
_c.label = 4;
|
|
||||||
case 4:
|
|
||||||
outWatchList.push(filePath);
|
|
||||||
stylesInfo.watchList = outWatchList.map(function (watchFile) { return path.resolve(watchFile.replace(FILE_URL_PREFIX, "")); });
|
|
||||||
return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
function keepCssImports(_a) {
|
|
||||||
if (_a === void 0) { _a = {}; }
|
|
||||||
var _b = _a.outputExt, outputExt = _b === void 0 ? ".css" : _b, _c = _a.outputPath, outputPath = _c === void 0 ? "keep" : _c, _d = _a.skipCurrentFolderPart, skipCurrentFolderPart = _d === void 0 ? false : _d, _e = _a.includeRegexp, includeRegexp = _e === void 0 ? /\.(?:s[ca]|c)ss$/ : _e, sass = _a.sass, postProcessor = _a.postProcessor, sassOptions = _a.sassOptions, options = __rest(_a, ["outputExt", "outputPath", "skipCurrentFolderPart", "includeRegexp", "sass", "postProcessor", "sassOptions"]);
|
|
||||||
var stylesOutputOptions = {
|
|
||||||
outputPath: outputPath,
|
|
||||||
outputExt: outputExt,
|
|
||||||
outputDir: options.outputDir ? path.resolve(options.outputDir) : "./",
|
|
||||||
skipCurrentFolderPart: skipCurrentFolderPart,
|
|
||||||
};
|
|
||||||
var context = {
|
|
||||||
allStyleImports: [],
|
|
||||||
modulesWithCss: new Set(),
|
|
||||||
stylesToEmit: {},
|
|
||||||
};
|
|
||||||
var importUpdater = new ImportUpdater(context, stylesOutputOptions);
|
|
||||||
var loadPaths = options.includePaths || ["node_modules/"];
|
|
||||||
loadPaths.push(process.cwd());
|
|
||||||
loadPaths = loadPaths.filter(function (v, i, a) { return a.indexOf(v) === i; });
|
|
||||||
var compilerOptions = {
|
|
||||||
outputExt: outputExt,
|
|
||||||
sass: sass,
|
|
||||||
postProcessor: typeof postProcessor === "function"
|
|
||||||
? function (css, map) { return postProcessor(css, map, context.stylesToEmit); }
|
|
||||||
: undefined,
|
|
||||||
loadPaths: loadPaths,
|
|
||||||
sourceMap: !!options.sourceMap,
|
|
||||||
sassOptions: sassOptions,
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
name: PLUGIN_NAME,
|
|
||||||
resolveId: function (source, importer, resolveOptions) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var _a, custom, _b, _c, _d, _e, _f, alreadyResolving, resolved, styleInfo;
|
|
||||||
var _g, _h;
|
|
||||||
var _this = this;
|
|
||||||
return __generator(this, function (_j) {
|
|
||||||
switch (_j.label) {
|
|
||||||
case 0:
|
|
||||||
if (!importer || !includeRegexp.test(source) || /\0/.test(source)) {
|
|
||||||
return [2 /*return*/, null];
|
|
||||||
}
|
|
||||||
_a = resolveOptions.custom, custom = _a === void 0 ? {} : _a;
|
|
||||||
_b = custom, _c = PLUGIN_NAME, _d = _b[_c], _e = _d === void 0 ? {} : _d, _f = _e.resolving, alreadyResolving = _f === void 0 ? false : _f;
|
|
||||||
if (alreadyResolving) {
|
|
||||||
return [2 /*return*/, null];
|
|
||||||
}
|
|
||||||
return [4 /*yield*/, this.resolve(source, importer, __assign(__assign({ skipSelf: true }, resolveOptions), { custom: __assign(__assign({}, custom), (_g = {}, _g[PLUGIN_NAME] = __assign(__assign({}, custom[PLUGIN_NAME]), { resolving: true }), _g)) }))];
|
|
||||||
case 1:
|
|
||||||
resolved = _j.sent();
|
|
||||||
if (!resolved || resolved.external) {
|
|
||||||
return [2 /*return*/, resolved];
|
|
||||||
}
|
|
||||||
context.modulesWithCss.add(importer);
|
|
||||||
styleInfo = ensureStylesInfo(context.stylesToEmit, importer, resolved.id);
|
|
||||||
return [4 /*yield*/, ensureCodeAndWatchList(resolved.id, styleInfo, this.meta.watchMode, compilerOptions)];
|
|
||||||
case 2:
|
|
||||||
_j.sent();
|
|
||||||
styleInfo.watchList.forEach(function (watchFile) {
|
|
||||||
_this.addWatchFile(watchFile);
|
|
||||||
});
|
|
||||||
return [2 /*return*/, {
|
|
||||||
id: importUpdater.getMagicId(resolved.id),
|
|
||||||
meta: (_h = {}, _h[PLUGIN_NAME] = { sourceId: resolved.id }, _h),
|
|
||||||
external: true,
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buildStart: function () {
|
|
||||||
var _this = this;
|
|
||||||
// Every rebuild will refresh watcher, so we need to reattach
|
|
||||||
if (this.meta.watchMode) {
|
|
||||||
var allWatched_1 = this.getWatchFiles();
|
|
||||||
Object.values(context.stylesToEmit).forEach(function (styleInfo) {
|
|
||||||
return styleInfo.watchList.forEach(function (watchFile) {
|
|
||||||
if (!allWatched_1.find(function (watched) { return path.normalize(watched) === path.normalize(watchFile); })) {
|
|
||||||
_this.addWatchFile(watchFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watchChange: function (id) {
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var resolvedId, filesToUpdate;
|
|
||||||
var _this = this;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
switch (_a.label) {
|
|
||||||
case 0:
|
|
||||||
resolvedId = path.resolve(id);
|
|
||||||
filesToUpdate = Object.entries(context.stylesToEmit).filter(function (_a) {
|
|
||||||
var styleInfo = _a[1];
|
|
||||||
return styleInfo.watchList.includes(resolvedId);
|
|
||||||
});
|
|
||||||
return [4 /*yield*/, Promise.all(filesToUpdate.map(function (_a) {
|
|
||||||
var fileName = _a[0], styleInfo = _a[1];
|
|
||||||
return ensureCodeAndWatchList(fileName, styleInfo, _this.meta.watchMode, compilerOptions);
|
|
||||||
}))];
|
|
||||||
case 1:
|
|
||||||
_a.sent();
|
|
||||||
return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
renderChunk: function (code, chunk, outputOptions) {
|
|
||||||
var bundleOutDir = path.resolve(outputOptions.dir || path.dirname(outputOptions.file));
|
|
||||||
if (code && chunk.modules && Object.keys(chunk.modules).some(function (m) { return context.modulesWithCss.has(m); })) {
|
|
||||||
var moduleRoot = outputOptions.preserveModulesRoot || process.cwd();
|
|
||||||
return importUpdater.updateImports(code, chunk, bundleOutDir, moduleRoot);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
generateBundle: function (_, __, isWrite) {
|
|
||||||
if (!isWrite) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assertDuplicates(context.stylesToEmit);
|
|
||||||
for (var file in context.stylesToEmit) {
|
|
||||||
var stylesInfo = context.stylesToEmit[file];
|
|
||||||
var fileName = stylesInfo.output;
|
|
||||||
var source = file.endsWith(".css")
|
|
||||||
? stylesInfo.css
|
|
||||||
: ensureSourceMap(stylesInfo, options.sourceMap || (sassOptions === null || sassOptions === void 0 ? void 0 : sassOptions.sourceMap), fileName, this.emitFile);
|
|
||||||
this.emitFile({
|
|
||||||
type: "asset",
|
|
||||||
fileName: fileName,
|
|
||||||
source: source,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export { keepCssImports as default };
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
import { type CompilationOptions, PostCssCompatible } from "./compileSass";
|
|
||||||
import type { Options as SassOptions } from "sass";
|
|
||||||
export type KeepCssImportsOptions = OutputOptions & InputOptions & Extensions;
|
|
||||||
export type StyleRefInfo = {
|
|
||||||
/**
|
|
||||||
* Collection of files with reference to the current file
|
|
||||||
*/
|
|
||||||
importers: string[];
|
|
||||||
/**
|
|
||||||
* List of files which are used to render the current file
|
|
||||||
*/
|
|
||||||
watchList: string[];
|
|
||||||
/**
|
|
||||||
* Emit path
|
|
||||||
*/
|
|
||||||
output?: string;
|
|
||||||
/**
|
|
||||||
* Processed CSS content to emit
|
|
||||||
*/
|
|
||||||
css?: string | Uint8Array;
|
|
||||||
/**
|
|
||||||
* Processed CSS content map to emit
|
|
||||||
*/
|
|
||||||
map?: string | Uint8Array;
|
|
||||||
};
|
|
||||||
export type StylesMap = Record<string, StyleRefInfo>;
|
|
||||||
interface Extensions {
|
|
||||||
/**
|
|
||||||
* Customised SASS (SCSS) processor. If not provided plugin will try to
|
|
||||||
* import locally installed `sass` if required
|
|
||||||
*/
|
|
||||||
sass?: CompilationOptions["sass"];
|
|
||||||
/**
|
|
||||||
* An optional object that allows to provide additional options for the
|
|
||||||
* SASS compiler.
|
|
||||||
*/
|
|
||||||
sassOptions?: SassOptions<"async">;
|
|
||||||
/**
|
|
||||||
* Specifies the list of include paths for SASS to search when resolving imports.
|
|
||||||
*
|
|
||||||
* Default: `["node_modules/"]`
|
|
||||||
*/
|
|
||||||
includePaths?: string[];
|
|
||||||
/**
|
|
||||||
* An optional function that allows you to perform additional processing on the
|
|
||||||
* generated CSS, such as applying PostCSS plugins.
|
|
||||||
*/
|
|
||||||
postProcessor?: (css: string, map: string, stylesMap: StylesMap) => Promise<PostCssCompatible | string | {
|
|
||||||
css: string;
|
|
||||||
map?: string;
|
|
||||||
}>;
|
|
||||||
}
|
|
||||||
type OutputPath = string | "keep" | ((assetId: string) => string);
|
|
||||||
export interface OutputOptions {
|
|
||||||
/**
|
|
||||||
* Specifies the file extension for the output CSS files.
|
|
||||||
*
|
|
||||||
* Default: `".css"`
|
|
||||||
*/
|
|
||||||
outputExt?: string;
|
|
||||||
/**
|
|
||||||
* Specifies the output directory for the generated CSS files.
|
|
||||||
* Relative to Rollup output folder.
|
|
||||||
*
|
|
||||||
* Default: `"./"`
|
|
||||||
*/
|
|
||||||
outputDir?: string;
|
|
||||||
/**
|
|
||||||
* Specifies the output path relative to `outputDir` for the generated CSS
|
|
||||||
* files.
|
|
||||||
* The default value, "keep", preserves the original file paths. It is also
|
|
||||||
* possible to provide a custom function to generate output paths based on
|
|
||||||
* the input file.
|
|
||||||
*
|
|
||||||
* Default: `"keep"`
|
|
||||||
*/
|
|
||||||
outputPath?: OutputPath;
|
|
||||||
/**
|
|
||||||
* Specifies whether to generate source maps for the compiled CSS.
|
|
||||||
* Use `"inline"` to inline source maps into CSS files.
|
|
||||||
*
|
|
||||||
* Default: `false`
|
|
||||||
*/
|
|
||||||
sourceMap?: boolean | "inline";
|
|
||||||
/**
|
|
||||||
* By default CSS paths will be prefixed with current folder mark `./`.
|
|
||||||
* To avoid this for CSS files use `true` or specify RegExp filter.
|
|
||||||
*
|
|
||||||
* If RegExp filter matches `./` won't be added to the path.
|
|
||||||
* This option may be helpful if you have some issues with external
|
|
||||||
* modules imports from `node_modules`
|
|
||||||
*
|
|
||||||
* Default: `false`
|
|
||||||
*/
|
|
||||||
skipCurrentFolderPart?: boolean | RegExp;
|
|
||||||
}
|
|
||||||
interface InputOptions {
|
|
||||||
/**
|
|
||||||
* Regular expression to test if an import should be processed by this plugin
|
|
||||||
*
|
|
||||||
* Default: `/\.(?:s[ca]|c)ss$/`
|
|
||||||
*/
|
|
||||||
includeRegexp?: RegExp;
|
|
||||||
}
|
|
||||||
export interface KeepCssImportsPluginContext {
|
|
||||||
allStyleImports: string[];
|
|
||||||
modulesWithCss: Set<string>;
|
|
||||||
stylesToEmit: StylesMap;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
{
|
|
||||||
"name": "rollup-plugin-keep-css-imports",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Rollup plugin that allows to maintain the original structure of style imports without altering them during the bundling process",
|
|
||||||
"main": "dist/index.cjs",
|
|
||||||
"module": "dist/index.mjs",
|
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": {
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"default": "./dist/index.mjs"
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"default": "./dist/index.cjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"README.md",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"rollup",
|
|
||||||
"rollup-plugin",
|
|
||||||
"css-modules",
|
|
||||||
"sass",
|
|
||||||
"scss",
|
|
||||||
"keep",
|
|
||||||
"preserve",
|
|
||||||
"imports"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/SLTKA/rollup-plugin-keep-css-imports",
|
|
||||||
"author": "Alexandr Yeskov",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/SLTKA/rollup-plugin-keep-css-imports"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/SLTKA/rollup-plugin-keep-css-imports/issues"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prebuild": "rimraf -rf dist/",
|
|
||||||
"build": "rollup -c",
|
|
||||||
"test": "mocha",
|
|
||||||
"pretest": "yarn build"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@rollup/plugin-typescript": "^11.1.6",
|
|
||||||
"@types/mocha": "^10.0.6",
|
|
||||||
"@types/node": "^20.11.24",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
||||||
"@typescript-eslint/parser": "^7.1.1",
|
|
||||||
"eslint": "^8.57.0",
|
|
||||||
"eslint-config-prettier": "^9.1.0",
|
|
||||||
"eslint-plugin-mocha": "^10.2.0",
|
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
|
||||||
"mocha": "^10.2.0",
|
|
||||||
"prettier": "^3.2.4",
|
|
||||||
"rimraf": "^5.0.5",
|
|
||||||
"rollup": "^4.9.5",
|
|
||||||
"rollup-plugin-dts": "^6.1.0",
|
|
||||||
"sass": "^1.70.0",
|
|
||||||
"ts-node": "^10.9.2",
|
|
||||||
"typescript": "^5.3.3",
|
|
||||||
"typescript-eslint": "^7.1.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"magic-string": "^0.30.5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
||||||
import { join } from 'path';
|
|
||||||
import { defineConfig } from 'rollup';
|
|
||||||
import { dts } from "rollup-plugin-dts";
|
|
||||||
import { dtsDeprecationWarning, mapModuleId } from '../shared.mjs';
|
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '../../');
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
input: {
|
|
||||||
entry: join(root, './src/editor/editor.main.ts'),
|
|
||||||
editorApi: join(root, './src/editor/editor.api.ts'),
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
dir: join(root, './out/monaco-editor/esm'),
|
|
||||||
format: 'es',
|
|
||||||
preserveModules: false,
|
|
||||||
entryFileNames: function (chunkInfo) {
|
|
||||||
const moduleId = chunkInfo.facadeModuleId;
|
|
||||||
if (moduleId) {
|
|
||||||
const m = mapModuleId(moduleId, '.d.ts');
|
|
||||||
if (m !== undefined) {
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '[name].d.ts';
|
|
||||||
},
|
|
||||||
},
|
|
||||||
external: [/.*\.css/],
|
|
||||||
plugins: [
|
|
||||||
nodeResolve(),
|
|
||||||
dts({
|
|
||||||
compilerOptions: {
|
|
||||||
stripInternal: true,
|
|
||||||
},
|
|
||||||
includeExternal: ['monaco-editor-core', '@vscode/monaco-lsp-client']
|
|
||||||
}),
|
|
||||||
dtsDeprecationWarning(f => f.endsWith('editor.api.d.ts')),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {() => import('rollup').Plugin}
|
|
||||||
*/
|
|
||||||
export function urlToEsmPlugin() {
|
|
||||||
return {
|
|
||||||
name: 'import-meta-url',
|
|
||||||
async transform(code, id) {
|
|
||||||
if (this.environment?.mode === 'dev') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look for `new URL(..., import.meta.url)` patterns.
|
|
||||||
const regex = /new\s+URL\s*\(\s*(['"`])(.*?)\1\s*,\s*import\.meta\.url\s*\)?/g;
|
|
||||||
|
|
||||||
let match;
|
|
||||||
let modified = false;
|
|
||||||
let result = code;
|
|
||||||
let offset = 0;
|
|
||||||
|
|
||||||
while ((match = regex.exec(code)) !== null) {
|
|
||||||
let path = match[2];
|
|
||||||
|
|
||||||
if (!path.startsWith('.') && !path.startsWith('/')) {
|
|
||||||
path = `./${path}`;
|
|
||||||
}
|
|
||||||
const resolved = await this.resolve(path, id);
|
|
||||||
|
|
||||||
if (!resolved) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the file as an entry point
|
|
||||||
const refId = this.emitFile({
|
|
||||||
type: 'chunk',
|
|
||||||
id: resolved.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
const start = match.index;
|
|
||||||
const end = start + match[0].length;
|
|
||||||
|
|
||||||
const replacement = `import.meta.ROLLUP_FILE_URL_OBJ_${refId}`;
|
|
||||||
|
|
||||||
result = result.slice(0, start + offset) + replacement + result.slice(end + offset);
|
|
||||||
offset += replacement.length - (end - start);
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!modified) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
code: result,
|
|
||||||
map: null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
import { join, relative } from 'path';
|
|
||||||
import { defineConfig } from 'rollup';
|
|
||||||
import esbuild from 'rollup-plugin-esbuild';
|
|
||||||
//import { urlToEsmPlugin } from '../rollup-url-to-module-plugin/index.mjs';
|
|
||||||
import del from 'rollup-plugin-delete';
|
|
||||||
import keepCssImports from './rollup-plugin-keep-css-imports/dist/index.mjs';
|
|
||||||
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
||||||
import { urlToEsmPlugin } from './rollup-url-to-module-plugin/index.mjs';
|
|
||||||
import { getNlsEntryPoints, mapModuleId } from '../shared.mjs';
|
|
||||||
import { readFileSync } from 'fs';
|
|
||||||
|
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '../../');
|
|
||||||
const outDir = join(root, './out/monaco-editor/esm');
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
input: {
|
|
||||||
entry: join(root, './src/editor/editor.main.ts'),
|
|
||||||
editorAll: join(root, './src/editor/editor.all.ts'),
|
|
||||||
edcoreMain: join(root, './src/editor/edcore.main.ts'),
|
|
||||||
editorApi: join(root, './src/editor/editor.api.ts'),
|
|
||||||
editorWorker: join(root, './src/editor/editor.worker.ts'),
|
|
||||||
...getNlsEntryPoints(),
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
dir: outDir,
|
|
||||||
format: 'es',
|
|
||||||
|
|
||||||
entryFileNames: function (chunkInfo) {
|
|
||||||
const moduleId = chunkInfo.facadeModuleId;
|
|
||||||
if (moduleId) {
|
|
||||||
const r = mapModuleId(moduleId, '.js');
|
|
||||||
if (r !== undefined) {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '[name].js';
|
|
||||||
},
|
|
||||||
preserveModules: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
del({ targets: outDir, force: true }),
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'copy-codicon-font',
|
|
||||||
generateBundle() {
|
|
||||||
this.emitFile({
|
|
||||||
type: 'asset',
|
|
||||||
fileName: 'vs/base/browser/ui/codicons/codicon/codicon.ttf',
|
|
||||||
source: readFileSync(join(root, 'node_modules/monaco-editor-core/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf'))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
urlToEsmPlugin(),
|
|
||||||
esbuild(),
|
|
||||||
|
|
||||||
keepCssImports({
|
|
||||||
/**
|
|
||||||
* @param {string} assetId
|
|
||||||
*/
|
|
||||||
outputPath: (assetId) => {
|
|
||||||
const r = mapModuleId(assetId, '.css');
|
|
||||||
if (r !== undefined) {
|
|
||||||
return join(outDir, r);
|
|
||||||
}
|
|
||||||
const relativePath = join(outDir, relative(root, assetId));
|
|
||||||
return relativePath.replace(/(\.s[ca]ss)$/, ".min$1")
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
nodeResolve({
|
|
||||||
dedupe: ['monaco-editor-core', '@vscode/monaco-lsp-client'],
|
|
||||||
browser: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
46
build/fillers/vscode-nls.ts
Normal file
46
build/fillers/vscode-nls.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
export interface Options {
|
||||||
|
locale?: string;
|
||||||
|
cacheLanguageResolution?: boolean;
|
||||||
|
}
|
||||||
|
export interface LocalizeInfo {
|
||||||
|
key: string;
|
||||||
|
comment: string[];
|
||||||
|
}
|
||||||
|
export interface LocalizeFunc {
|
||||||
|
(info: LocalizeInfo, message: string, ...args: any[]): string;
|
||||||
|
(key: string, message: string, ...args: any[]): string;
|
||||||
|
}
|
||||||
|
export interface LoadFunc {
|
||||||
|
(file?: string): LocalizeFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
function format(message: string, args: any[]): string {
|
||||||
|
let result: string;
|
||||||
|
|
||||||
|
if (args.length === 0) {
|
||||||
|
result = message;
|
||||||
|
} else {
|
||||||
|
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
||||||
|
let index = rest[0];
|
||||||
|
return typeof args[index] !== 'undefined' ? args[index] : match;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function localize(key: string | LocalizeInfo, message: string, ...args: any[]): string {
|
||||||
|
return format(message, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loadMessageBundle(file?: string): LocalizeFunc {
|
||||||
|
return localize;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function config(opt?: Options | string): LoadFunc {
|
||||||
|
return loadMessageBundle;
|
||||||
|
}
|
||||||
13
build/fs.ts
13
build/fs.ts
|
|
@ -29,6 +29,19 @@ export function ensureDir(dirname: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a file.
|
||||||
|
*/
|
||||||
|
export function copyFile(_source: string, _destination: string) {
|
||||||
|
const source = path.join(REPO_ROOT, _source);
|
||||||
|
const destination = path.join(REPO_ROOT, _destination);
|
||||||
|
|
||||||
|
ensureDir(path.dirname(destination));
|
||||||
|
fs.writeFileSync(destination, fs.readFileSync(source));
|
||||||
|
|
||||||
|
console.log(`Copied ${_source} to ${_destination}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a directory and all its contents.
|
* Remove a directory and all its contents.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ function getAdvancedLanguages(): Promise<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateEsmMetadataJsAndDTs() {
|
export function generateMetadata() {
|
||||||
return Promise.all([getBasicLanguages(), getAdvancedLanguages()]).then(
|
return Promise.all([getBasicLanguages(), getAdvancedLanguages()]).then(
|
||||||
([basicLanguages, advancedLanguages]) => {
|
([basicLanguages, advancedLanguages]) => {
|
||||||
basicLanguages.sort((a, b) => strcmp(a.entry, b.entry));
|
basicLanguages.sort((a, b) => strcmp(a.entry, b.entry));
|
||||||
|
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
import { dirname, join } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { readdirSync } from 'fs';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} filePath
|
|
||||||
* @param {string} newExt
|
|
||||||
*/
|
|
||||||
export function changeExt(filePath, newExt) {
|
|
||||||
const idx = filePath.lastIndexOf('.');
|
|
||||||
if (idx === -1) {
|
|
||||||
return filePath + newExt;
|
|
||||||
} else {
|
|
||||||
return filePath.substring(0, idx) + newExt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getNlsEntryPoints() {
|
|
||||||
const nlsDir = dirname(fileURLToPath(import.meta.resolve('monaco-editor-core/esm/nls.messages.en.js')));
|
|
||||||
const nlsFiles = readdirSync(nlsDir)
|
|
||||||
.filter(file => file.startsWith('nls.messages.') && file.endsWith('.js'))
|
|
||||||
.reduce((acc, file) => {
|
|
||||||
// @ts-ignore
|
|
||||||
acc[file] = join(nlsDir, file);
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
return nlsFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
const root = join(import.meta.dirname, '../');
|
|
||||||
|
|
||||||
const mappedPaths = {
|
|
||||||
[join(root, 'node_modules/monaco-editor-core/esm/')]: '.',
|
|
||||||
[join(root, 'node_modules/')]: 'external/',
|
|
||||||
[join(root, 'monaco-lsp-client/')]: 'external/monaco-lsp-client/',
|
|
||||||
[join(root, 'src/')]: 'vs/',
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} moduleId
|
|
||||||
* @param {string} newExt (with leading .)
|
|
||||||
* @returns {string | undefined}
|
|
||||||
*/
|
|
||||||
export function mapModuleId(moduleId, newExt) {
|
|
||||||
for (const [key, val] of Object.entries(mappedPaths)) {
|
|
||||||
if (moduleId.startsWith(key)) {
|
|
||||||
const relativePath = moduleId.substring(key.length);
|
|
||||||
return changeExt(join(val, relativePath), newExt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {(moduleId: string) => boolean} [filter]
|
|
||||||
* @return {import('rollup').Plugin}
|
|
||||||
*/
|
|
||||||
export function dtsDeprecationWarning(filter) {
|
|
||||||
return {
|
|
||||||
name: 'add-dts-deprecation-warning',
|
|
||||||
generateBundle(options, bundle) {
|
|
||||||
for (const fileName in bundle) {
|
|
||||||
if (filter && !filter(fileName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const file = bundle[fileName];
|
|
||||||
if (file.type === 'chunk' && fileName.endsWith('.d.ts')) {
|
|
||||||
let content = file.code.toString();
|
|
||||||
content = content + `
|
|
||||||
declare namespace languages {
|
|
||||||
/** @deprecated Use the new top level "css" namespace instead. */
|
|
||||||
export const css: { deprecated: true };
|
|
||||||
|
|
||||||
/** @deprecated Use the new top level "html" namespace instead. */
|
|
||||||
export const html: { deprecated: true };
|
|
||||||
|
|
||||||
/** @deprecated Use the new top level "json" namespace instead. */
|
|
||||||
export const json: { deprecated: true };
|
|
||||||
|
|
||||||
/** @deprecated Use the new top level "typescript" namespace instead. */
|
|
||||||
export const typescript: { deprecated: true };
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
file.code = content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
170
build/utils.ts
170
build/utils.ts
|
|
@ -5,11 +5,181 @@
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as cp from 'child_process';
|
||||||
|
import * as esbuild from 'esbuild';
|
||||||
import * as glob from 'glob';
|
import * as glob from 'glob';
|
||||||
import { ensureDir } from './fs';
|
import { ensureDir } from './fs';
|
||||||
|
|
||||||
export const REPO_ROOT = path.join(__dirname, '../');
|
export const REPO_ROOT = path.join(__dirname, '../');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the typescript compiler synchronously over a project.
|
||||||
|
*/
|
||||||
|
export function runTsc(_projectPath: string) {
|
||||||
|
const projectPath = path.join(REPO_ROOT, _projectPath);
|
||||||
|
console.log(`Launching compiler at ${_projectPath}...`);
|
||||||
|
const res = cp.spawnSync(
|
||||||
|
process.execPath,
|
||||||
|
[path.join(__dirname, '../node_modules/typescript/lib/tsc.js'), '-p', projectPath],
|
||||||
|
{ stdio: 'inherit' }
|
||||||
|
);
|
||||||
|
console.log(`Compiled ${_projectPath}`);
|
||||||
|
if (res.status !== 0) {
|
||||||
|
process.exit(res.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch prettier on a specific file.
|
||||||
|
*/
|
||||||
|
export function prettier(_filePath: string) {
|
||||||
|
const filePath = path.join(REPO_ROOT, _filePath);
|
||||||
|
cp.spawnSync(
|
||||||
|
process.execPath,
|
||||||
|
[path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath],
|
||||||
|
{ stdio: 'inherit' }
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Ran prettier over ${_filePath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform an external .d.ts file to an internal .d.ts file
|
||||||
|
*/
|
||||||
|
export function massageAndCopyDts(source: string, destination: string, namespace: string) {
|
||||||
|
const absoluteSource = path.join(REPO_ROOT, source);
|
||||||
|
const absoluteDestination = path.join(REPO_ROOT, destination);
|
||||||
|
|
||||||
|
const lines = fs
|
||||||
|
.readFileSync(absoluteSource)
|
||||||
|
.toString()
|
||||||
|
.split(/\r\n|\r|\n/);
|
||||||
|
|
||||||
|
let result = [
|
||||||
|
`/*---------------------------------------------------------------------------------------------`,
|
||||||
|
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
|
||||||
|
` * Licensed under the MIT License. See License.txt in the project root for license information.`,
|
||||||
|
` *--------------------------------------------------------------------------------------------*/`,
|
||||||
|
``,
|
||||||
|
`declare namespace ${namespace} {`
|
||||||
|
];
|
||||||
|
for (let line of lines) {
|
||||||
|
if (/^import/.test(line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (line === 'export {};') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
line = line.replace(/ /g, '\t');
|
||||||
|
line = line.replace(/declare /g, '');
|
||||||
|
if (line.length > 0) {
|
||||||
|
line = `\t${line}`;
|
||||||
|
result.push(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.push(`}`);
|
||||||
|
result.push(``);
|
||||||
|
|
||||||
|
ensureDir(path.dirname(absoluteDestination));
|
||||||
|
fs.writeFileSync(absoluteDestination, result.join('\n'));
|
||||||
|
|
||||||
|
prettier(destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function build(options: import('esbuild').BuildOptions) {
|
||||||
|
esbuild.build(options).then((result) => {
|
||||||
|
if (result.errors.length > 0) {
|
||||||
|
console.error(result.errors);
|
||||||
|
}
|
||||||
|
if (result.warnings.length > 0) {
|
||||||
|
console.error(result.warnings);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildESM(options: { base: string; entryPoints: string[]; external: string[] }) {
|
||||||
|
build({
|
||||||
|
entryPoints: options.entryPoints,
|
||||||
|
bundle: true,
|
||||||
|
target: 'esnext',
|
||||||
|
format: 'esm',
|
||||||
|
drop: ['debugger'],
|
||||||
|
banner: {
|
||||||
|
js: bundledFileHeader
|
||||||
|
},
|
||||||
|
external: options.external,
|
||||||
|
outbase: `src/${options.base}`,
|
||||||
|
outdir: `out/languages/bundled/esm/vs/${options.base}/`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGitVersion() {
|
||||||
|
const git = path.join(REPO_ROOT, '.git');
|
||||||
|
const headPath = path.join(git, 'HEAD');
|
||||||
|
let head;
|
||||||
|
|
||||||
|
try {
|
||||||
|
head = fs.readFileSync(headPath, 'utf8').trim();
|
||||||
|
} catch (e) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^[0-9a-f]{40}$/i.test(head)) {
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
const refMatch = /^ref: (.*)$/.exec(head);
|
||||||
|
|
||||||
|
if (!refMatch) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ref = refMatch[1];
|
||||||
|
const refPath = path.join(git, ref);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return fs.readFileSync(refPath, 'utf8').trim();
|
||||||
|
} catch (e) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
const packedRefsPath = path.join(git, 'packed-refs');
|
||||||
|
let refsRaw;
|
||||||
|
|
||||||
|
try {
|
||||||
|
refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim();
|
||||||
|
} catch (e) {
|
||||||
|
return void 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
|
||||||
|
let refsMatch;
|
||||||
|
const refs = {};
|
||||||
|
|
||||||
|
while ((refsMatch = refsRegex.exec(refsRaw))) {
|
||||||
|
refs[refsMatch[2]] = refsMatch[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return refs[ref];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const bundledFileHeader = (() => {
|
||||||
|
const sha1 = getGitVersion();
|
||||||
|
const semver = require('../package.json').version;
|
||||||
|
const headerVersion = semver + '(' + sha1 + ')';
|
||||||
|
|
||||||
|
const BUNDLED_FILE_HEADER = [
|
||||||
|
'/*!-----------------------------------------------------------------------------',
|
||||||
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
|
' * Version: ' + headerVersion,
|
||||||
|
' * Released under the MIT license',
|
||||||
|
' * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt',
|
||||||
|
' *-----------------------------------------------------------------------------*/',
|
||||||
|
''
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
return BUNDLED_FILE_HEADER;
|
||||||
|
})();
|
||||||
|
|
||||||
export interface IFile {
|
export interface IFile {
|
||||||
path: string;
|
path: string;
|
||||||
|
|
|
||||||
107
monaco-lsp-client/package-lock.json
generated
107
monaco-lsp-client/package-lock.json
generated
|
|
@ -21,6 +21,22 @@
|
||||||
"monaco-editor-core": "^0.54.0-dev-20250929"
|
"monaco-editor-core": "^0.54.0-dev-20250929"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../../../hediet/typed-json-rpc/json-rpc": {
|
||||||
|
"name": "@hediet/json-rpc",
|
||||||
|
"version": "0.5.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.8.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"../../../hediet/typed-json-rpc/json-rpc-browser": {
|
||||||
|
"name": "@hediet/json-rpc-browser",
|
||||||
|
"version": "0.5.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@hediet/json-rpc": "^0.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"../../../hediet/typed-json-rpc/json-rpc-node": {
|
"../../../hediet/typed-json-rpc/json-rpc-node": {
|
||||||
"name": "@hediet/json-rpc-node",
|
"name": "@hediet/json-rpc-node",
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
|
|
@ -39,6 +55,16 @@
|
||||||
"source-map-support": "^0.5.12"
|
"source-map-support": "^0.5.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../../../hediet/typed-json-rpc/json-rpc-websocket": {
|
||||||
|
"name": "@hediet/json-rpc-websocket",
|
||||||
|
"version": "0.5.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@hediet/json-rpc": "^0.5.0",
|
||||||
|
"@types/ws": "^6.0.4",
|
||||||
|
"isomorphic-ws": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"../../hediet/typed-json-rpc/json-rpc-browser": {
|
"../../hediet/typed-json-rpc/json-rpc-browser": {
|
||||||
"extraneous": true
|
"extraneous": true
|
||||||
},
|
},
|
||||||
|
|
@ -144,30 +170,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@hediet/json-rpc": {
|
"node_modules/@hediet/json-rpc": {
|
||||||
"version": "0.5.0",
|
"resolved": "../../../hediet/typed-json-rpc/json-rpc",
|
||||||
"resolved": "https://registry.npmjs.org/@hediet/json-rpc/-/json-rpc-0.5.0.tgz",
|
"link": true
|
||||||
"integrity": "sha512-SApO7NbKJztClcznEqg46ZGQzO2v3Q3gVIuRVC9QE/m75J/5AipJdclxEXgT++7j4x4LI2JjEpf2xhi67Ngu9A==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
},
|
||||||
"node_modules/@hediet/json-rpc-browser": {
|
"node_modules/@hediet/json-rpc-browser": {
|
||||||
"version": "0.5.1",
|
"resolved": "../../../hediet/typed-json-rpc/json-rpc-browser",
|
||||||
"resolved": "https://registry.npmjs.org/@hediet/json-rpc-browser/-/json-rpc-browser-0.5.1.tgz",
|
"link": true
|
||||||
"integrity": "sha512-iR+WrTdM7WozRJ/MElfeT8CmH2f911Y8P6xfcj5RCfywp7kjnnqKPUV/VnNnzToxRZUO8WAfJtLvmhDBsSjMtA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@hediet/json-rpc": "^0.5.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/@hediet/json-rpc-websocket": {
|
"node_modules/@hediet/json-rpc-websocket": {
|
||||||
"version": "0.5.1",
|
"resolved": "../../../hediet/typed-json-rpc/json-rpc-websocket",
|
||||||
"resolved": "https://registry.npmjs.org/@hediet/json-rpc-websocket/-/json-rpc-websocket-0.5.1.tgz",
|
"link": true
|
||||||
"integrity": "sha512-1H9UjKyR00ZjwcReQdzTxyEoZKaEubeOvxBVrwHGo4n9HeQt6SvQgtef+1AJ9MT7/sV2Qfe0VWarYivx6BWgIA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@hediet/json-rpc": "^0.5.0",
|
|
||||||
"@types/ws": "^6.0.4",
|
|
||||||
"isomorphic-ws": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
|
|
@ -876,24 +888,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
|
||||||
"version": "24.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz",
|
|
||||||
"integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"undici-types": "~7.16.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/ws": {
|
|
||||||
"version": "6.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.4.tgz",
|
|
||||||
"integrity": "sha512-PpPrX7SZW9re6+Ha8ojZG4Se8AZXgf0GK6zmfqEuCsY49LFDNXO3SByp44X3dFEqtB73lkCDAdUazhAjVPiNwg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ansis": {
|
"node_modules/ansis": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansis/-/ansis-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansis/-/ansis-4.2.0.tgz",
|
||||||
|
|
@ -1182,15 +1176,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/isomorphic-ws": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"peerDependencies": {
|
|
||||||
"ws": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/jsesc": {
|
"node_modules/jsesc": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
|
||||||
|
|
@ -1562,12 +1547,6 @@
|
||||||
"license": "0BSD",
|
"license": "0BSD",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/unicorn-magic": {
|
"node_modules/unicorn-magic": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
|
||||||
|
|
@ -1580,28 +1559,6 @@
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"node_modules/ws": {
|
|
||||||
"version": "8.18.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
|
||||||
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"bufferutil": "^4.0.1",
|
|
||||||
"utf-8-validate": ">=5.0.2"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"bufferutil": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"utf-8-validate": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
290
package-lock.json
generated
290
package-lock.json
generated
|
|
@ -1,16 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.55.1",
|
"version": "0.54.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.55.1",
|
"version": "0.54.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.56.1",
|
"@playwright/test": "^1.53.2",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.2",
|
"@rollup/plugin-node-resolve": "^16.0.2",
|
||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
|
|
@ -30,10 +30,9 @@
|
||||||
"jsdom": "^19.0.0",
|
"jsdom": "^19.0.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"mocha": "^11.7.4",
|
"mocha": "^11.7.4",
|
||||||
"monaco-editor-core": "^0.55.0-rc",
|
"monaco-editor-core": "^0.55.0-dev-20251008",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"postcss-url": "^10.1.3",
|
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"requirejs": "^2.3.7",
|
"requirejs": "^2.3.7",
|
||||||
|
|
@ -47,8 +46,8 @@
|
||||||
"style-loader": "^3.3.1",
|
"style-loader": "^3.3.1",
|
||||||
"terser": "^5.14.2",
|
"terser": "^5.14.2",
|
||||||
"ts-node": "^10.6.0",
|
"ts-node": "^10.6.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.4.5",
|
||||||
"vite": "^7.1.11",
|
"vite": "^7.1.5",
|
||||||
"vscode-css-languageservice": "6.2.14",
|
"vscode-css-languageservice": "6.2.14",
|
||||||
"vscode-html-languageservice": "5.2.0",
|
"vscode-html-languageservice": "5.2.0",
|
||||||
"vscode-json-languageservice": "5.3.11",
|
"vscode-json-languageservice": "5.3.11",
|
||||||
|
|
@ -2462,12 +2461,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test": {
|
"node_modules/@playwright/test": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.2.tgz",
|
||||||
"integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==",
|
"integrity": "sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright": "1.56.1"
|
"playwright": "1.54.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
|
|
@ -4272,13 +4272,6 @@
|
||||||
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
|
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/cuint": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
|
|
||||||
"integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/data-urls": {
|
"node_modules/data-urls": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz",
|
||||||
|
|
@ -4493,22 +4486,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dompurify": {
|
"node_modules/dompurify": {
|
||||||
"version": "3.2.7",
|
"version": "3.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz",
|
||||||
"integrity": "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==",
|
"integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "(MPL-2.0 OR Apache-2.0)",
|
"license": "(MPL-2.0 OR Apache-2.0)"
|
||||||
"optionalDependencies": {
|
|
||||||
"@types/trusted-types": "^2.0.7"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/dompurify/node_modules/@types/trusted-types": {
|
|
||||||
"version": "2.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
|
||||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"node_modules/domutils": {
|
"node_modules/domutils": {
|
||||||
"version": "2.8.0",
|
"version": "2.8.0",
|
||||||
|
|
@ -6241,32 +6223,6 @@
|
||||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/make-dir": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"semver": "^6.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-dir/node_modules/semver": {
|
|
||||||
"version": "6.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
|
||||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"bin": {
|
|
||||||
"semver": "bin/semver.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-error": {
|
"node_modules/make-error": {
|
||||||
"version": "1.3.6",
|
"version": "1.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
|
@ -6352,19 +6308,6 @@
|
||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime": {
|
|
||||||
"version": "2.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz",
|
|
||||||
"integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"mime": "cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-db": {
|
"node_modules/mime-db": {
|
||||||
"version": "1.51.0",
|
"version": "1.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
||||||
|
|
@ -6523,13 +6466,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/monaco-editor-core": {
|
"node_modules/monaco-editor-core": {
|
||||||
"version": "0.55.0-rc",
|
"version": "0.55.0-dev-20251009",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.55.0-rc.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.55.0-dev-20251009.tgz",
|
||||||
"integrity": "sha512-LZAAUGilhXX+u+JNxqBABDFyvIVjW6Gmn3EkP0ztdvNxvP6+voiRm2/ZMLokSUGrdOeCZXA2nM6w1xjKkrqNjQ==",
|
"integrity": "sha512-QyipMtg/vrAXaurn2BpAehWAKsMYlX1bfMxLBjGAI2DJJ/6isZ8+jpPcrOgIPa8Lu4AKrv4vQ0qYGtgSqp0R7Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dompurify": "3.2.7",
|
"dompurify": "3.1.7",
|
||||||
"marked": "14.0.0"
|
"marked": "14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -7036,12 +6979,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright": {
|
"node_modules/playwright": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz",
|
||||||
"integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==",
|
"integrity": "sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright-core": "1.56.1"
|
"playwright-core": "1.54.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
|
|
@ -7054,10 +6998,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright-core": {
|
"node_modules/playwright-core": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz",
|
||||||
"integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==",
|
"integrity": "sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright-core": "cli.js"
|
"playwright-core": "cli.js"
|
||||||
},
|
},
|
||||||
|
|
@ -7189,38 +7134,6 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss-url": {
|
|
||||||
"version": "10.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-10.1.3.tgz",
|
|
||||||
"integrity": "sha512-FUzyxfI5l2tKmXdYc6VTu3TWZsInayEKPbiyW+P6vmmIrrb4I6CGX0BFoewgYHLK+oIL5FECEK02REYRpBvUCw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"make-dir": "~3.1.0",
|
|
||||||
"mime": "~2.5.2",
|
|
||||||
"minimatch": "~3.0.4",
|
|
||||||
"xxhashjs": "~0.2.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"postcss": "^8.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/postcss-url/node_modules/minimatch": {
|
|
||||||
"version": "3.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
|
|
||||||
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/postcss-value-parser": {
|
"node_modules/postcss-value-parser": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||||
|
|
@ -8482,11 +8395,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.9.3",
|
"version": "5.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|
@ -8638,10 +8550,11 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "7.1.11",
|
"version": "7.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz",
|
||||||
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
"integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
|
|
@ -9054,16 +8967,6 @@
|
||||||
"integrity": "sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA==",
|
"integrity": "sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/xxhashjs": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz",
|
|
||||||
"integrity": "sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"cuint": "^0.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/y18n": {
|
"node_modules/y18n": {
|
||||||
"version": "5.0.8",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
|
@ -10701,12 +10604,12 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@playwright/test": {
|
"@playwright/test": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.2.tgz",
|
||||||
"integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==",
|
"integrity": "sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"playwright": "1.56.1"
|
"playwright": "1.54.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@rolldown/binding-android-arm64": {
|
"@rolldown/binding-android-arm64": {
|
||||||
|
|
@ -11952,12 +11855,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cuint": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
|
|
||||||
"integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"data-urls": {
|
"data-urls": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.1.tgz",
|
||||||
|
|
@ -12102,22 +11999,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dompurify": {
|
"dompurify": {
|
||||||
"version": "3.2.7",
|
"version": "3.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz",
|
||||||
"integrity": "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==",
|
"integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"requires": {
|
|
||||||
"@types/trusted-types": "^2.0.7"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/trusted-types": {
|
|
||||||
"version": "2.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
|
||||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"domutils": {
|
"domutils": {
|
||||||
"version": "2.8.0",
|
"version": "2.8.0",
|
||||||
|
|
@ -13238,23 +13123,6 @@
|
||||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"make-dir": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"semver": "^6.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"semver": {
|
|
||||||
"version": "6.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
|
||||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"make-error": {
|
"make-error": {
|
||||||
"version": "1.3.6",
|
"version": "1.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
|
@ -13314,12 +13182,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mime": {
|
|
||||||
"version": "2.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz",
|
|
||||||
"integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.51.0",
|
"version": "1.51.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
|
||||||
|
|
@ -13435,12 +13297,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"monaco-editor-core": {
|
"monaco-editor-core": {
|
||||||
"version": "0.55.0-rc",
|
"version": "0.55.0-dev-20251009",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.55.0-rc.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.55.0-dev-20251009.tgz",
|
||||||
"integrity": "sha512-LZAAUGilhXX+u+JNxqBABDFyvIVjW6Gmn3EkP0ztdvNxvP6+voiRm2/ZMLokSUGrdOeCZXA2nM6w1xjKkrqNjQ==",
|
"integrity": "sha512-QyipMtg/vrAXaurn2BpAehWAKsMYlX1bfMxLBjGAI2DJJ/6isZ8+jpPcrOgIPa8Lu4AKrv4vQ0qYGtgSqp0R7Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"dompurify": "3.2.7",
|
"dompurify": "3.1.7",
|
||||||
"marked": "14.0.0"
|
"marked": "14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -13816,19 +13678,19 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playwright": {
|
"playwright": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz",
|
||||||
"integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==",
|
"integrity": "sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fsevents": "2.3.2",
|
"fsevents": "2.3.2",
|
||||||
"playwright-core": "1.56.1"
|
"playwright-core": "1.54.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playwright-core": {
|
"playwright-core": {
|
||||||
"version": "1.56.1",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz",
|
||||||
"integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==",
|
"integrity": "sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"portfinder": {
|
"portfinder": {
|
||||||
|
|
@ -13918,29 +13780,6 @@
|
||||||
"util-deprecate": "^1.0.2"
|
"util-deprecate": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postcss-url": {
|
|
||||||
"version": "10.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-10.1.3.tgz",
|
|
||||||
"integrity": "sha512-FUzyxfI5l2tKmXdYc6VTu3TWZsInayEKPbiyW+P6vmmIrrb4I6CGX0BFoewgYHLK+oIL5FECEK02REYRpBvUCw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"make-dir": "~3.1.0",
|
|
||||||
"mime": "~2.5.2",
|
|
||||||
"minimatch": "~3.0.4",
|
|
||||||
"xxhashjs": "~0.2.2"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"minimatch": {
|
|
||||||
"version": "3.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
|
|
||||||
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"postcss-value-parser": {
|
"postcss-value-parser": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||||
|
|
@ -14748,9 +14587,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "5.9.3",
|
"version": "5.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"undici-types": {
|
"undici-types": {
|
||||||
|
|
@ -14856,9 +14695,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"vite": {
|
"vite": {
|
||||||
"version": "7.1.11",
|
"version": "7.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz",
|
||||||
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
"integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
|
|
@ -15118,15 +14957,6 @@
|
||||||
"integrity": "sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA==",
|
"integrity": "sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"xxhashjs": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz",
|
|
||||||
"integrity": "sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"cuint": "^0.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "5.0.8",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
|
|
||||||
32
package.json
32
package.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor",
|
"name": "monaco-editor",
|
||||||
"version": "0.55.1",
|
"version": "0.54.0",
|
||||||
"vscodeRef": "86f5a62f058e3905f74a9fa65d04b2f3b533408e",
|
"vscodeRef": "484fdf69b8509c1c9370d913b32e9f6d3a68cc99",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "A browser based code editor",
|
"description": "A browser based code editor",
|
||||||
"homepage": "https://github.com/microsoft/monaco-editor",
|
"homepage": "https://github.com/microsoft/monaco-editor",
|
||||||
|
|
@ -28,35 +28,26 @@
|
||||||
"deps-all-install": "ts-node ./build/npm/installAll",
|
"deps-all-install": "ts-node ./build/npm/installAll",
|
||||||
"update-actions": "pin-github-action ./.github/workflows/website.yml",
|
"update-actions": "pin-github-action ./.github/workflows/website.yml",
|
||||||
"watch": "tsc -w -p ./src",
|
"watch": "tsc -w -p ./src",
|
||||||
"build-all": "npm run build-lsp && npm run build-monaco-editor && npm run package-for-smoketest",
|
"build-languages": "ts-node ./build/build-languages",
|
||||||
"build": "npm run build-lsp && npm run build-monaco-editor",
|
|
||||||
"build-monaco-editor": "ts-node ./build/build-monaco-editor",
|
"build-monaco-editor": "ts-node ./build/build-monaco-editor",
|
||||||
"build-lsp": "cd monaco-lsp-client && npm install && npm run build"
|
"build-lsp": "cd monaco-lsp-client && npm install && npm run build",
|
||||||
|
"build": "npm run build-lsp && npm run build-languages && npm run build-monaco-editor"
|
||||||
},
|
},
|
||||||
"typings": "./esm/vs/editor/editor.main.d.ts",
|
"typings": "./esm/vs/editor/editor.api.d.ts",
|
||||||
"main": "./min/vs/editor/editor.main.js",
|
|
||||||
"module": "./esm/vs/editor/editor.main.js",
|
"module": "./esm/vs/editor/editor.main.js",
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"types": "./esm/vs/editor/editor.main.d.ts",
|
|
||||||
"import": "./esm/vs/editor/editor.main.js",
|
|
||||||
"require": "./min/vs/editor/editor.main.js"
|
|
||||||
},
|
|
||||||
"./*": "./*"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/microsoft/monaco-editor"
|
"url": "https://github.com/microsoft/monaco-editor"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.56.1",
|
"@vscode/monaco-lsp-client": "file:./monaco-lsp-client",
|
||||||
|
"@playwright/test": "^1.53.2",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.2",
|
"@rollup/plugin-node-resolve": "^16.0.2",
|
||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/shelljs": "^0.8.11",
|
"@types/shelljs": "^0.8.11",
|
||||||
"@types/trusted-types": "^1.0.6",
|
"@types/trusted-types": "^1.0.6",
|
||||||
"@typescript/vfs": "^1.3.5",
|
"@typescript/vfs": "^1.3.5",
|
||||||
"@vscode/monaco-lsp-client": "file:./monaco-lsp-client",
|
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
"clean-css": "^5.2.4",
|
"clean-css": "^5.2.4",
|
||||||
"css-loader": "^6.7.1",
|
"css-loader": "^6.7.1",
|
||||||
|
|
@ -69,10 +60,9 @@
|
||||||
"jsdom": "^19.0.0",
|
"jsdom": "^19.0.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"mocha": "^11.7.4",
|
"mocha": "^11.7.4",
|
||||||
"monaco-editor-core": "^0.55.0-rc",
|
"monaco-editor-core": "^0.55.0-dev-20251008",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"postcss-url": "^10.1.3",
|
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"requirejs": "^2.3.7",
|
"requirejs": "^2.3.7",
|
||||||
|
|
@ -86,8 +76,8 @@
|
||||||
"style-loader": "^3.3.1",
|
"style-loader": "^3.3.1",
|
||||||
"terser": "^5.14.2",
|
"terser": "^5.14.2",
|
||||||
"ts-node": "^10.6.0",
|
"ts-node": "^10.6.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.4.5",
|
||||||
"vite": "^7.1.11",
|
"vite": "^7.1.5",
|
||||||
"vscode-css-languageservice": "6.2.14",
|
"vscode-css-languageservice": "6.2.14",
|
||||||
"vscode-html-languageservice": "5.2.0",
|
"vscode-html-languageservice": "5.2.0",
|
||||||
"vscode-json-languageservice": "5.3.11",
|
"vscode-json-languageservice": "5.3.11",
|
||||||
|
|
|
||||||
1733
samples/browser-esm-vite-react/package-lock.json
generated
1733
samples/browser-esm-vite-react/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,6 @@
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"@vitejs/plugin-react": "^1.1.4",
|
"@vitejs/plugin-react": "^1.1.4",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.4.5",
|
||||||
"vite": "^5.4.21"
|
"vite": "^2.9.17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
samples/browser-esm-vite/.gitignore
vendored
2
samples/browser-esm-vite/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
dist
|
|
||||||
src/**/*.js
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>browser-esm-vite</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
<script type="module" src="/main.ts"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
import './style.css';
|
|
||||||
import * as monaco from '../../src/editor/editor.main';
|
|
||||||
|
|
||||||
monaco.languages.register({ id: 'typescript' });
|
|
||||||
|
|
||||||
const tm = monaco.editor.createModel(`class Test {}`, 'typescript',
|
|
||||||
monaco.Uri.parse('file:///main.ts'));
|
|
||||||
|
|
||||||
const editor = monaco.editor.create(document.getElementById('root')!, {
|
|
||||||
model: tm,
|
|
||||||
language: 'typescript',
|
|
||||||
theme: 'vs-dark',
|
|
||||||
});
|
|
||||||
1663
samples/browser-esm-vite/package-lock.json
generated
1663
samples/browser-esm-vite/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "browser-esm-vite",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "tsc && vite build",
|
|
||||||
"serve": "vite preview"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"monaco-editor": "^0.54.0",
|
|
||||||
"typescript": "^5.9.3",
|
|
||||||
"vite": "^7.1.11"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
html,
|
|
||||||
body,
|
|
||||||
#root {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ESNext",
|
|
||||||
"strict": true,
|
|
||||||
"module": "ESNext",
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
},
|
|
||||||
"include": ["./"]
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
server: {
|
|
||||||
fs: {
|
|
||||||
allow: ['../../', '../../../vscode']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: [{
|
|
||||||
find: 'monaco-editor-core/esm/vs',
|
|
||||||
replacement: join(__dirname, '../../../vscode/src/vs')
|
|
||||||
}, {
|
|
||||||
find: 'monaco-editor-core',
|
|
||||||
replacement: join(__dirname, '../../../vscode/src/vs/editor/editor.main.ts')
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
});
|
|
||||||
70
samples/package-lock.json
generated
70
samples/package-lock.json
generated
|
|
@ -721,7 +721,6 @@
|
||||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
|
|
@ -748,7 +747,6 @@
|
||||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fast-uri": "^3.0.1",
|
"fast-uri": "^3.0.1",
|
||||||
|
|
@ -964,7 +962,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001737",
|
"caniuse-lite": "^1.0.30001737",
|
||||||
"electron-to-chromium": "^1.5.211",
|
"electron-to-chromium": "^1.5.211",
|
||||||
|
|
@ -1262,34 +1259,35 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/compression": {
|
"node_modules/compression": {
|
||||||
"version": "1.8.1",
|
"version": "1.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz",
|
|
||||||
"integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==",
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bytes": "3.1.2",
|
"accepts": "~1.3.5",
|
||||||
"compressible": "~2.0.18",
|
"bytes": "3.0.0",
|
||||||
|
"compressible": "~2.0.16",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"negotiator": "~0.6.4",
|
"on-headers": "~1.0.2",
|
||||||
"on-headers": "~1.1.0",
|
"safe-buffer": "5.1.2",
|
||||||
"safe-buffer": "5.2.1",
|
|
||||||
"vary": "~1.1.2"
|
"vary": "~1.1.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/compression/node_modules/negotiator": {
|
"node_modules/compression/node_modules/bytes": {
|
||||||
"version": "0.6.4",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz",
|
|
||||||
"integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==",
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/compression/node_modules/safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
|
@ -2186,21 +2184,6 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
|
@ -3177,12 +3160,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/monaco-editor": {
|
"node_modules/monaco-editor": {
|
||||||
"version": "0.53.0",
|
"version": "0.53.0-dev-20250905",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.53.0.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.53.0-dev-20250905.tgz",
|
||||||
"integrity": "sha512-0WNThgC6CMWNXXBxTbaYYcunj08iB5rnx4/G56UOPeL9UVIUGGHA1GR0EWIh9Ebabj7NpCRawQ5b0hfN1jQmYQ==",
|
"integrity": "sha512-dz8KD6kfIkQ9vQgUlUPBf24zFiDo/tPbI6HmDoBToURc3vXSlmxnR3NccA5NAaG/k3SrYZ+m4Pd+sjGtc7SV8w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/trusted-types": "^1.0.6"
|
"@types/trusted-types": "^1.0.6"
|
||||||
}
|
}
|
||||||
|
|
@ -3259,9 +3241,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-forge": {
|
"node_modules/node-forge": {
|
||||||
"version": "1.3.3",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||||
"integrity": "sha512-rLvcdSyRCyouf6jcOIPe/BgwG/d7hKjzMKOas33/pHEr6gbq18IK9zV7DiPvzsz0oBJPme6qr6H6kGZuI9/DZg==",
|
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "(BSD-3-Clause OR GPL-2.0)",
|
"license": "(BSD-3-Clause OR GPL-2.0)",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
@ -3361,9 +3343,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/on-headers": {
|
"node_modules/on-headers": {
|
||||||
"version": "1.1.0",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==",
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
@ -3581,7 +3561,6 @@
|
||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.6",
|
"nanoid": "^3.3.6",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
|
|
@ -4013,7 +3992,6 @@
|
||||||
"version": "6.12.6",
|
"version": "6.12.6",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.1",
|
"fast-deep-equal": "^3.1.1",
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
|
|
@ -4745,8 +4723,7 @@
|
||||||
"node_modules/tslib": {
|
"node_modules/tslib": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "0BSD",
|
"license": "0BSD"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/tunnel": {
|
"node_modules/tunnel": {
|
||||||
"version": "0.0.6",
|
"version": "0.0.6",
|
||||||
|
|
@ -4788,7 +4765,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|
@ -4918,7 +4894,6 @@
|
||||||
"integrity": "sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==",
|
"integrity": "sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/eslint-scope": "^3.7.7",
|
"@types/eslint-scope": "^3.7.7",
|
||||||
"@types/estree": "^1.0.8",
|
"@types/estree": "^1.0.8",
|
||||||
|
|
@ -4966,7 +4941,6 @@
|
||||||
"version": "4.10.0",
|
"version": "4.10.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discoveryjs/json-ext": "^0.5.0",
|
"@discoveryjs/json-ext": "^0.5.0",
|
||||||
"@webpack-cli/configtest": "^1.2.0",
|
"@webpack-cli/configtest": "^1.2.0",
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ async function buildAndTest() {
|
||||||
// Run checks and compilation
|
// Run checks and compilation
|
||||||
await run('npm run gulp hygiene', { cwd: vscodePath });
|
await run('npm run gulp hygiene', { cwd: vscodePath });
|
||||||
await run('npm run valid-layers-check', { cwd: vscodePath });
|
await run('npm run valid-layers-check', { cwd: vscodePath });
|
||||||
|
await run('npm run compile', { cwd: join(vscodePath, 'build') });
|
||||||
await run('npm run eslint', { cwd: vscodePath });
|
await run('npm run eslint', { cwd: vscodePath });
|
||||||
await run('npm run monaco-compile-check', { cwd: vscodePath });
|
await run('npm run monaco-compile-check', { cwd: vscodePath });
|
||||||
await run('npm run --max_old_space_size=4095 compile', { cwd: vscodePath });
|
await run('npm run --max_old_space_size=4095 compile', { cwd: vscodePath });
|
||||||
|
|
@ -88,8 +89,10 @@ async function buildAndTest() {
|
||||||
// Build editor distribution
|
// Build editor distribution
|
||||||
await run('npm run gulp editor-distro', { cwd: vscodePath });
|
await run('npm run gulp editor-distro', { cwd: vscodePath });
|
||||||
|
|
||||||
|
return; // To save CI time.
|
||||||
|
|
||||||
// Run browser tests
|
// Run browser tests
|
||||||
await run('npm run test-browser -- --browser chromium', { cwd: vscodePath });
|
await run('npm run test-browser --browser chromium', { cwd: vscodePath });
|
||||||
|
|
||||||
// TypeScript typings test
|
// TypeScript typings test
|
||||||
await run('mkdir typings-test', { cwd: vscodePath });
|
await run('mkdir typings-test', { cwd: vscodePath });
|
||||||
|
|
@ -107,4 +110,6 @@ async function buildAndTest() {
|
||||||
await run('npm test', { cwd: testMonacoDir });
|
await run('npm test', { cwd: testMonacoDir });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//buildAndTest();
|
||||||
|
//prepareMonacoEditorCoreRelease('0.99.0', 'main');
|
||||||
prepareMonacoEditorCoreReleaseStableOrNightly();
|
prepareMonacoEditorCoreReleaseStableOrNightly();
|
||||||
|
|
|
||||||
|
|
@ -43,32 +43,36 @@ async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await group('Set Version & Update monaco-editor-core Version', async () => {
|
await group('Set Version & Update monaco-editor-core Version', async () => {
|
||||||
const packageJson = JSON.parse(await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })) as PackageJson;
|
const packageJson = JSON.parse(
|
||||||
|
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||||
|
) as PackageJson;
|
||||||
|
|
||||||
packageJson.version = monacoEditorCoreVersion;
|
packageJson.version = monacoEditorCoreVersion;
|
||||||
packageJson.devDependencies['monaco-editor-core'] = monacoEditorCoreVersion;
|
packageJson.devDependencies['monaco-editor-core'] = monacoEditorCoreVersion;
|
||||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
|
||||||
});
|
|
||||||
|
|
||||||
await group('npm install to pick up monaco-editor-core', async () => {
|
const monacoEditorCorePackageJson = JSON.parse(
|
||||||
await run('npm install', { cwd: rootPath });
|
await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })
|
||||||
});
|
) as PackageJson;
|
||||||
|
|
||||||
await group('Pick up monaco-editor-core dependencies for CVE tracking', async () => {
|
|
||||||
const packageJson = JSON.parse(await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })) as PackageJson;
|
|
||||||
const monacoEditorCorePackageJson = JSON.parse(await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })) as PackageJson;
|
|
||||||
if (monacoEditorCorePackageJson.dependencies) {
|
if (monacoEditorCorePackageJson.dependencies) {
|
||||||
if (!packageJson.dependencies) {
|
if (!packageJson.dependencies) {
|
||||||
packageJson.dependencies = {};
|
packageJson.dependencies = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
objectMergeThrowIfSet(
|
objectMergeThrowIfSet(
|
||||||
packageJson.dependencies,
|
packageJson.dependencies,
|
||||||
monacoEditorCorePackageJson.dependencies,
|
monacoEditorCorePackageJson.dependencies,
|
||||||
'dependencies'
|
'dependencies'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await group('npm install to pick up monaco-editor-core', async () => {
|
||||||
|
await run('npm install', { cwd: rootPath });
|
||||||
|
});
|
||||||
|
|
||||||
await group('Setting vscode commitId from monaco-editor-core', async () => {
|
await group('Setting vscode commitId from monaco-editor-core', async () => {
|
||||||
const monacoEditorCorePackageJson = JSON.parse(
|
const monacoEditorCorePackageJson = JSON.parse(
|
||||||
await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })
|
await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ export async function gitShallowClone(
|
||||||
await run(`git fetch --depth 1 origin ${ref}`, options);
|
await run(`git fetch --depth 1 origin ${ref}`, options);
|
||||||
await run(`git checkout ${ref}`, options);
|
await run(`git checkout ${ref}`, options);
|
||||||
const commitId = await gitCommitId(targetPath);
|
const commitId = await gitCommitId(targetPath);
|
||||||
console.log(`Cloned ${repositoryUrl} (${commitId}) to ${targetPath}`);
|
|
||||||
return { commitId };
|
return { commitId };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -277,13 +277,6 @@ testTokenization('kotlin', [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '.123',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '0x',
|
line: '0x',
|
||||||
|
|
@ -308,62 +301,24 @@ testTokenization('kotlin', [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0Xff_81_00L',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.hex.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0x123u',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.hex.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0x123U',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.hex.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0x123uL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.hex.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0x123UL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.hex.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '023L',
|
line: '023L',
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
tokens: [{ startIndex: 0, type: 'number.octal.kt' }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '0123l',
|
line: '0123l',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.octal.kt' }]
|
||||||
{ startIndex: 0, type: 'number.kt' },
|
|
||||||
{ startIndex: 4, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '05_2',
|
line: '05_2',
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
tokens: [{ startIndex: 0, type: 'number.octal.kt' }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -381,41 +336,6 @@ testTokenization('kotlin', [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0b0101L',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.binary.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0B0101u',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.binary.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0B1__0U',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.binary.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0B0101uL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.binary.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '0B1__0UL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.binary.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '10e3',
|
line: '10e3',
|
||||||
|
|
@ -481,88 +401,57 @@ testTokenization('kotlin', [
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '.001f',
|
line: '23.5D',
|
||||||
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '23.5D',
|
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 4, type: 'type.identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '23.5d',
|
line: '23.5d',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 4, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72E3D',
|
line: '1.72E3D',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 6, type: 'type.identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72E3d',
|
line: '1.72E3d',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 6, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72E-3d',
|
line: '1.72E-3d',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 7, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72e3D',
|
line: '1.72e3D',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 6, type: 'type.identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72e3d',
|
line: '1.72e3d',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 6, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '1.72e-3d',
|
line: '1.72e-3d',
|
||||||
tokens: [
|
tokens: [{ startIndex: 0, type: 'number.float.kt' }]
|
||||||
{ startIndex: 0, type: 'number.float.kt' },
|
|
||||||
{ startIndex: 7, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -576,37 +465,6 @@ testTokenization('kotlin', [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '23l',
|
line: '23l',
|
||||||
tokens: [
|
|
||||||
{ startIndex: 0, type: 'number.kt' },
|
|
||||||
{ startIndex: 2, type: 'identifier.kt' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '23u',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '23U',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '23uL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line: '23UL',
|
|
||||||
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
tokens: [{ startIndex: 0, type: 'number.kt' }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -638,7 +496,8 @@ testTokenization('kotlin', [
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'number.kt' },
|
{ startIndex: 0, type: 'number.kt' },
|
||||||
{ startIndex: 1, type: 'identifier.kt' },
|
{ startIndex: 1, type: 'identifier.kt' },
|
||||||
{ startIndex: 2, type: 'number.float.kt' }
|
{ startIndex: 2, type: 'delimiter.kt' },
|
||||||
|
{ startIndex: 3, type: 'number.float.kt' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -708,7 +567,7 @@ testTokenization('kotlin', [
|
||||||
{
|
{
|
||||||
line: '052_',
|
line: '052_',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'number.kt' },
|
{ startIndex: 0, type: 'number.octal.kt' },
|
||||||
{ startIndex: 3, type: 'identifier.kt' }
|
{ startIndex: 3, type: 'identifier.kt' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,12 +211,13 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
[/@\s*[a-zA-Z_\$][\w\$]*/, 'annotation'],
|
[/@\s*[a-zA-Z_\$][\w\$]*/, 'annotation'],
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
[/(@digits)[eE]([\-+]?(@digits))?[fF]?/, 'number.float'],
|
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'],
|
||||||
[/(@digits)?\.(@digits)([eE][\-+]?(@digits))?[fF]?/, 'number.float'],
|
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, 'number.float'],
|
||||||
[/0[xX](@hexdigits)[uU]?L?/, 'number.hex'],
|
[/0[xX](@hexdigits)[Ll]?/, 'number.hex'],
|
||||||
[/0[bB](@binarydigits)[uU]?L?/, 'number.binary'],
|
[/0(@octaldigits)[Ll]?/, 'number.octal'],
|
||||||
[/(@digits)[fF]/, 'number.float'],
|
[/0[bB](@binarydigits)[Ll]?/, 'number.binary'],
|
||||||
[/(@digits)[uU]?L?/, 'number'],
|
[/(@digits)[fFdD]/, 'number.float'],
|
||||||
|
[/(@digits)[lL]?/, 'number'],
|
||||||
|
|
||||||
// delimiter: after number because of .\d floats
|
// delimiter: after number because of .\d floats
|
||||||
[/[;,.]/, 'delimiter'],
|
[/[;,.]/, 'delimiter'],
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ if (
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWorker(descriptor: { label: string; moduleId: string; createWorker?: () => Worker }): Worker | Promise<Worker> {
|
function getWorker(descriptor: { label: string; moduleId: string }): Worker | Promise<Worker> {
|
||||||
const label = descriptor.label;
|
const label = descriptor.label;
|
||||||
// Option for hosts to overwrite the worker script (used in the standalone editor)
|
// Option for hosts to overwrite the worker script (used in the standalone editor)
|
||||||
interface IMonacoEnvironment {
|
interface IMonacoEnvironment {
|
||||||
|
|
@ -73,10 +73,6 @@ function getWorker(descriptor: { label: string; moduleId: string; createWorker?:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor.createWorker) {
|
|
||||||
return descriptor.createWorker();
|
|
||||||
}
|
|
||||||
|
|
||||||
// const esmWorkerLocation = descriptor.esmModuleLocation;
|
// const esmWorkerLocation = descriptor.esmModuleLocation;
|
||||||
// if (esmWorkerLocation) {
|
// if (esmWorkerLocation) {
|
||||||
// const workerUrl = getWorkerBootstrapUrl(label, esmWorkerLocation.toString(true));
|
// const workerUrl = getWorkerBootstrapUrl(label, esmWorkerLocation.toString(true));
|
||||||
|
|
@ -95,8 +91,7 @@ export function createWebWorker<T extends object>(
|
||||||
const worker = Promise.resolve(
|
const worker = Promise.resolve(
|
||||||
getWorker({
|
getWorker({
|
||||||
label: opts.label ?? 'monaco-editor-worker',
|
label: opts.label ?? 'monaco-editor-worker',
|
||||||
moduleId: opts.moduleId,
|
moduleId: opts.moduleId
|
||||||
createWorker: opts.createWorker,
|
|
||||||
})
|
})
|
||||||
).then((w) => {
|
).then((w) => {
|
||||||
w.postMessage('ignore');
|
w.postMessage('ignore');
|
||||||
|
|
@ -116,7 +111,6 @@ export interface IWebWorkerOptions {
|
||||||
* It should export a function `create` that should return the exported proxy.
|
* It should export a function `create` that should return the exported proxy.
|
||||||
*/
|
*/
|
||||||
moduleId: string;
|
moduleId: string;
|
||||||
createWorker?: () => Worker,
|
|
||||||
/**
|
/**
|
||||||
* The data to send over when calling create on the module.
|
* The data to send over when calling create on the module.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
import './internal/initialize';
|
|
||||||
export * from 'monaco-editor-core';
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import './internal/initialize';
|
|
||||||
/// @ts-ignore
|
|
||||||
export * from 'monaco-editor-core/esm/vs/editor/editor.all';
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import './internal/initialize';
|
|
||||||
/// @ts-ignore
|
|
||||||
export * from 'monaco-editor-core/esm/vs/editor/editor.api';
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
import * as monaco from './internal/editorWithLanguages';
|
import { createWebWorker } from '../common/workers.js';
|
||||||
import './internal/initialize';
|
import '../basic-languages/monaco.contribution.js';
|
||||||
import { getGlobalMonaco } from './internal/initialize';
|
import * as css from '../language/css/monaco.contribution.js';
|
||||||
|
import * as html from '../language/html/monaco.contribution.js';
|
||||||
|
import * as json from '../language/json/monaco.contribution.js';
|
||||||
|
import * as typescript from '../language/typescript/monaco.contribution.js';
|
||||||
|
import * as monaco from 'monaco-editor-core';
|
||||||
|
export * from 'monaco-editor-core';
|
||||||
|
|
||||||
export * from './internal/editorWithLanguages';
|
export { css, html, json, typescript };
|
||||||
|
|
||||||
// export to the global based API (for backwards compatibility only).
|
const existingCreateWebWorker = monaco.editor.createWebWorker;
|
||||||
// Warning: We can only write to objects, not modules / namespaces!
|
monaco.editor.createWebWorker = function (options: any) {
|
||||||
// Writing to modules/namespace would confuse bundlers.
|
if (options.worker === undefined) {
|
||||||
const monacoApi = getGlobalMonaco();
|
return createWebWorker(options);
|
||||||
monacoApi.languages.css = monaco.css;
|
}
|
||||||
monacoApi.languages.html = monaco.html;
|
return existingCreateWebWorker(options);
|
||||||
monacoApi.languages.typescript = monaco.typescript;
|
} as any;
|
||||||
monacoApi.languages.json = monaco.json;
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
import * as css from '../../language/css/monaco.contribution';
|
|
||||||
import * as html from '../../language/html/monaco.contribution';
|
|
||||||
import * as json from '../../language/json/monaco.contribution';
|
|
||||||
import * as typescript from '../../language/typescript/monaco.contribution';
|
|
||||||
import '../../basic-languages/monaco.contribution';
|
|
||||||
import * as lsp from '@vscode/monaco-lsp-client';
|
|
||||||
|
|
||||||
export * from 'monaco-editor-core';
|
|
||||||
export { createWebWorker, type IWebWorkerOptions } from '../../common/workers';
|
|
||||||
export { css, html, json, typescript, lsp };
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import * as monaco from 'monaco-editor-core/esm/vs/editor/editor.api';
|
|
||||||
|
|
||||||
export function getGlobalMonaco(): any {
|
|
||||||
return monaco;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO@hediet get rid of the monaco global
|
|
||||||
|
|
||||||
const monacoEnvironment: monaco.Environment | undefined = (globalThis as any).MonacoEnvironment;
|
|
||||||
if (monacoEnvironment?.globalAPI) {
|
|
||||||
(globalThis as any).monaco = getGlobalMonaco();
|
|
||||||
}
|
|
||||||
|
|
@ -253,6 +253,9 @@ export const lessDefaults: LanguageServiceDefaults = new LanguageServiceDefaults
|
||||||
modeConfigurationDefault
|
modeConfigurationDefault
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// export to the global based API
|
||||||
|
(<any>languages).css = { cssDefaults, lessDefaults, scssDefaults };
|
||||||
|
|
||||||
// --- Registration to monaco editor ---
|
// --- Registration to monaco editor ---
|
||||||
|
|
||||||
function getMode(): Promise<typeof mode> {
|
function getMode(): Promise<typeof mode> {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export class WorkerManager {
|
||||||
this._worker = createWebWorker<CSSWorker>({
|
this._worker = createWebWorker<CSSWorker>({
|
||||||
// module that exports the create() method and returns a `CSSWorker` instance
|
// module that exports the create() method and returns a `CSSWorker` instance
|
||||||
moduleId: 'vs/language/css/cssWorker',
|
moduleId: 'vs/language/css/cssWorker',
|
||||||
createWorker: () => new Worker(new URL('./css.worker', import.meta.url), { type: 'module' }),
|
|
||||||
label: this._defaults.languageId,
|
label: this._defaults.languageId,
|
||||||
|
|
||||||
// passed in to the create() method
|
// passed in to the create() method
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,17 @@ export const razorLanguageService = registerHTMLLanguageService(
|
||||||
);
|
);
|
||||||
export const razorDefaults = razorLanguageService.defaults;
|
export const razorDefaults = razorLanguageService.defaults;
|
||||||
|
|
||||||
|
// export to the global based API
|
||||||
|
(<any>languages).html = {
|
||||||
|
htmlDefaults,
|
||||||
|
razorDefaults,
|
||||||
|
handlebarDefaults,
|
||||||
|
htmlLanguageService,
|
||||||
|
handlebarLanguageService,
|
||||||
|
razorLanguageService,
|
||||||
|
registerHTMLLanguageService
|
||||||
|
};
|
||||||
|
|
||||||
// --- Registration to monaco editor ---
|
// --- Registration to monaco editor ---
|
||||||
|
|
||||||
function getMode(): Promise<typeof mode> {
|
function getMode(): Promise<typeof mode> {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ export class WorkerManager {
|
||||||
this._worker = createWebWorker<HTMLWorker>({
|
this._worker = createWebWorker<HTMLWorker>({
|
||||||
// module that exports the create() method and returns a `HTMLWorker` instance
|
// module that exports the create() method and returns a `HTMLWorker` instance
|
||||||
moduleId: 'vs/language/html/htmlWorker',
|
moduleId: 'vs/language/html/htmlWorker',
|
||||||
createWorker: () => new Worker(new URL('./html.worker', import.meta.url), { type: 'module' }),
|
|
||||||
|
|
||||||
// passed in to the create() method
|
// passed in to the create() method
|
||||||
createData: {
|
createData: {
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,9 @@ export interface IJSONWorker {
|
||||||
export const getWorker = (): Promise<(...uris: Uri[]) => Promise<IJSONWorker>> =>
|
export const getWorker = (): Promise<(...uris: Uri[]) => Promise<IJSONWorker>> =>
|
||||||
getMode().then((mode) => mode.getWorker());
|
getMode().then((mode) => mode.getWorker());
|
||||||
|
|
||||||
|
// export to the global based API
|
||||||
|
(<any>languages).json = { jsonDefaults, getWorker };
|
||||||
|
|
||||||
// --- Registration to monaco editor ---
|
// --- Registration to monaco editor ---
|
||||||
|
|
||||||
function getMode(): Promise<typeof mode> {
|
function getMode(): Promise<typeof mode> {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ export class WorkerManager {
|
||||||
this._worker = createWebWorker<JSONWorker>({
|
this._worker = createWebWorker<JSONWorker>({
|
||||||
// module that exports the create() method and returns a `JSONWorker` instance
|
// module that exports the create() method and returns a `JSONWorker` instance
|
||||||
moduleId: 'vs/language/json/jsonWorker',
|
moduleId: 'vs/language/json/jsonWorker',
|
||||||
createWorker: () => new Worker(new URL('./json.worker', import.meta.url), { type: 'module' }),
|
|
||||||
|
|
||||||
label: this._defaults.languageId,
|
label: this._defaults.languageId,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ libFileSet['lib.es2016.array.include.d.ts'] = true;
|
||||||
libFileSet['lib.es2016.d.ts'] = true;
|
libFileSet['lib.es2016.d.ts'] = true;
|
||||||
libFileSet['lib.es2016.full.d.ts'] = true;
|
libFileSet['lib.es2016.full.d.ts'] = true;
|
||||||
libFileSet['lib.es2016.intl.d.ts'] = true;
|
libFileSet['lib.es2016.intl.d.ts'] = true;
|
||||||
libFileSet['lib.es2017.arraybuffer.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2017.d.ts'] = true;
|
libFileSet['lib.es2017.d.ts'] = true;
|
||||||
libFileSet['lib.es2017.date.d.ts'] = true;
|
libFileSet['lib.es2017.date.d.ts'] = true;
|
||||||
libFileSet['lib.es2017.full.d.ts'] = true;
|
libFileSet['lib.es2017.full.d.ts'] = true;
|
||||||
|
|
@ -75,35 +74,22 @@ libFileSet['lib.es2022.full.d.ts'] = true;
|
||||||
libFileSet['lib.es2022.intl.d.ts'] = true;
|
libFileSet['lib.es2022.intl.d.ts'] = true;
|
||||||
libFileSet['lib.es2022.object.d.ts'] = true;
|
libFileSet['lib.es2022.object.d.ts'] = true;
|
||||||
libFileSet['lib.es2022.regexp.d.ts'] = true;
|
libFileSet['lib.es2022.regexp.d.ts'] = true;
|
||||||
|
libFileSet['lib.es2022.sharedmemory.d.ts'] = true;
|
||||||
libFileSet['lib.es2022.string.d.ts'] = true;
|
libFileSet['lib.es2022.string.d.ts'] = true;
|
||||||
libFileSet['lib.es2023.array.d.ts'] = true;
|
libFileSet['lib.es2023.array.d.ts'] = true;
|
||||||
libFileSet['lib.es2023.collection.d.ts'] = true;
|
libFileSet['lib.es2023.collection.d.ts'] = true;
|
||||||
libFileSet['lib.es2023.d.ts'] = true;
|
libFileSet['lib.es2023.d.ts'] = true;
|
||||||
libFileSet['lib.es2023.full.d.ts'] = true;
|
libFileSet['lib.es2023.full.d.ts'] = true;
|
||||||
libFileSet['lib.es2023.intl.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.arraybuffer.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.collection.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.full.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.object.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.promise.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.regexp.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.sharedmemory.d.ts'] = true;
|
|
||||||
libFileSet['lib.es2024.string.d.ts'] = true;
|
|
||||||
libFileSet['lib.es5.d.ts'] = true;
|
libFileSet['lib.es5.d.ts'] = true;
|
||||||
libFileSet['lib.es6.d.ts'] = true;
|
libFileSet['lib.es6.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.array.d.ts'] = true;
|
|
||||||
libFileSet['lib.esnext.collection.d.ts'] = true;
|
libFileSet['lib.esnext.collection.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.d.ts'] = true;
|
libFileSet['lib.esnext.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.decorators.d.ts'] = true;
|
libFileSet['lib.esnext.decorators.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.disposable.d.ts'] = true;
|
libFileSet['lib.esnext.disposable.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.error.d.ts'] = true;
|
|
||||||
libFileSet['lib.esnext.float16.d.ts'] = true;
|
|
||||||
libFileSet['lib.esnext.full.d.ts'] = true;
|
libFileSet['lib.esnext.full.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.intl.d.ts'] = true;
|
libFileSet['lib.esnext.intl.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.iterator.d.ts'] = true;
|
libFileSet['lib.esnext.object.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.promise.d.ts'] = true;
|
libFileSet['lib.esnext.promise.d.ts'] = true;
|
||||||
libFileSet['lib.esnext.sharedmemory.d.ts'] = true;
|
|
||||||
libFileSet['lib.scripthost.d.ts'] = true;
|
libFileSet['lib.scripthost.d.ts'] = true;
|
||||||
libFileSet['lib.webworker.asynciterable.d.ts'] = true;
|
libFileSet['lib.webworker.asynciterable.d.ts'] = true;
|
||||||
libFileSet['lib.webworker.d.ts'] = true;
|
libFileSet['lib.webworker.d.ts'] = true;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
6925
src/language/typescript/lib/typescriptServices.d.ts
vendored
6925
src/language/typescript/lib/typescriptServices.d.ts
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -2,4 +2,4 @@
|
||||||
// **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`
|
// **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`
|
||||||
//
|
//
|
||||||
|
|
||||||
export const typescriptVersion = "5.9.3";
|
export const typescriptVersion = "5.4.5";
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ type CompilerOptionsValue =
|
||||||
| null
|
| null
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
||||||
export interface CompilerOptions {
|
interface CompilerOptions {
|
||||||
allowJs?: boolean;
|
allowJs?: boolean;
|
||||||
allowSyntheticDefaultImports?: boolean;
|
allowSyntheticDefaultImports?: boolean;
|
||||||
allowUmdGlobalAccess?: boolean;
|
allowUmdGlobalAccess?: boolean;
|
||||||
|
|
@ -778,6 +778,20 @@ export const getJavaScriptWorker = (): Promise<(...uris: Uri[]) => Promise<TypeS
|
||||||
return getMode().then((mode) => mode.getJavaScriptWorker());
|
return getMode().then((mode) => mode.getJavaScriptWorker());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// export to the global based API
|
||||||
|
(<any>languages).typescript = {
|
||||||
|
ModuleKind,
|
||||||
|
JsxEmit,
|
||||||
|
NewLineKind,
|
||||||
|
ScriptTarget,
|
||||||
|
ModuleResolutionKind,
|
||||||
|
typescriptVersion,
|
||||||
|
typescriptDefaults,
|
||||||
|
javascriptDefaults,
|
||||||
|
getTypeScriptWorker,
|
||||||
|
getJavaScriptWorker
|
||||||
|
};
|
||||||
|
|
||||||
// --- Registration to monaco editor ---
|
// --- Registration to monaco editor ---
|
||||||
|
|
||||||
function getMode(): Promise<typeof mode> {
|
function getMode(): Promise<typeof mode> {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ export class WorkerManager {
|
||||||
this._worker = createWebWorker<TypeScriptWorker>({
|
this._worker = createWebWorker<TypeScriptWorker>({
|
||||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||||
moduleId: 'vs/language/typescript/tsWorker',
|
moduleId: 'vs/language/typescript/tsWorker',
|
||||||
createWorker: () => new Worker(new URL('./ts.worker', import.meta.url), { type: 'module' }),
|
|
||||||
|
|
||||||
label: this._modeId,
|
label: this._modeId,
|
||||||
|
|
||||||
|
|
|
||||||
3298
website/package-lock.json
generated
3298
website/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,18 +17,18 @@
|
||||||
"@vscode/web-editors": "./vscode-web-editors.tgz",
|
"@vscode/web-editors": "./vscode-web-editors.tgz",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"bootstrap": "^5.2.0",
|
"bootstrap": "^5.2.0",
|
||||||
"bootstrap-icons": "^1.13.1",
|
"bootstrap-icons": "^1.9.1",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"html-inline-css-webpack-plugin": "^1.11.1",
|
"html-inline-css-webpack-plugin": "^1.11.1",
|
||||||
"lzma": "^2.3.2",
|
"lzma": "^2.3.2",
|
||||||
"messagepack": "^1.1.12",
|
"messagepack": "^1.1.12",
|
||||||
"mini-css-extract-plugin": "^2.6.1",
|
"mini-css-extract-plugin": "^2.6.1",
|
||||||
"mobx": "^5.15.4",
|
"mobx": "^5.15.4",
|
||||||
"mobx-react": "^5.0.0",
|
"mobx-react": "^6.2.2",
|
||||||
"monaco-editor": "^0.55.0-dev-20251008",
|
"monaco-editor": "^0.55.0-dev-20251008",
|
||||||
"react": "^16.0.2",
|
"react": "^17.0.2",
|
||||||
"react-bootstrap": "^2.10.10",
|
"react-bootstrap": "^2.4.0",
|
||||||
"react-dom": "^16.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"typedoc": "^0.25.12"
|
"typedoc": "^0.25.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
"@types/webpack": "^4.41.10",
|
"@types/webpack": "^4.41.10",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^11.0.0",
|
"copy-webpack-plugin": "^11.0.0",
|
||||||
"css-loader": "^7.1.2",
|
"css-loader": "^3.5.1",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.0.0",
|
||||||
"glob": "^9.2.1",
|
"glob": "^9.2.1",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
"ts-loader": "^9.3.1",
|
"ts-loader": "^9.3.1",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.4.5",
|
||||||
"webpack": "^5.102.1",
|
"webpack": "^5.90.1",
|
||||||
"webpack-bundle-analyzer": "^4.5.0",
|
"webpack-bundle-analyzer": "^4.5.0",
|
||||||
"webpack-cli": "^4.10.0",
|
"webpack-cli": "^4.10.0",
|
||||||
"webpack-dev-server": "^4.9.3"
|
"webpack-dev-server": "^4.9.3"
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,13 @@ export function getMonaco(): typeof monaco | undefined {
|
||||||
return (window as any).monaco;
|
return (window as any).monaco;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IAMDMonacoSetup = {
|
export interface IMonacoSetup {
|
||||||
loaderUrl: string;
|
loaderUrl: string;
|
||||||
loaderConfigPaths: Record<string, string>;
|
loaderConfigPaths: Record<string, string>;
|
||||||
codiconUrl: string;
|
codiconUrl: string;
|
||||||
monacoTypesUrl: string | undefined;
|
monacoTypesUrl: string | undefined;
|
||||||
language?: string;
|
language?: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type IESMMonacoSetup = {
|
|
||||||
esmUrl: string;
|
|
||||||
monacoTypesUrl: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type IMonacoSetup = IAMDMonacoSetup | IESMMonacoSetup;
|
|
||||||
|
|
||||||
let loading = false;
|
let loading = false;
|
||||||
let resolve: (value: typeof monaco) => void;
|
let resolve: (value: typeof monaco) => void;
|
||||||
|
|
@ -54,10 +47,6 @@ export async function loadMonaco(
|
||||||
async function _loadMonaco(setup: IMonacoSetup): Promise<typeof monaco> {
|
async function _loadMonaco(setup: IMonacoSetup): Promise<typeof monaco> {
|
||||||
const global = self as any;
|
const global = self as any;
|
||||||
|
|
||||||
if ('esmUrl' in setup) {
|
|
||||||
return await import(/* webpackIgnore: true */setup.esmUrl); // CodeQL [SM01507] This is safe because the runner (that allows for dynamic paths) runs in an isolated iframe. The hosting website uses a static path configuration. // CodeQL [SM03712] This is safe because the runner (that allows for dynamic paths) runs in an isolated iframe. The hosting website uses a static path configuration.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(global as any).require) {
|
if (!(global as any).require) {
|
||||||
await loadScript(setup.loaderUrl);
|
await loadScript(setup.loaderUrl);
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +112,7 @@ export const prodMonacoSetup = getMonacoSetup(
|
||||||
export function getMonacoSetup(
|
export function getMonacoSetup(
|
||||||
corePath: string,
|
corePath: string,
|
||||||
language?: string
|
language?: string
|
||||||
): IAMDMonacoSetup {
|
): IMonacoSetup {
|
||||||
const loaderConfigPaths = {
|
const loaderConfigPaths = {
|
||||||
vs: `${corePath}`,
|
vs: `${corePath}`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ import { IMessageFromRunner, IMessageToRunner, IPreviewState } from "../shared";
|
||||||
import "./style.scss";
|
import "./style.scss";
|
||||||
|
|
||||||
window.addEventListener("message", (event) => {
|
window.addEventListener("message", (event) => {
|
||||||
/*const isInSandbox = window.origin === "null";
|
const isInSandbox = window.origin === "null";
|
||||||
if (!isInSandbox) {
|
if (!isInSandbox) {
|
||||||
// To prevent someone from using this html file to run arbitrary code in non-sandboxed context
|
// To prevent someone from using this html file to run arbitrary code in non-sandboxed context
|
||||||
console.error("not in sandbox");
|
console.error("not in sandbox");
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
const e = event.data as IMessageToRunner | { kind: undefined };
|
const e = event.data as IMessageToRunner | { kind: undefined };
|
||||||
if (e.kind === "initialize") {
|
if (e.kind === "initialize") {
|
||||||
initialize(e.state);
|
initialize(e.state);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ monaco.editor.defineTheme("myCustomTheme", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
token: "comment",
|
token: "comment",
|
||||||
foreground: "a80085",
|
foreground: "ffa500",
|
||||||
fontStyle: "italic underline",
|
fontStyle: "italic underline",
|
||||||
},
|
},
|
||||||
{ token: "comment.js", foreground: "008800", fontStyle: "bold" },
|
{ token: "comment.js", foreground: "008800", fontStyle: "bold" },
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
// to the system and how the compiler is told to use ES6 (target=2).
|
// to the system and how the compiler is told to use ES6 (target=2).
|
||||||
|
|
||||||
// validation settings
|
// validation settings
|
||||||
monaco.typescript.javascriptDefaults.setDiagnosticsOptions({
|
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||||
noSemanticValidation: true,
|
noSemanticValidation: true,
|
||||||
noSyntaxValidation: false,
|
noSyntaxValidation: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// compiler options
|
// compiler options
|
||||||
monaco.typescript.javascriptDefaults.setCompilerOptions({
|
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
|
||||||
target: monaco.typescript.ScriptTarget.ES2015,
|
target: monaco.languages.typescript.ScriptTarget.ES2015,
|
||||||
allowNonTsExtensions: true,
|
allowNonTsExtensions: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ var libSource = [
|
||||||
"}",
|
"}",
|
||||||
].join("\n");
|
].join("\n");
|
||||||
var libUri = "ts:filename/facts.d.ts";
|
var libUri = "ts:filename/facts.d.ts";
|
||||||
monaco.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
|
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
|
||||||
// When resolving definitions and references, the editor will try to use created models.
|
// When resolving definitions and references, the editor will try to use created models.
|
||||||
// Creating a model for the library allows "peek definition/references" commands to work with the library.
|
// Creating a model for the library allows "peek definition/references" commands to work with the library.
|
||||||
monaco.editor.createModel(libSource, "typescript", monaco.Uri.parse(libUri));
|
monaco.editor.createModel(libSource, "typescript", monaco.Uri.parse(libUri));
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ var modelUri = monaco.Uri.parse("a://b/foo.json"); // a made up unique URI for o
|
||||||
var model = monaco.editor.createModel(jsonCode, "json", modelUri);
|
var model = monaco.editor.createModel(jsonCode, "json", modelUri);
|
||||||
|
|
||||||
// configure the JSON language support with schemas and schema associations
|
// configure the JSON language support with schemas and schema associations
|
||||||
monaco.json.jsonDefaults.setDiagnosticsOptions({
|
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
validate: true,
|
validate: true,
|
||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ export class Preview extends React.Component<{
|
||||||
<iframe
|
<iframe
|
||||||
className="full-iframe"
|
className="full-iframe"
|
||||||
key={this.counter}
|
key={this.counter}
|
||||||
// sandbox="allow-scripts allow-modals"
|
sandbox="allow-scripts allow-modals"
|
||||||
frameBorder={0}
|
frameBorder={0}
|
||||||
ref={this.handleIframe}
|
ref={this.handleIframe}
|
||||||
src={`https://isolated-playground.github.io/?jsSrcBase64=${btoa(
|
src={`https://isolated-playground.github.io/?jsSrcBase64=${btoa(
|
||||||
|
|
|
||||||
|
|
@ -136,13 +136,6 @@ export function toLoaderConfig(settings: Settings): IMonacoSetup {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coreUrl.endsWith('?esm')) {
|
|
||||||
return {
|
|
||||||
esmUrl: coreUrl,
|
|
||||||
monacoTypesUrl: undefined,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let languagesUrl: string;
|
let languagesUrl: string;
|
||||||
switch (settings.languagesSource) {
|
switch (settings.languagesSource) {
|
||||||
case "latest":
|
case "latest":
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "CommonJS",
|
"module": "CommonJS",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"strict": true
|
|
||||||
},
|
},
|
||||||
// TODO: load from node_modules to be in sync with the latest stable monaco-editor
|
"include": ["../../out/monaco-editor/esm/vs/editor/editor.api.d.ts"],
|
||||||
"include": ["../../out/monaco-editor/esm/vs/editor/editor.main.d.ts"],
|
|
||||||
"exclude": ["theme"]
|
"exclude": ["theme"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://typedoc.org/schema.json",
|
"$schema": "https://typedoc.org/schema.json",
|
||||||
"entryPoints": ["../../out/monaco-editor/esm/vs/editor/editor.main.d.ts"],
|
"entryPoints": ["../../out/monaco-editor/esm/vs/editor/editor.api.d.ts"],
|
||||||
|
|
||||||
"out": "dist",
|
"out": "dist",
|
||||||
"theme": "default",
|
"theme": "default",
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,10 @@ module.exports = {
|
||||||
"sass-loader",
|
"sass-loader",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /\.(jpe?g|png|gif|eot|ttf|svg|woff|woff2|md)$/i,
|
||||||
|
loader: "file-loader",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
loader: "ts-loader",
|
loader: "ts-loader",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue