Modernize platform, structure, and UX
CI / build (push) Canceled after 0s

Phase 3:
- Declare PowerPointApi 1.5 and replace template manifest values
- Remove the dead command pipeline and the tracked Babel/polyfill setup
- Extract constants, status/settings contexts, PowerPoint services, and an error boundary
- Build with ES2020 and strict TypeScript; hash production assets and drop prod source maps
- Add Vitest tests, CI, LICENSE, Node 20 pinning, and prune unused dependencies
- Correct the README, user guide, developer guide, and audit notes

Phase 4:
- Add a persisted 16:9/4:3 slide size setting used by all layout tools
- Add dark mode with Office/system theme detection
- Make sections collapsible and move to accessible Fluent controls
- Announce status through aria-live and add semantic status icons
- Add a progress counter with cooperative cancellation and a Stop button
- Update the tracked dependency tree for the pruned packages
This commit is contained in:
schihei committed 2026-11-25 12:01:40 +01:00
1 parent e57258afe9
commit 89989c04e9
6211 files changed
+7028 -274819

No files matched your search

+153 -111
View File
@@ -25,7 +25,11 @@ function SourceMapGenerator(aArgs) {
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false);
this._ignoreInvalidMapping = util.getArg(
aArgs,
'ignoreInvalidMapping',
false
);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
@@ -39,56 +43,60 @@ SourceMapGenerator.prototype._version = 3;
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, {
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(
aSourceMapConsumer,
generatorOps
) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator(
Object.assign(generatorOps || {}, {
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
}));
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
sourceRoot: sourceRoot,
})
);
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn,
},
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn,
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
@@ -133,7 +141,7 @@ SourceMapGenerator.prototype.addMapping =
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
name: name,
});
};
@@ -181,14 +189,18 @@ SourceMapGenerator.prototype.setSourceContent =
* relative to the SourceMapGenerator.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
function SourceMapGenerator_applySourceMap(
aSourceMapConsumer,
aSourceFile,
aSourceMapPath
) {
var sourceFile = aSourceFile;
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
'or the source map\'s "file" property. Both were omitted.'
'or the source map\'s "file" property. Both were omitted.'
);
}
sourceFile = aSourceMapConsumer.file;
@@ -209,13 +221,13 @@ SourceMapGenerator.prototype.applySourceMap =
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
column: mapping.originalColumn,
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source)
mapping.source = util.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
@@ -237,7 +249,6 @@ SourceMapGenerator.prototype.applySourceMap =
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
@@ -269,16 +280,25 @@ SourceMapGenerator.prototype.applySourceMap =
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
function SourceMapGenerator_validateMapping(
aGenerated,
aOriginal,
aSource,
aName
) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +
'the original mapping entirely and only map the generated position. If so, pass ' +
'null for the original mapping instead of an object with empty or null values.'
if (
aOriginal &&
typeof aOriginal.line !== 'number' &&
typeof aOriginal.column !== 'number'
) {
var message =
'original.line and original.column are not numbers -- you probably meant to omit ' +
'the original mapping entirely and only map the generated position. If so, pass ' +
'null for the original mapping instead of an object with empty or null values.';
if (this._ignoreInvalidMapping) {
if (typeof console !== 'undefined' && console.warn) {
@@ -290,27 +310,42 @@ SourceMapGenerator.prototype._validateMapping =
}
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
if (
aGenerated &&
'line' in aGenerated &&
'column' in aGenerated &&
aGenerated.line > 0 &&
aGenerated.column >= 0 &&
!aOriginal &&
!aSource &&
!aName
) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
} else if (
aGenerated &&
'line' in aGenerated &&
'column' in aGenerated &&
aOriginal &&
'line' in aOriginal &&
'column' in aOriginal &&
aGenerated.line > 0 &&
aGenerated.column >= 0 &&
aOriginal.line > 0 &&
aOriginal.column >= 0 &&
aSource
) {
// Cases 2 and 3.
return;
}
else {
var message = 'Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
});
} else {
var message =
'Invalid mapping: ' +
JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName,
});
if (this._ignoreInvalidMapping) {
if (typeof console !== 'undefined' && console.warn) {
@@ -318,7 +353,7 @@ SourceMapGenerator.prototype._validateMapping =
}
return false;
} else {
throw new Error(message)
throw new Error(message);
}
}
};
@@ -344,26 +379,30 @@ SourceMapGenerator.prototype._serializeMappings =
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = ''
next = '';
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
}
else {
// One ';' per skipped line. Build large gaps with a single flat
// string: appending ';' one by one creates a rope node per line, which
// can exhaust the heap for a big gap (CVE-2026-93749).
var lineDelta = mapping.generatedLine - previousGeneratedLine;
next += lineDelta === 1 ? ';' : ';'.repeat(lineDelta);
previousGeneratedLine = mapping.generatedLine;
} else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
if (
!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])
) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
next += base64VLQ.encode(
mapping.generatedColumn - previousGeneratedColumn
);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
@@ -372,12 +411,14 @@ SourceMapGenerator.prototype._serializeMappings =
previousSource = sourceIdx;
// lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
next += base64VLQ.encode(
mapping.originalLine - 1 - previousOriginalLine
);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
next += base64VLQ.encode(
mapping.originalColumn - previousOriginalColumn
);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
@@ -412,33 +453,34 @@ SourceMapGenerator.prototype._generateSourcesContent =
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings(),
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(
map.sources,
map.sourceRoot
);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports.SourceMapGenerator = SourceMapGenerator;