Преглед изворни кода

ESM: Do not append the `.js` suffix to imports if it's already there

Alex Dima пре 3 година
родитељ
комит
1134d5e82b
5 измењених фајлова са 56 додато и 5 уклоњено
  1. 2 1
      build/release.js
  2. 3 3
      package-lock.json
  3. 1 1
      package.json
  4. 25 0
      website/playground/monaco.d.ts.txt
  5. 25 0
      website/typedoc/monaco.d.ts

+ 2 - 1
build/release.js

@@ -272,7 +272,8 @@ function ESM_addImportSuffix(files) {
 			const pos = info.importedFiles[i].pos;
 			const pos = info.importedFiles[i].pos;
 			const end = info.importedFiles[i].end;
 			const end = info.importedFiles[i].end;
 
 
-			if (/\.css$/.test(importText)) {
+			if (/(\.css)|(\.js)$/.test(importText)) {
+				// A CSS import or an import already using .js
 				continue;
 				continue;
 			}
 			}
 
 

+ 3 - 3
package-lock.json

@@ -1159,9 +1159,9 @@
 			}
 			}
 		},
 		},
 		"monaco-editor-core": {
 		"monaco-editor-core": {
-			"version": "0.32.0-dev.20220124",
-			"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.32.0-dev.20220124.tgz",
-			"integrity": "sha512-R1MawhuYlGGRNI2jF2jC1z894XGG9NyQnZ6TXLgo88ygaAQUvxp0q4pQp+rkL0x2Q0DZF1CbvclKJlxfniAdiw==",
+			"version": "0.32.0-dev.20220126",
+			"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.32.0-dev.20220126.tgz",
+			"integrity": "sha512-qHwkHRgotDKe+9zXT2t2E7hHnrFHUPoaPuwJhsgRSPGTxoMlLL+qxbf9xsQI634Fl9TjOzDsH8OOD5p1hTvJdA==",
 			"dev": true
 			"dev": true
 		},
 		},
 		"mri": {
 		"mri": {

+ 1 - 1
package.json

@@ -41,7 +41,7 @@
 		"jsdom": "^19.0.0",
 		"jsdom": "^19.0.0",
 		"jsonc-parser": "^3.0.0",
 		"jsonc-parser": "^3.0.0",
 		"mocha": "^9.1.3",
 		"mocha": "^9.1.3",
-		"monaco-editor-core": "0.32.0-dev.20220124",
+		"monaco-editor-core": "0.32.0-dev.20220126",
 		"playwright": "^1.16.3",
 		"playwright": "^1.16.3",
 		"prettier": "^2.4.1",
 		"prettier": "^2.4.1",
 		"pretty-quick": "^3.1.1",
 		"pretty-quick": "^3.1.1",

+ 25 - 0
website/playground/monaco.d.ts.txt

@@ -2094,6 +2094,21 @@ declare namespace monaco.editor {
         isAttachedToEditor(): boolean;
         isAttachedToEditor(): boolean;
     }
     }
 
 
+    export enum PositionAffinity {
+        /**
+         * Prefers the left most position.
+        */
+        Left = 0,
+        /**
+         * Prefers the right most position.
+        */
+        Right = 1,
+        /**
+         * No preference.
+        */
+        None = 2
+    }
+
     /**
     /**
      * A change
      * A change
      */
      */
@@ -4466,8 +4481,13 @@ declare namespace monaco.editor {
         /**
         /**
          * The column after which this zone should appear.
          * The column after which this zone should appear.
          * If not set, the maxLineColumn of `afterLineNumber` will be used.
          * If not set, the maxLineColumn of `afterLineNumber` will be used.
+         * This is relevant for wrapped lines.
          */
          */
         afterColumn?: number;
         afterColumn?: number;
+        /**
+         * If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`.
+        */
+        afterColumnAffinity?: PositionAffinity;
         /**
         /**
          * Suppress mouse down events.
          * Suppress mouse down events.
          * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
          * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
@@ -6196,6 +6216,11 @@ declare namespace monaco.languages {
         */
         */
         readonly range?: IRange;
         readonly range?: IRange;
         readonly command?: Command;
         readonly command?: Command;
+        /**
+         * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
+         * Defaults to `false`.
+        */
+        readonly completeBracketPairs?: boolean;
     }
     }
 
 
     export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
     export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {

+ 25 - 0
website/typedoc/monaco.d.ts

@@ -2094,6 +2094,21 @@ declare namespace monaco.editor {
         isAttachedToEditor(): boolean;
         isAttachedToEditor(): boolean;
     }
     }
 
 
+    export enum PositionAffinity {
+        /**
+         * Prefers the left most position.
+        */
+        Left = 0,
+        /**
+         * Prefers the right most position.
+        */
+        Right = 1,
+        /**
+         * No preference.
+        */
+        None = 2
+    }
+
     /**
     /**
      * A change
      * A change
      */
      */
@@ -4466,8 +4481,13 @@ declare namespace monaco.editor {
         /**
         /**
          * The column after which this zone should appear.
          * The column after which this zone should appear.
          * If not set, the maxLineColumn of `afterLineNumber` will be used.
          * If not set, the maxLineColumn of `afterLineNumber` will be used.
+         * This is relevant for wrapped lines.
          */
          */
         afterColumn?: number;
         afterColumn?: number;
+        /**
+         * If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`.
+        */
+        afterColumnAffinity?: PositionAffinity;
         /**
         /**
          * Suppress mouse down events.
          * Suppress mouse down events.
          * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
          * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
@@ -6196,6 +6216,11 @@ declare namespace monaco.languages {
         */
         */
         readonly range?: IRange;
         readonly range?: IRange;
         readonly command?: Command;
         readonly command?: Command;
+        /**
+         * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
+         * Defaults to `false`.
+        */
+        readonly completeBracketPairs?: boolean;
     }
     }
 
 
     export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
     export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {