98 Commits
Author SHA1 Message Date
dotCooCoo d09d00fa25 Merge main into feat/scripts-export-autocad 2026-12-02 02:20:49 -08:00
dotCooCoo ccf5765419 Tests: assert counts and saved names in tool, path, 3D, brush and CAD tests
Tests whose all() passed on an empty list now check the list's length or
that it is not empty:
- huge_circles_bridge_with_finite_anchors_or_are_refused (pathops bridge)
- smooth_rounds_corners (pathops ops): the four corners stay, smoothed
- a_held_rotation_turns_the_art_around_its_pin (tools ARAP): one point
  per mesh vertex
- the_eraser_drag_area_matches_the_release_when_pressure_or_a_mode_starts_during_the_drag
  (tools gesture): one released point per press
- every_effect_casts_a_shadow, inflate_cells_across_a_hole_edge_are_cut_to_the_shape,
  a_plane_has_only_a_front_and_a_hollow_solid_none and
  perspective_runs_0_to_160_degrees_with_the_eye_outside_the_object (three-d)
- a_file_two_branches_include_is_followed_from_the_shallower_one
  (scriptcheck): one row per include line
- pens_pick_colors_and_widths (cad HP-GL): four widths
- junk_pressure_brushes_draw_finite_art (brush): all 12 cases draw

Round trips that hold by construction (parse finds the id in ALL) are
replaced with one saved name that must parse and one that must not:
follow_names_parse (pathops shared edge), the shape kinds (pathops
shapes), surfaces_parse_from_their_ids (three-d), the Quick Pen actions
(tools), names_parse_and_serialize_as_names (plugins) and the brush
variation modes, which also compare the serde names with the ids.

crop_keeps_an_instance_whose_art_reaches_the_region (cad) names the
entities written instead of checking that some were.
the_saved_engine_preference_is_found (app) pins the GPU choices the
preferences offer to the three the app reads.
timing_unite_1000_circles (pathops) gets an ignore reason and checks
that Unite gives one shape.

Each changed assertion fails when the code under test is broken (an id
renamed, a list emptied, a flush or instance dropped) and passes when it
is restored.
2026-12-01 17:35:21 -08:00
dotCooCoo 7f10f7aa96 Merge main into feat/scripts-export-autocad 2026-12-01 15:10:18 -08:00
dotCooCoo 270ffca6ef Merge main into feat/scripts-export-autocad 2026-11-30 15:26:54 -08:00
dotCooCoo 1b2da536cc Merge main into feat/scripts-print-printer 2026-11-30 15:25:50 -08:00
dotCooCoo b3def332ff Merge main into feat/scripts-print-printer 2026-11-30 11:40:16 -08:00
dotCooCoo 280477d1b8 Merge main into feat/scripts-export-autocad 2026-11-30 11:26:36 -08:00
dotCooCoo 8a5f206e3c Merge main into feat/scripts-api-d6-save-export-open 2026-11-30 10:55:42 -08:00
dotCooCoo f4c911d4d3 Scripts: open options with an importer, null export options and close checks for files that keep every artboard
- document.open refuses page, cropTo, pages and crop when a named importer reads the file (linkPages
  still uses the built-in reader).
- exportFile with explicit null options throws a TypeError for GIF, PNG8 and TIFF too.
- close(SaveOptions.SAVECHANGES) saves a modern .ai or .ait file and an SVG file with Preserve
  Editing whatever range was remembered; a range the save refuses still refuses.
- The script checker keeps a try statement's catch and finally, and an else after a nested
  do-while, inside the loop body; a line break after a label does not start a new statement; a
  this assignment in a function that hides a global clears the global's saved methods; and
  holder.d['saveAs'] = ... no longer counts as a write to d.
- docs/mcp.md describes which files keep every artboard on close.
2026-11-30 03:36:01 -08:00
dotCooCoo 82d4ec4336 Scripts: explicit crop boxes, EPS close-with-save and writer receivers checked per call
- document.open with an explicit PDFCROPBOX crop opens on the crop box
  of a file with editing data; the default keeps the trim box and bleed.
- Closing with save changes keeps an EPS document's artboard range, since
  the EPS file holds the whole document.
- The script checker treats a writer receiver captured from an outer
  scope as able to change before each call, and finds the loop that holds
  a call with a binary search instead of a scan of every loop.
2026-11-29 19:01:56 -08:00
dotCooCoo f99ef023ad Scripts: close checks the artboards the saved file keeps; saves report warnings
Document.close(SaveOptions.SAVECHANGES) now judges artboard loss by the
file the save writes. A PDF last saved with useArtboards: false is
refused, since it holds one page of the art's bounds. A native or .ai
file saved with separateArtboards is saved and closed whatever its range
names, since the range picks only the separate files; a version 7 .ai
file keeps the range check.

Document.saveAs, Document.exportFile, app.open and the save that
close(SaveOptions.SAVECHANGES) runs write each warning of their command
to the console after the method's name (for example "saveAs: SVG keeps 1
of the document's 2 artboards ...").

Script Check reports a file write for a saveAs or exportFile call on the
script's own object when the variable is assigned in a loop around the
call, since a later iteration may run the call on a document. Loop bodies
without braces follow if, else and line breaks, and a variable of the
same name that a function declares is kept apart.

A test shows that a waiting point change counts as unsaved for
Document.saved and close().
2026-11-29 16:49:37 -08:00
dotCooCoo 13b8b4a325 Merge main into feat/scripts-export-autocad 2026-11-29 16:23:58 -08:00
dotCooCoo 60c1eb34af Merge main into feat/scripts-print-printer 2026-11-29 14:36:49 -08:00
dotCooCoo e3077d3c1f Script check: test the computed-key case of an own saveAs in its own script
A computed key such as c[k] = w makes the check unsure for the whole
script, so since the last commit every saveAs in that script counts as a
write, the ones before the computed key included. The test put that case
in the same script as the others, so the own saveAs calls it expected to
write nothing were reported. The computed-key case now has its own
script and assertion, and the other cases keep theirs.
2026-11-29 14:18:39 -08:00
dotCooCoo b1e9a4cbb3 Merge main into feat/scripts-api-d6-save-export-open
main's Document member list held saveAs and close as members that are not
available yet; this branch's save_open members implement them, so the
merge drops them from that list and keeps main's other entries. The
script host test lists take main's members together with this branch's
open, userInteractionLevel, fullName, path, saved and option classes,
and the heap accounting keeps main's ModuleNamespace arm beside the
FsEntry string arm.
2026-11-29 14:13:21 -08:00
dotCooCoo fda48b02d0 Merge main into feat/scripts-app-select-tool 2026-11-29 10:25:17 -08:00
dotCooCoo ea99ddfa63 Merge main into fix/scriptcheck-linear-steps 2026-11-28 22:20:45 -08:00
dotCooCoo 043650d794 Scripts: tighten save, open and close edge cases
- saveAs picks the encoder from the requested name, so a link to a file of
  another format writes the format the name asks for.
- fullName, path and close(SaveOptions.SAVECHANGES) resolve a relative saved
  path against the working directory.
- close(SAVECHANGES) accepts an artboard range that covers every artboard and
  keeps the document open when the save would drop artboards.
- app.open keeps the requested file name, rejects a file over 128 MiB before
  reading it, applies the requested color space to plug-in imports, and
  rejects PDF options for files that are not PDF content; null PDF options
  keep their defaults.
- Explicit null options throw; assigning the current Document.saved value
  runs no command; Document.path reflects as Folder or string.
- An implicit multi-file save names no refused path in its error.
- The script checker counts SAVECHANGES only on SaveOptions and keeps write
  warnings for receivers that evaluated code can rebind.
2026-11-28 21:21:56 -08:00
dotCooCoo a3ccd60b5b Script check: a script whose only finding is unsure names is scanned once
A script without includes whose declarations give names values the analysis
does not read came back from its first scan with `Known::unsure` set and no
names. `settle` counted that as something known and scanned the script again,
which found the same and doubled the scan's steps. The proptest
`any_bytes_are_checked_in_linear_work` shrank one such input to 104 bytes that
took 550 steps, over its bound of 536.

`settle` now keeps the first scan when it found no bound names and no File
objects: the flag comes from the script's own declarations, which the first
scan already read.
2026-11-28 20:55:33 -08:00
dotCooCoo 30d22d07c8 Scripts: the checker scans a script that binds no name once
A script whose only finding about its variables was that a name in
brackets is not one literal (o[k]) was scanned a second time. That
finding comes from the names the script declares, which the first scan
has already read, so the second scan gave the same report and added up
to three steps a byte. A 104-byte input of single-character tokens took
550 steps against the 536 the property test allows.

The check now repeats a scan only when a variable holds a member chain
or a File or Folder object. The property tests take their bound from
the number of scans: five steps a byte for a script scanned once, and
seventeen for one scanned up to five times.
2026-11-28 20:50:13 -08:00
dotCooCoo 32f77ed8cd Merge main into feat/scripts-export-autocad 2026-11-28 19:26:13 -08:00
dotCooCoo c70974d6bd Merge main into feat/scripts-print-printer 2026-11-28 18:21:29 -08:00
dotCooCoo 52c731bb2f Merge main into feat/scripts-api-d6-save-export-open 2026-11-28 18:10:43 -08:00
dotCooCoo e449a91380 Merge main into feat/scripts-app-select-tool
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/tests/script_dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-28 14:50:06 -08:00
dotCooCoo e46f697d50 Script check: a nested function that assigns an outer body's variable keeps the write reported
A function body's assignment was left out of the names other code may
change when any enclosing body had declared the name with var. A nested
function such as swap() { d = app.activeDocument; } called before
d.saveAs(f) then left d trusted as the script's own literal, and the
write went unreported. Only a name the innermost body declared now counts
as that body's own; plain, compound, increment and for-in assignments to
an outer body's variable all keep the write reported.
2026-11-28 06:10:24 -08:00
dotCooCoo 39c5e98a3e Scripts: refuse unsafe close saves and refused multi-file writes up front
- A save of several files whose file access refuses one of them returns
  the refusal before any file goes to the writer, so a writer that does
  not check the file access writes nothing.
- close(SaveOptions.SAVECHANGES) throws before writing, and leaves the
  document open, when the document's last save named some of its
  artboards, since saving with those options again could leave changes
  out of the file.
- The script check no longer treats an object literal's saveAs or
  exportFile as the script's own when a function body assigns the
  variable without declaring it, or when the script assigns it as a
  property of this (the global object in global code and in a function
  called without a receiver).
- The close-with-SAVECHANGES format test reads the saved PDF and checks
  that it holds the change made after the first save.
- docs/mcp.md limits the "none of them is written" sentence for SVG
  linked images to refusals found before the first write, and documents
  the new close refusal.
2026-11-28 03:15:22 -08:00
dotCooCoo b086db0fbb Script check: a function that sets saveAs or exportFile keeps the write reported
A function declared before an object literal could replace the
literal's saveAs or exportFile method when it ran later, and the check
still treated the method as the script's own and left the write out of
filesWritten. When any function body assigns a property of that name,
no variable's method of that name counts as the script's own.
2026-11-28 00:49:55 -08:00
dotCooCoo 7317159f52 Merge main into feat/scripts-reflection 2026-11-28 00:09:37 -08:00
dotCooCoo 306c24c120 Scripts: absolute paths for relative document files, save warnings in the console
- Document.fullName of a file saved or opened under a relative path is
  the file in the process's working folder, as Document.path already
  was, and close with SaveOptions.SAVECHANGES saves it there.
- saveAs, exportFile, app.open and close with SAVECHANGES write each
  warning their command gives to the Script Console, starting with the
  method's name.
- The checker tests cover a with statement and an include between a
  literal and its call.
2026-11-28 00:05:10 -08:00
dotCooCoo 11d20c346f Scripts: refused saves call no writer, white matte, relative paths, checker reassignments
- A save of several files whose file access refuses one returns that
  error without calling the writer for any file, and the check before
  the write no longer lists the paths as written.
- ExportOptionsPNG24 and ExportOptionsJPEG accept matteColor at its
  default, white (red, green and blue 255); other colors still throw.
- Document.path of a file saved under a relative name is the working
  folder the engine wrote the file in.
- The script checker keeps reporting saveAs and exportFile on a
  variable holding the script's own object when a declaration follows
  a label, a function body assigns the variable, a member assignment
  writes a property of that name, code runs from text, or the script
  includes another file.
- docs/mcp.md: saveAs to a .vctemplate file without options writes a
  template copy and leaves fullName and the saved state as they were.
2026-11-28 00:05:10 -08:00
.CooCoo bbefa3c8e3 Merge pull request #9072 from dotCooCoo/feat/js-es2015-collections-typed-arrays
JavaScript: ES2015 realms have Map, Set, WeakMap, WeakSet and typed arrays
2026-11-27 23:55:19 -08:00
dotCooCoo e75b26cffc Merge main into feat/scripts-reflection 2026-11-27 23:38:58 -08:00
dotCooCoo 7dd6e9ae25 Merge main into feat/scripts-export-autocad 2026-11-27 22:40:38 -08:00
dotCooCoo f7afcaf45d Merge main into feat/scripts-app-select-tool 2026-11-27 22:27:49 -08:00
dotCooCoo 18af8a2761 Merge main into feat/scripts-print-printer 2026-11-27 22:14:06 -08:00
dotCooCoo f56fcd99f6 Merge main into feat/scripts-reflection 2026-11-27 22:13:50 -08:00
dotCooCoo a063cad19b Merge main into feat/js-es2015-collections-typed-arrays
# Conflicts:
#	crates/js/src/builtins.rs
#	crates/js/src/heap.rs
#	crates/js/src/lib.rs
#	crates/js/tests/test262.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-27 22:06:44 -08:00
dotCooCoo 887c67a8f1 Merge main into feat/scripts-api-d6-save-export-open 2026-11-27 21:58:18 -08:00
dotCooCoo c97b5eac1e Merge main into feat/scripts-api-d7a-variables 2026-11-27 21:57:44 -08:00
dotCooCoo 2909471ebc Merge main into feat/scripts-api-d7a-variables 2026-11-25 23:38:36 -08:00
dotCooCoo 0359cc0b93 Scripts: a document named in brackets counts for print's file write
The script check now reads a string literal in index brackets as the
member it names when the document chains list that member as a
property, so app['activeDocument'].print(o) and
app['documents'][0].print(o) report a file write. Other names in the
brackets, such as app['preferences'], keep the index and do not give a
document.
2026-11-25 15:21:27 -08:00
dotCooCoo e593f0c7cc Merge main into feat/scripts-reflection 2026-11-25 13:37:34 -08:00
dotCooCoo ed8ae217c9 Merge feat/scripts-api-d1a-app-documents into feat/scripts-api-d6-save-export-open
# Conflicts:
#	crates/js/src/heap.rs
#	docs/mcp.md
2026-11-25 13:16:11 -08:00
dotCooCoo 6378d56beb Merge feat/scripts-api-d1a-app-documents into feat/scripts-app-select-tool
# Conflicts:
#	crates/js/src/builtins.rs
#	crates/js/src/interp.rs
#	docs/mcp.md
2026-11-25 10:25:39 -08:00
dotCooCoo ef2409fb31 Script checker: a Folder variable in parentheses is still a Folder object
`(d).write(s)` and `(d).length = 0` on a variable holding `new Folder(p)`
counted as file writes, while `d.write(s)` and `d.length = 0` did not.
Grouping parentheses now keep what the variable holds, so a Folder
variable in them is left out the same way. A variable that may hold a
File object still counts, and a grouped assignment (`x = (d)`) still
gives `x` a value that may be a File object.
2026-11-25 09:49:18 -08:00
dotCooCoo 77f4ec9739 Merge main into feat/scripts-app-select-tool 2026-11-25 09:28:58 -08:00
dotCooCoo 8b05d98951 Scripts: every script reads E4X and has the XML objects
The script host ran its realm with E4X off, so XML literals were syntax
errors and XML, XMLList, Namespace, QName, isXMLName and
setDefaultXMLNamespace were missing from every script, although
vectorcraft-js has them. script.run and File › Scripts now turn E4X on
for .js and .jsx files, script text, #include files, $.evalFile, eval
and Function, and for a #targetengine engine.

script.check lists the e4x and xml features under the language need
instead of hostOnly, since VectorCraft runs them.
2026-11-25 04:23:32 -08:00
dotCooCoo a5ab214898 Merge main into feat/scripts-print-printer 2026-11-25 04:15:11 -08:00
dotCooCoo e7eefa569c Script checker: File-only calls on a Folder object are not file reads, writes or dialogs
script.check counted write(), writeln(), copy(), createAlias(), open(),
read(), readch(), readln(), openDlg() and saveDlg() as file reads,
writes or dialogs on any object that may hold a File or Folder object.
A Folder object has none of these functions, so on new Folder(...), a
Folder place such as Folder.temp (other than Folder.current), or a
variable that only ever holds one, the call fails without reaching the
file system. The check now leaves those calls out, using the same rule
that already leaves out setting length, hidden or readonly on such an
object. Folder(...) without new and Folder.current may hold a File
object, so calls on them still count, and the Folder object's own
create(), remove(), rename(), getFiles() and selectDlg() still count
on every object.

Folder object functions:
https://extendscript.docsforadobe.dev/file-system-access/folder-object/
File object functions:
https://extendscript.docsforadobe.dev/file-system-access/file-object/

docs/mcp.md and the progress line in docs/target-app-parity.md state
the rule.
2026-11-25 01:01:43 -08:00
dotCooCoo 5709055a97 Scripts: the checker finds print on documents.index() and open through a variable that holds app
`documents.index()` and `app.documents.index()` now count as chains that give a
document, so `app.documents.index(0).print(o)` is listed as a file write. A
document method named in brackets (`app.documents['index'](0)`) gives a document
as its dotted form does.

`app.open(f)` is found from the member chain, so `var a = app; a.open(f)` reads a
file, while `x.app.open(f)` and an `app` the script declares still do not.

Member chains hold at least 64 characters while they are read, and the report
cuts the listed chains to the echo limit, so a short echo limit no longer hides
these calls.
2026-11-24 23:59:59 -08:00