@scm-js/core 0.13.1 → 0.13.2
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/dist/index.d.ts +23 -1
- package/dist/index.mjs +40 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @scm-js/core 0.13.
|
|
2
|
+
* @scm-js/core 0.13.2 — StarCraft maps as the scmJS editor reads and writes them.
|
|
3
3
|
* Generated by `npm run build:core` in github.com/scm-js/scm-js from core/src/index.ts; the guide is docs/core.md.
|
|
4
4
|
*/
|
|
5
5
|
import { Archive, HashEntry, StoredMember } from 'mopaq';
|
|
@@ -3290,6 +3290,28 @@ export declare const SYSTEM_FILES: {
|
|
|
3290
3290
|
};
|
|
3291
3291
|
/** Whether a path (either slash, any case) is one of `SYSTEM_FILES`: by its file name, or by a folder it is under. */
|
|
3292
3292
|
export declare function isSystemFile(path: string): boolean;
|
|
3293
|
+
/** The game's own archives, by file name (lower case): what a 1.16.1 installation holds beside its program. */
|
|
3294
|
+
export declare const GAME_ARCHIVES: readonly [
|
|
3295
|
+
"stardat.mpq",
|
|
3296
|
+
"broodat.mpq",
|
|
3297
|
+
"patch_rt.mpq",
|
|
3298
|
+
"starcraft.mpq",
|
|
3299
|
+
"broodwar.mpq"
|
|
3300
|
+
];
|
|
3301
|
+
/**
|
|
3302
|
+
* The files among `paths` (forward slashes) that are a copy of the game's own and so no part of a mod: in every folder
|
|
3303
|
+
* that holds a `StarDat.mpq`, that folder's `GAME_ARCHIVES` and every file under its `Maps` folder.
|
|
3304
|
+
*
|
|
3305
|
+
* A copy of the game in what was handed over is not the mod. A person hands over a folder that holds the mod's release
|
|
3306
|
+
* and, beside it, the whole game the mod runs on (Cosmonarchy's download: `Release/` and `Starcraft/`); laid as layers
|
|
3307
|
+
* of the mod, the game's archives became "the mod's" files, and in Windows' folder order `StarDat.mpq` came last and
|
|
3308
|
+
* carried original StarCraft's tables and iscript over Brood War's. A copy's `Maps` folder is the person's maps folder:
|
|
3309
|
+
nothing under it is a mod's (Cosmonarchy's copy keeps campaigns at `Maps/CMBW-Root/CMBW-maps/campaign/…`, and
|
|
3310
|
+
`campaign` is one of the game's folders, so they were taken for a mod's root). Apply it to each list a walk is given (a folder's
|
|
3311
|
+
* files, a zip's members), never to a single file the person names: some old mods ship as a replaced `patch_rt.mpq`.
|
|
3312
|
+
* The same rule is in the play page and the Mod Editor plugin: change them together.
|
|
3313
|
+
*/
|
|
3314
|
+
export declare function gameCopyFiles(paths: readonly string[]): Set<string>;
|
|
3293
3315
|
/**
|
|
3294
3316
|
* The folder of a set of paths the game's paths start in: the one that holds `arr/`, else the one holding the most
|
|
3295
3317
|
* files under the game's folders, the shallower on a tie; "" is the root. Paths use forward slashes. At any depth, as
|
package/dist/index.mjs
CHANGED
|
@@ -19795,6 +19795,45 @@ function isSystemFile(path) {
|
|
|
19795
19795
|
const leaf = parts.pop() ?? "";
|
|
19796
19796
|
return SYSTEM_FILES.names.includes(leaf) || SYSTEM_FILES.prefixes.some((p) => leaf.startsWith(p)) || parts.some((folder) => SYSTEM_FILES.folders.includes(folder));
|
|
19797
19797
|
}
|
|
19798
|
+
/** The game's own archives, by file name (lower case): what a 1.16.1 installation holds beside its program. */
|
|
19799
|
+
var GAME_ARCHIVES = [
|
|
19800
|
+
"stardat.mpq",
|
|
19801
|
+
"broodat.mpq",
|
|
19802
|
+
"patch_rt.mpq",
|
|
19803
|
+
"starcraft.mpq",
|
|
19804
|
+
"broodwar.mpq"
|
|
19805
|
+
];
|
|
19806
|
+
/**
|
|
19807
|
+
* The files among `paths` (forward slashes) that are a copy of the game's own and so no part of a mod: in every folder
|
|
19808
|
+
* that holds a `StarDat.mpq`, that folder's `GAME_ARCHIVES` and every file under its `Maps` folder.
|
|
19809
|
+
*
|
|
19810
|
+
* A copy of the game in what was handed over is not the mod. A person hands over a folder that holds the mod's release
|
|
19811
|
+
* and, beside it, the whole game the mod runs on (Cosmonarchy's download: `Release/` and `Starcraft/`); laid as layers
|
|
19812
|
+
* of the mod, the game's archives became "the mod's" files, and in Windows' folder order `StarDat.mpq` came last and
|
|
19813
|
+
* carried original StarCraft's tables and iscript over Brood War's. A copy's `Maps` folder is the person's maps folder:
|
|
19814
|
+
nothing under it is a mod's (Cosmonarchy's copy keeps campaigns at `Maps/CMBW-Root/CMBW-maps/campaign/…`, and
|
|
19815
|
+
`campaign` is one of the game's folders, so they were taken for a mod's root). Apply it to each list a walk is given (a folder's
|
|
19816
|
+
* files, a zip's members), never to a single file the person names: some old mods ship as a replaced `patch_rt.mpq`.
|
|
19817
|
+
* The same rule is in the play page and the Mod Editor plugin: change them together.
|
|
19818
|
+
*/
|
|
19819
|
+
function gameCopyFiles(paths) {
|
|
19820
|
+
const dir = (p) => p.slice(0, Math.max(0, p.lastIndexOf("/")));
|
|
19821
|
+
const leaf = (p) => p.slice(p.lastIndexOf("/") + 1).toLowerCase();
|
|
19822
|
+
const copies = new Set(paths.filter((p) => leaf(p) === "stardat.mpq").map((p) => dir(p).toLowerCase()));
|
|
19823
|
+
const out = /* @__PURE__ */ new Set();
|
|
19824
|
+
if (!copies.size) return out;
|
|
19825
|
+
for (const p of paths) {
|
|
19826
|
+
if (copies.has(dir(p).toLowerCase()) && GAME_ARCHIVES.includes(leaf(p))) {
|
|
19827
|
+
out.add(p);
|
|
19828
|
+
continue;
|
|
19829
|
+
}
|
|
19830
|
+
for (const c of copies) if (p.toLowerCase().startsWith(c ? `${c}/maps/` : "maps/")) {
|
|
19831
|
+
out.add(p);
|
|
19832
|
+
break;
|
|
19833
|
+
}
|
|
19834
|
+
}
|
|
19835
|
+
return out;
|
|
19836
|
+
}
|
|
19798
19837
|
/**
|
|
19799
19838
|
* The folder of a set of paths the game's paths start in: the one that holds `arr/`, else the one holding the most
|
|
19800
19839
|
* files under the game's folders, the shallower on a tie; "" is the root. Paths use forward slashes. At any depth, as
|
|
@@ -21940,4 +21979,4 @@ function canonicalSpec(source) {
|
|
|
21940
21979
|
return source.kind === "builtin" ? `builtin:${source.name}` : source.display;
|
|
21941
21980
|
}
|
|
21942
21981
|
//#endregion
|
|
21943
|
-
export { ACTION_DEFS, AI_ENUMS, AI_FLAGS, AI_OPCODES, AI_SCRIPT_FLAGS, AI_SCRIPT_NAMES, ANYWHERE_NAME, ActionType, AiScriptTextError, BRIEFING_ACTION_DEFS, BUILD_MANIFEST_MEMBER, BUILD_SOURCE_MEMBER, CHOICES, CONDITION_DEFS, ColorMode, Comparison, ConditionType, DAT_SCHEMAS, DAT_TABLES, DEFAULT_DOODAD_PLACEMENT, DEFAULT_GAS, DEFAULT_MINERALS, DEFAULT_PALETTE, DEFAULT_PLACEMENT, DEFAULT_SAVE_OPTIONS, DEFAULT_START_PLACEMENT, DEFAULT_TEXT_ENCODING, DIRT, DatTextError, FIND_KINDS, FORCE_SLOTS, ForceFlag, GAME_FOLDERS, GAME_ISCRIPT_LAST, GraftTextError, ISCRIPT_ANIMS, ISCRIPT_OPCODES, ISCRIPT_TYPE_ANIMS, IscriptTextError, MAP_SIZES, MAP_VERSIONS, MEGATILE_PX, MINERAL_FIELD_IDS, MODELLED_SECTIONS, MOD_FOLDERS, MOD_FORMAT, MOD_MANIFEST, MapLoadError, ModFolderError, ModSourceError, NAME_TEXT_FILES, PLAYER_COLORS, PLAYER_RACES, PLAYER_SLOTS, PLAYER_TYPES, PLUGIN_API_VERSION, PlayerGroup, PlayerRace, PlayerType, REQUIRED_SECTIONS, ResourceType, SAVE_PRESETS, SCENARIO_PATH, START_LOCATION, STRX_CAPACITY, SYSTEM_FILES, SetModifier, SwitchAction, SwitchState, TECH_NAMES, TEXT_CODES, TEXT_ENCODINGS, TILESETS, TILESET_BY_ID, TRIGGER_OWNERS, TileFlag, TriggerTextError, UNIT_LIMIT, UNIT_NAMES, UNIT_TYPE_COUNT, UPGRADE_NAMES, UnitClass, UnitUsed, VESPENE_GEYSER, WAV_FORMAT, WEAPON_NAMES, actionDef, actionDefByName, addLocation, addUnits, aiNames, aiScriptByName, aiScriptName, aiStringText, aiscriptFromText, aiscriptToText, applyBriefing, applyChanges, applyDoodadChanges, applyForceSettings, applyLocationChanges, applyPlayerSettings, applySounds, applyStringImport, applyStrings, applyTechSettings, applyTriggers, applyUnitChanges, applyUnitSettings, applyUpgradeSettings, baseTerrain, buildChk, buildDoodadCatalogue, buildMapFile, buttonGraftFromText, buttonGraftToText, canDecodeWav, changeMapVersion, changeTextEncoding, checkDoodadPlacement, checkIsom, checkMod, choiceLabel, choiceValue, conditionDef, conditionDefByName, createScenario, datEntrySize, datFromRows, datFromText, datHas, datRow, datRows, datShape, datStandardSize, datTableOf, datToText, dataSetHash, dataSetHashOfDigests, decodeButtonGraft, decodeDat, decodeFlingyDat, decodeGrpImage, decodeImaAdpcm, decodeImagesDat, decodeIscript, decodeLoFile, decodePcmWav, decodePcxImage, decodePng, decodeReqGraft, decodeSpritesDat, decodeTblFile, decodeText, decodeTrg, decodeUnitsDat, decodeWav, defaultSaveOptions, defaultTechRestrictions, defaultTechSettings, defaultUnitAvailability, defaultUnitSettings, defaultUpgradeRestrictions, defaultUpgradeSettings, deflate, deleteUnused, diamondAt, diffMods, displayColorHex, drawMegatile, editLocation, emptyDat, emptyManifest, encodeButtonGraft, encodeDat, encodeGrpFrame, encodeGrpImage, encodeGrpLine, encodeLoFile, encodePcxImage, encodePng, encodeReqGraft, encodeSection, encodeTblFile, encodeTrg, encodeWav, entryText, escapeStringText, exeArchive, extraKind, fieldType, fileDigest, findInScenario, fingerprintTrigger, firegraftLine, flatRow, flatTerrain, folderPath, forceName, formatBytes, formatOf, formatStringTable, formatTrigger, formatTriggers, frameFromPicture, framePicture, gameLine, gameName, groupBuildable, grpToPng, hasIsom, hashLines, hashLinesAsWere, idealStarts, inflate, internString, isExe, isExpansion, isFiregraftProject, isModCode, isMpq, isPlainPcm, isPluginFile, isPng, isPreserved, isRemasteredRevision, isResource, isSystemFile, isSystemLine, isZip, iscriptEntryCount, iscriptFromText, iscriptToText, isomTables, issueCounts, keptExtras, loFromText, loToText, loadMap, loadModData, loadTileset, locationCapacity, locationName, locationSlots, looksLikeMpq, makeUnit, mapStatistics, mapVersionOf, markDirty, megatileForTile, megatileHeight, memberInfo, memberOf, memberPath, mirroredOwner, modHash, modHashOfDigests, modRoot, moveLocations, moveUnits, nameFileText, nameList, namesOf, newAction, newCondition, newTrigger, nextSerial, opaqueBox, openMapBytes, ownEntry, packBuiltMap, packFile, paintIsom, paintIsomDiamonds, parseChk, parseDatText, parseScenario, parseStringTable, parseTriggers, parseWavHeader, placeDoodad, placeOf, placeStartLocations, placedLocations, plainText, planSave, playableCount, playerColorHex, playerRaceLabel, playerTypeLabel, pluginLine, pngToGrp, probeNames, programEnd, readArchive, readBriefing, readBuildManifest, readExtras, readForceSettings, readIscriptHeaders, readManifest, readMembers, readPlayerSettings, readStrings, readSwitchNames, readTechSettings, readTriggerFile, readTriggers, readUnitSettings, readUpgradeSettings, readWavs, readZip, recordRendered, removeLocations, removeUnits, renderAiScripts, renderMember, reqGraftFromText, reqGraftToText, requiredSections, resizeScenario, resolveIcon, restoreBuiltMap, rowChanges, runsOf, sameTriggers, scenarioDescription, scenarioName, serializeChk, serializeScenario, setDatRow, setExtendedStrings, setMapVersion, setPreserved, setScenarioDescription, setScenarioName, setTextEncoding, sheetColumns, soundList, statTextEntries, statWithText, statisticsText, storedRange, stringCapacity, stringUsages, summarizeTrigger, symmetryImages, tblEscape, tblFromText, tblToText, tblUnescape, techName, techRestrictionSections, techSettingsSections, textCode, tidyManifest, tileGroupOf, tilesetIndex, triggerComment, triggerFormatOf, triggerNames, triggerReferences, triggerUsage, triggersFromText, triggersToText, unescapeStringText, unitAt, unitCustomName, unitGeometry, unitName, unitSettingsSections, unitsInBox, unusedStrings, updateUnits, upgradeName, upgradeRestrictionSections, upgradeSettingsSections, usedLocations, validateManifest, validateScenario, walkSpeed, wavCodecName, wavDuration, wavFormatLabel, wavFrames, weaponName, writeArchiveBytes, writeMapBytes };
|
|
21982
|
+
export { ACTION_DEFS, AI_ENUMS, AI_FLAGS, AI_OPCODES, AI_SCRIPT_FLAGS, AI_SCRIPT_NAMES, ANYWHERE_NAME, ActionType, AiScriptTextError, BRIEFING_ACTION_DEFS, BUILD_MANIFEST_MEMBER, BUILD_SOURCE_MEMBER, CHOICES, CONDITION_DEFS, ColorMode, Comparison, ConditionType, DAT_SCHEMAS, DAT_TABLES, DEFAULT_DOODAD_PLACEMENT, DEFAULT_GAS, DEFAULT_MINERALS, DEFAULT_PALETTE, DEFAULT_PLACEMENT, DEFAULT_SAVE_OPTIONS, DEFAULT_START_PLACEMENT, DEFAULT_TEXT_ENCODING, DIRT, DatTextError, FIND_KINDS, FORCE_SLOTS, ForceFlag, GAME_ARCHIVES, GAME_FOLDERS, GAME_ISCRIPT_LAST, GraftTextError, ISCRIPT_ANIMS, ISCRIPT_OPCODES, ISCRIPT_TYPE_ANIMS, IscriptTextError, MAP_SIZES, MAP_VERSIONS, MEGATILE_PX, MINERAL_FIELD_IDS, MODELLED_SECTIONS, MOD_FOLDERS, MOD_FORMAT, MOD_MANIFEST, MapLoadError, ModFolderError, ModSourceError, NAME_TEXT_FILES, PLAYER_COLORS, PLAYER_RACES, PLAYER_SLOTS, PLAYER_TYPES, PLUGIN_API_VERSION, PlayerGroup, PlayerRace, PlayerType, REQUIRED_SECTIONS, ResourceType, SAVE_PRESETS, SCENARIO_PATH, START_LOCATION, STRX_CAPACITY, SYSTEM_FILES, SetModifier, SwitchAction, SwitchState, TECH_NAMES, TEXT_CODES, TEXT_ENCODINGS, TILESETS, TILESET_BY_ID, TRIGGER_OWNERS, TileFlag, TriggerTextError, UNIT_LIMIT, UNIT_NAMES, UNIT_TYPE_COUNT, UPGRADE_NAMES, UnitClass, UnitUsed, VESPENE_GEYSER, WAV_FORMAT, WEAPON_NAMES, actionDef, actionDefByName, addLocation, addUnits, aiNames, aiScriptByName, aiScriptName, aiStringText, aiscriptFromText, aiscriptToText, applyBriefing, applyChanges, applyDoodadChanges, applyForceSettings, applyLocationChanges, applyPlayerSettings, applySounds, applyStringImport, applyStrings, applyTechSettings, applyTriggers, applyUnitChanges, applyUnitSettings, applyUpgradeSettings, baseTerrain, buildChk, buildDoodadCatalogue, buildMapFile, buttonGraftFromText, buttonGraftToText, canDecodeWav, changeMapVersion, changeTextEncoding, checkDoodadPlacement, checkIsom, checkMod, choiceLabel, choiceValue, conditionDef, conditionDefByName, createScenario, datEntrySize, datFromRows, datFromText, datHas, datRow, datRows, datShape, datStandardSize, datTableOf, datToText, dataSetHash, dataSetHashOfDigests, decodeButtonGraft, decodeDat, decodeFlingyDat, decodeGrpImage, decodeImaAdpcm, decodeImagesDat, decodeIscript, decodeLoFile, decodePcmWav, decodePcxImage, decodePng, decodeReqGraft, decodeSpritesDat, decodeTblFile, decodeText, decodeTrg, decodeUnitsDat, decodeWav, defaultSaveOptions, defaultTechRestrictions, defaultTechSettings, defaultUnitAvailability, defaultUnitSettings, defaultUpgradeRestrictions, defaultUpgradeSettings, deflate, deleteUnused, diamondAt, diffMods, displayColorHex, drawMegatile, editLocation, emptyDat, emptyManifest, encodeButtonGraft, encodeDat, encodeGrpFrame, encodeGrpImage, encodeGrpLine, encodeLoFile, encodePcxImage, encodePng, encodeReqGraft, encodeSection, encodeTblFile, encodeTrg, encodeWav, entryText, escapeStringText, exeArchive, extraKind, fieldType, fileDigest, findInScenario, fingerprintTrigger, firegraftLine, flatRow, flatTerrain, folderPath, forceName, formatBytes, formatOf, formatStringTable, formatTrigger, formatTriggers, frameFromPicture, framePicture, gameCopyFiles, gameLine, gameName, groupBuildable, grpToPng, hasIsom, hashLines, hashLinesAsWere, idealStarts, inflate, internString, isExe, isExpansion, isFiregraftProject, isModCode, isMpq, isPlainPcm, isPluginFile, isPng, isPreserved, isRemasteredRevision, isResource, isSystemFile, isSystemLine, isZip, iscriptEntryCount, iscriptFromText, iscriptToText, isomTables, issueCounts, keptExtras, loFromText, loToText, loadMap, loadModData, loadTileset, locationCapacity, locationName, locationSlots, looksLikeMpq, makeUnit, mapStatistics, mapVersionOf, markDirty, megatileForTile, megatileHeight, memberInfo, memberOf, memberPath, mirroredOwner, modHash, modHashOfDigests, modRoot, moveLocations, moveUnits, nameFileText, nameList, namesOf, newAction, newCondition, newTrigger, nextSerial, opaqueBox, openMapBytes, ownEntry, packBuiltMap, packFile, paintIsom, paintIsomDiamonds, parseChk, parseDatText, parseScenario, parseStringTable, parseTriggers, parseWavHeader, placeDoodad, placeOf, placeStartLocations, placedLocations, plainText, planSave, playableCount, playerColorHex, playerRaceLabel, playerTypeLabel, pluginLine, pngToGrp, probeNames, programEnd, readArchive, readBriefing, readBuildManifest, readExtras, readForceSettings, readIscriptHeaders, readManifest, readMembers, readPlayerSettings, readStrings, readSwitchNames, readTechSettings, readTriggerFile, readTriggers, readUnitSettings, readUpgradeSettings, readWavs, readZip, recordRendered, removeLocations, removeUnits, renderAiScripts, renderMember, reqGraftFromText, reqGraftToText, requiredSections, resizeScenario, resolveIcon, restoreBuiltMap, rowChanges, runsOf, sameTriggers, scenarioDescription, scenarioName, serializeChk, serializeScenario, setDatRow, setExtendedStrings, setMapVersion, setPreserved, setScenarioDescription, setScenarioName, setTextEncoding, sheetColumns, soundList, statTextEntries, statWithText, statisticsText, storedRange, stringCapacity, stringUsages, summarizeTrigger, symmetryImages, tblEscape, tblFromText, tblToText, tblUnescape, techName, techRestrictionSections, techSettingsSections, textCode, tidyManifest, tileGroupOf, tilesetIndex, triggerComment, triggerFormatOf, triggerNames, triggerReferences, triggerUsage, triggersFromText, triggersToText, unescapeStringText, unitAt, unitCustomName, unitGeometry, unitName, unitSettingsSections, unitsInBox, unusedStrings, updateUnits, upgradeName, upgradeRestrictionSections, upgradeSettingsSections, usedLocations, validateManifest, validateScenario, walkSpeed, wavCodecName, wavDuration, wavFormatLabel, wavFrames, weaponName, writeArchiveBytes, writeMapBytes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-js/core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "StarCraft: Brood War maps in Node.js and the browser, as the scmJS editor reads and writes them: open .scm/.scx/.chk, triggers, strings, units, locations, settings, Check Map, and write the map back",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"starcraft",
|