@sheetxl/scripting-react 0.8.0-beta.6 → 0.8.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/scripting-react",
3
3
  "description": "Scripting React - Monaco based script editor and scripting UI for SheetXL.",
4
- "version": "0.8.0-beta.6",
4
+ "version": "0.8.0-beta.7",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -41,12 +41,13 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@monaco-editor/react": "^4.7.0",
44
- "@sheetxl/react": "^0.8.0-beta.6",
45
- "@sheetxl/scripting": "^0.8.0-beta.6",
46
- "@sheetxl/sdk": "^0.8.0-beta.6",
47
- "@sheetxl/utils": "^0.8.0-beta.6",
48
- "@sheetxl/utils-react": "^0.8.0-beta.6",
44
+ "@sheetxl/react": "^0.8.0-beta.7",
45
+ "@sheetxl/scripting": "^0.8.0-beta.7",
46
+ "@sheetxl/sdk": "^0.8.0-beta.7",
47
+ "@sheetxl/utils": "^0.8.0-beta.7",
48
+ "@sheetxl/utils-react": "^0.8.0-beta.7",
49
49
  "clsx": "^2.1.1",
50
+ "monaco-editor": "~0.55.1",
50
51
  "monaco-editor-auto-typings": "^0.4.6",
51
52
  "path-browserify": "^1.0.1",
52
53
  "react-merge-refs": "^3.0.2"
@@ -0,0 +1,64 @@
1
+ /**
2
+ * A single `import` statement from the leading import block of a script.
3
+ */
4
+ export interface ImportStatement {
5
+ /** Offset of the `import` keyword. */
6
+ start: number;
7
+ /** Offset just past the statement, including its `;` when it has one. */
8
+ end: number;
9
+ /** The statement as written. */
10
+ text: string;
11
+ /** The module specifier, unquoted. */
12
+ module: string;
13
+ /** The quote character the module specifier was written with. */
14
+ quote: string;
15
+ /** Whether this is an `import type` statement. */
16
+ typeOnly: boolean;
17
+ /** A default or namespace binding (`Foo`, `* as Foo`), or `''`. */
18
+ binding: string;
19
+ /** The specifiers between the braces, whitespace-normalized; `null` when there are no braces. */
20
+ names: string[] | null;
21
+ /** Offset just past the `{`. Only meaningful when {@link names} is not `null`. */
22
+ namesStart: number;
23
+ /** Offset of the `}`. Only meaningful when {@link names} is not `null`. */
24
+ namesEnd: number;
25
+ }
26
+ export interface ImportInsert {
27
+ /** Offset into the existing source. */
28
+ offset: number;
29
+ text: string;
30
+ }
31
+ export interface MergedImports {
32
+ /** The snippet with its import statements removed. */
33
+ body: string;
34
+ /** Insertions into the existing source that bring in whatever the snippet imports, by ascending offset. */
35
+ inserts: ImportInsert[];
36
+ /** Offset just past the existing source's last leading import, or `0` if it has none. */
37
+ importsEnd: number;
38
+ }
39
+ /**
40
+ * Reads the leading import block of a script.
41
+ *
42
+ * @remarks
43
+ * Only the leading block is read: whitespace and comments are skipped and the scan stops at the
44
+ * first thing that is not an import statement. Text further down is never inspected, so an
45
+ * `import` inside a string, a comment, or a template literal cannot be mistaken for one.
46
+ */
47
+ export declare const scanImports: (source: string) => ImportStatement[];
48
+ /**
49
+ * Separates a snippet's imports from its body and works out how to fold them into a script that
50
+ * may already import some of the same things.
51
+ *
52
+ * @remarks
53
+ * Named imports (`import { A, B } from 'm'`) merge per name: a name the script already imports
54
+ * from that module is dropped, and the rest join the script's existing import of that module, or
55
+ * become a new statement after its last import when it has none. `import type` statements are
56
+ * merged among themselves, and a type the script already imports as a value is dropped.
57
+ *
58
+ * Any other form (default, namespace, side-effect) is added whole unless the script already has
59
+ * the same statement.
60
+ *
61
+ * A name that is already bound to a different module is not detected.
62
+ */
63
+ export declare const mergeImports: (source: string, snippet: string) => MergedImports;
64
+ //# sourceMappingURL=mergeImports.d.ts.map