为拆分出的顶层声明块修复导入导出关系

This commit is contained in:
ProjectXero 2023-11-17 22:28:32 +08:00
parent 4bec6aed28
commit 814424a693
No known key found for this signature in database
GPG Key ID: 5B1AA72F4425593E
366 changed files with 1386 additions and 31 deletions

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Build",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\script\\build.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
},
{
"type": "node",
"request": "launch",
"name": "Update",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\script\\update.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}

View File

@ -3,7 +3,7 @@ const { Project } = require('ts-morph');
const { createRequire } = require('module');
const { resolve: resolvePath, relative: relativePath } = require('path');
const { existsSync, readFileSync, readdirSync, mkdirSync, writeFileSync } = require('fs');
const { split } = require('./split');
const { split, replacePieces } = require('./split');
const { execSync } = require('child_process');
const basePath = resolvePath(__dirname, '..');
@ -177,18 +177,7 @@ async function build(translated) {
console.time('[translate] Total');
sourceFiles.forEach((sourceFile) => {
const pieces = split(sourceFile);
let sourceFileText = sourceFile.getFullText();
let writtenCount = 0;
pieces.sort((a, b) => b.start - a.start);
pieces.forEach((piece) => {
if (!existsSync(piece.path)) return;
const text = readFileSync(piece.path, 'utf-8');
sourceFileText = `${sourceFileText.slice(0, piece.start)}${text}${sourceFileText.slice(piece.end)}`;
writtenCount++;
});
if (writtenCount > 0) {
sourceFile.replaceWithText(sourceFileText);
}
replacePieces(sourceFile, pieces);
});
await runHooks('afterTranslate', { project, sourceFiles, dependencies });
console.timeEnd('[translate] Total');

View File

@ -1,5 +1,7 @@
const { SyntaxKind } = require('ts-morph');
const { resolve: resolvePath, relative: relativePath } = require('path');
const { SyntaxKind, ts } = require('ts-morph');
const { resolve: resolvePath, relative: relativePath, sep: pathSep } = require('path');
const { sep: pathSepPosix } = require('path/posix');
const { mkdirSync, writeFileSync, existsSync, readFileSync } = require('fs');
const basePath = resolvePath(__dirname, '..');
const translatingPath = resolvePath(basePath, 'translate-pieces');
@ -22,15 +24,33 @@ const SyntaxKindToCategory = new Map([
[SyntaxKind.ExportDeclaration, 'types']
]);
/**
* @param {SourceFile} sourceFile
*/
function split(sourceFile) {
const pieceDirectory = resolvePath(
function getSourceFilePieceDirectory(sourceFile) {
return resolvePath(
translatingPath,
relativePath(translatedPath, sourceFile.getDirectoryPath()),
sourceFile.getBaseNameWithoutExtension()
);
}
function asRelativeModulePath(from, to) {
const relativePathPlatform = relativePath(from, to);
let relativePathPosix = relativePathPlatform.replaceAll(pathSep, pathSepPosix);
if (!relativePathPosix.startsWith('.')) {
relativePathPosix = `.${pathSepPosix}${relativePathPosix}`;
}
relativePathPosix = relativePathPosix.replace(/(?:\.d)?\.ts$/, '');
return relativePathPosix;
}
const ImportPrompt = '/* IMPORT */';
const ExportPrompt = '/* EXPORT */';
/**
* @param {import('ts-morph').SourceFile} sourceFile
*/
function split(sourceFile) {
const pieceDirectory = getSourceFilePieceDirectory(sourceFile);
const pieceExports = [];
const piecePathList = [];
const pieces = [];
const packageDocumentationJSDoc = sourceFile
@ -43,12 +63,17 @@ function split(sourceFile) {
path: resolvePath(pieceDirectory, `package.d.ts`)
});
}
const sourceScopeSymbols = new Set(
sourceFile.getSymbolsInScope(ts.SymbolFlags.ModuleMember).map((e) => e.getExportSymbol() || e)
);
sourceFile.forEachChild((node) => {
if (SkippedTopLevelSyntaxKinds.includes(node.getKind())) return;
const includedSymbols = node
/** @type {import('ts-morph').Symbol[]} */
let includedSymbols = node
.getDescendants()
.map((e) => e.getSymbol())
.filter((e) => e);
.filter((e) => e !== undefined);
const scopedSymbols = includedSymbols.filter((e) => sourceScopeSymbols.has(e));
let symbol = node.getSymbol();
if (!symbol) {
symbol = includedSymbols[0];
@ -76,13 +101,124 @@ function split(sourceFile) {
if (jsdocList.length > 0) {
pieceStart = jsdocList.pop().getStart();
}
const importSymbols = [...new Set(scopedSymbols)]
.map((symbol) => {
return symbol
.getDeclarations()
.filter((decl) => {
const declSourceFile = decl.getSourceFile();
if (declSourceFile.getFilePath() === sourceFile.getFilePath()) {
if (decl.getStart() >= pieceStart && decl.getEnd() <= node.getEnd()) {
return false;
}
}
return resolvePath(declSourceFile.getFilePath()).startsWith(translatedPath);
})
.map((decl) => ({
fromName: decl.getSymbolOrThrow().getName(),
toName: symbol.getName(),
sourceFile: resolvePath(getSourceFilePieceDirectory(decl.getSourceFile()), 'index.d.ts')
}))[0];
})
.filter((e) => e !== undefined);
importSymbols.sort((a, b) => (a.toName > b.toName ? 1 : a.toName < b.toName ? -1 : 0));
const exportedSymbol = node.hasExportKeyword?.() ? null : symbol.getName();
const importGroupedByFile = {};
importSymbols.forEach((e) => {
let group = importGroupedByFile[e.sourceFile];
if (!group) {
importGroupedByFile[e.sourceFile] = group = [];
}
group.push(e.fromName === e.toName ? e.toName : `${e.fromName} as ${e.toName}`);
});
const piecePathParent = resolvePath(piecePath, '..');
const importStatements = Object.entries(importGroupedByFile).map(([fileName, imports]) => {
const fileNameRelative = asRelativeModulePath(piecePathParent, fileName);
return `import { ${imports.join(', ')} } from '${fileNameRelative}';`;
});
pieceExports.push([symbol.getName(), piecePath]);
pieces.push({
start: pieceStart,
end: node.getEnd(),
path: piecePath
path: piecePath,
imports: importStatements.map((e) => `${ImportPrompt} ${e}`).join('\n'),
exports: exportedSymbol ? `${ExportPrompt} export { ${exportedSymbol} };` : ''
});
});
const sourceIndexPieceFile = resolvePath(pieceDirectory, 'index.d.ts');
const sourceImportDeclarations = sourceFile.getImportDeclarations();
const indexImportStatements = [];
const indexExportStatements = [];
sourceImportDeclarations.forEach((e) => {
const importModulePathRelative = asRelativeModulePath(
pieceDirectory,
e.getModuleSpecifierSourceFileOrThrow().getFilePath()
);
const importClause = e.getImportClause();
const importedIdentifiers = [];
const namespaceImport = importClause.getNamespaceImport();
if (namespaceImport) {
importedIdentifiers.push(namespaceImport);
} else {
importClause.getNamedImports().forEach((spec) => {
importedIdentifiers.push(spec.getAliasNode() || spec.getNameNode());
});
}
const importedIdentifierNames = importedIdentifiers.map((e) => e.getText());
indexImportStatements.push(`import ${importClause.getFullText()} from '${importModulePathRelative}';`);
indexExportStatements.push(`export { ${importedIdentifierNames.join(', ')} };`);
});
pieceExports.forEach(([symbolName, piecePath]) => {
const piecePathRelative = asRelativeModulePath(pieceDirectory, piecePath);
indexExportStatements.push(`export { ${symbolName} } from '${piecePathRelative}';`);
});
const sourceIndexPiece = {
generated: true,
path: sourceIndexPieceFile,
content: [...indexImportStatements, ...indexExportStatements].join('\n')
};
pieces.sort((a, b) => b.start - a.start);
pieces.unshift(sourceIndexPiece);
return pieces;
}
module.exports = { split };
function writePiece(sourceFile, piece) {
mkdirSync(resolvePath(piece.path, '..'), { recursive: true });
if (piece.generated) {
writeFileSync(piece.path, piece.content);
} else {
let pieceContent = sourceFile.getFullText().slice(piece.start, piece.end);
if (piece.imports) {
pieceContent = `${piece.imports}\n\n${pieceContent}`;
}
if (piece.exports) {
pieceContent = `${pieceContent}\n\n${piece.exports}`;
}
writeFileSync(piece.path, pieceContent);
}
}
function replacePieces(sourceFile, pieces) {
let sourceFileText = sourceFile.getFullText();
let writtenCount = 0;
pieces.forEach((piece) => {
if (piece.generated || !existsSync(piece.path)) return;
const text = readFileSync(piece.path, 'utf-8')
.split('\n')
.filter((e) => !e.startsWith(ImportPrompt) && !e.startsWith(ExportPrompt))
.join('\n')
.trim();
sourceFileText = `${sourceFileText.slice(0, piece.start)}${text}${sourceFileText.slice(piece.end)}`;
writtenCount++;
});
if (writtenCount > 0) {
sourceFile.replaceWithText(sourceFileText);
}
}
module.exports = { split, writePiece, replacePieces };

View File

@ -1,8 +1,8 @@
const { execSync } = require('child_process');
const { readFileSync, writeFileSync, rmSync, mkdirSync, existsSync } = require('fs');
const { readFileSync, writeFileSync, rmSync, existsSync } = require('fs');
const { resolve: resolvePath } = require('path');
const { build } = require('./build.js');
const { split } = require('./split.js');
const { split, writePiece } = require('./split.js');
const basePath = resolvePath(__dirname, '..');
const originalPath = resolvePath(basePath, 'original');
@ -52,11 +52,7 @@ async function main() {
rmSync(translatingPath, { recursive: true, force: true });
sourceFiles.forEach((sourceFile) => {
const pieces = split(sourceFile);
const sourceFileText = sourceFile.getFullText();
pieces.forEach((piece) => {
mkdirSync(resolvePath(piece.path, '..'), { recursive: true });
writeFileSync(piece.path, sourceFileText.slice(piece.start, piece.end));
});
pieces.forEach((piece) => writePiece(sourceFile, piece));
});
// 生成 README.md

4
translate-pieces/common/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export { NumberRange } from './interfaces/NumberRange';
export { ArgumentOutOfBoundsError } from './classes/ArgumentOutOfBoundsError';
export { EngineError } from './classes/EngineError';
export { InvalidArgumentError } from './classes/InvalidArgumentError';

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { SecretString } from '../index';
/**
* A collection of server secrets defined in dedicated server
* configuration.

View File

@ -0,0 +1,7 @@
import * as minecraftcommon from '../../translated/common';
export { minecraftcommon };
export { SecretString } from './classes/SecretString';
export { ServerSecrets } from './classes/ServerSecrets';
export { ServerVariables } from './classes/ServerVariables';
export { secrets } from './variables/secrets';
export { variables } from './variables/variables';

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ServerSecrets } from '../index';
/**
* @remarks
* A globally available object that returns a list of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ServerVariables } from '../index';
/**
* @remarks
* A globally available object that returns a list of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* A cache for bedrock event subscriptions. Stores off a
* subscription by event key, and upon teardown unregisters all

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ClipboardWriteOptions, Selection, minecraftserver } from '../index';
/**
* A ClipboardItem is a handle to an object which represents a
* set of blocks in a contained bounding area (most likely

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ClipboardItem } from '../index';
/**
* The ClipboardManager (accessible from the {@link
* ExtensionContext}) is responsible for the management of all

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { CursorProperties, minecraftserver } from '../index';
/**
* The 3D block cursor is controlled through this read only
* object and provides the Editor some control over the input

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ExtensionContext, registerEditorExtension } from '../index';
/**
* Editor Extensions are the basis for all player specific,
* editor specific functionality within the game. Almost all

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ClipboardManager, Cursor, ExtensionContextAfterEvents, PlaytestManager, SelectionManager, SettingsManager, TransactionManager, minecraftserver } from '../index';
/**
* The extension context is a native (C++) object created for
* each registered Editor Extension, when a player connection

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ModeChangeAfterEventSignal } from '../index';
/**
* Contains a set of events that are available across the scope
* of the ExtensionContext.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { GraphicsSettingsPropertyTypeMap } from '../index';
/**
* Settings category that manages {@link
* GraphicsSettingsProperty} configurations.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { LogProperties } from '../index';
/**
* The logger class is a utility class which allows editor
* extensions to communicate with the player from the server to

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Extension, ExtensionContext, ExtensionOptionalParameters, Logger, SimulationState } from '../index';
/**
* The MinecraftEditor class is a namespace container for
* Editor functionality which does not have any player context.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EditorMode } from '../index';
/**
* Contains information related to changes in player editor
* mode.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ModeChangeAfterEvent } from '../index';
/**
* Manages callbacks that are connected to when a player editor
* mode changes.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { PlaytestGameOptions, PlaytestSessionResult } from '../index';
export class PlaytestManager {
private constructor();
/**

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* The Selection represents a volume in space, which may
* potentially be made up of one or more block locations.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Selection } from '../index';
/**
* The SelectionManager (accessible from the {@link
* ExtensionContext}) is responsible for the management of all

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { GraphicsSettings } from '../index';
/**
* The SettingsManager (accessible from the {@link
* ExtensionContext}) is responsible for the management all

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Selection, minecraftserver } from '../index';
/**
* The Transaction Manager is responsible for tracking and
* managing all of the registered transaction operations which

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyPane, PropertyBag } from '../index';
/**
* @remarks
* Takes the input object (a property bag of values) and bind

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Selection, minecraftserver } from '../index';
/**
* @remarks
* Executes an operation over a selection via chunks to allow

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ActivationFunctionType, Extension, IRegisterExtensionOptionalParameters, ShutdownFunctionType } from '../index';
/**
* @remarks
* Registers an editor extension into Minecraft. This function

View File

@ -0,0 +1,98 @@
import * as minecraftcommon from '../../translated/common';
import * as minecraftserver from '../../translated/server';
export { minecraftcommon };
export { minecraftserver };
export { ActionTypes } from './enums/ActionTypes';
export { ClipboardMirrorAxis } from './enums/ClipboardMirrorAxis';
export { ClipboardRotation } from './enums/ClipboardRotation';
export { CursorControlMode } from './enums/CursorControlMode';
export { CursorTargetMode } from './enums/CursorTargetMode';
export { EDITOR_PANE_PROPERTY_ITEM_TYPE } from './enums/EDITOR_PANE_PROPERTY_ITEM_TYPE';
export { EditorInputContext } from './enums/EditorInputContext';
export { EditorMode } from './enums/EditorMode';
export { EditorStatusBarAlignment } from './enums/EditorStatusBarAlignment';
export { GraphicsSettingsProperty } from './enums/GraphicsSettingsProperty';
export { InputModifier } from './enums/InputModifier';
export { KeyboardKey } from './enums/KeyboardKey';
export { KeyInputType } from './enums/KeyInputType';
export { MouseActionCategory } from './enums/MouseActionCategory';
export { MouseActionType } from './enums/MouseActionType';
export { MouseInputType } from './enums/MouseInputType';
export { PlaytestSessionResult } from './enums/PlaytestSessionResult';
export { GraphicsSettingsPropertyTypeMap } from './types/GraphicsSettingsPropertyTypeMap';
export { Action } from './types/Action';
export { ActionID } from './types/ActionID';
export { ActivationFunctionType } from './types/ActivationFunctionType';
export { ButtonVariant } from './types/ButtonVariant';
export { EventHandler } from './types/EventHandler';
export { IActionPropertyItem } from './types/IActionPropertyItem';
export { IPlayerUISession } from './types/IPlayerUISession';
export { IVector3PropertyItem } from './types/IVector3PropertyItem';
export { ModalToolLifecycleEventPayload } from './types/ModalToolLifecycleEventPayload';
export { MouseModifiers } from './types/MouseModifiers';
export { MouseProps } from './types/MouseProps';
export { MouseRayCastAction } from './types/MouseRayCastAction';
export { NoArgsAction } from './types/NoArgsAction';
export { OnChangeCallback } from './types/OnChangeCallback';
export { PropertyBag } from './types/PropertyBag';
export { PropertyPaneVisibilityUpdate } from './types/PropertyPaneVisibilityUpdate';
export { Ray } from './types/Ray';
export { RegisteredAction } from './types/RegisteredAction';
export { ShutdownFunctionType } from './types/ShutdownFunctionType';
export { SupportedKeyboardActionTypes } from './types/SupportedKeyboardActionTypes';
export { SupportedMouseActionTypes } from './types/SupportedMouseActionTypes';
export { UnregisterInputBindingCallback } from './types/UnregisterInputBindingCallback';
export { BedrockEventSubscriptionCache } from './classes/BedrockEventSubscriptionCache';
export { ClipboardItem } from './classes/ClipboardItem';
export { ClipboardManager } from './classes/ClipboardManager';
export { Cursor } from './classes/Cursor';
export { Extension } from './classes/Extension';
export { ExtensionContext } from './classes/ExtensionContext';
export { ExtensionContextAfterEvents } from './classes/ExtensionContextAfterEvents';
export { GraphicsSettings } from './classes/GraphicsSettings';
export { Logger } from './classes/Logger';
export { MinecraftEditor } from './classes/MinecraftEditor';
export { ModeChangeAfterEvent } from './classes/ModeChangeAfterEvent';
export { ModeChangeAfterEventSignal } from './classes/ModeChangeAfterEventSignal';
export { PlaytestManager } from './classes/PlaytestManager';
export { Selection } from './classes/Selection';
export { SelectionManager } from './classes/SelectionManager';
export { SettingsManager } from './classes/SettingsManager';
export { SimulationState } from './classes/SimulationState';
export { TransactionManager } from './classes/TransactionManager';
export { ClipboardWriteOptions } from './interfaces/ClipboardWriteOptions';
export { CursorProperties } from './interfaces/CursorProperties';
export { ExtensionOptionalParameters } from './interfaces/ExtensionOptionalParameters';
export { LogProperties } from './interfaces/LogProperties';
export { PlaytestGameOptions } from './interfaces/PlaytestGameOptions';
export { ActionManager } from './interfaces/ActionManager';
export { BuiltInUIManager } from './interfaces/BuiltInUIManager';
export { EventSink } from './interfaces/EventSink';
export { IDisposable } from './interfaces/IDisposable';
export { IDropdownItem } from './interfaces/IDropdownItem';
export { IEventToken } from './interfaces/IEventToken';
export { IGlobalInputManager } from './interfaces/IGlobalInputManager';
export { IMenu } from './interfaces/IMenu';
export { IMenuCreationParams } from './interfaces/IMenuCreationParams';
export { IModalTool } from './interfaces/IModalTool';
export { IModalToolContainer } from './interfaces/IModalToolContainer';
export { IPlayerLogger } from './interfaces/IPlayerLogger';
export { IPropertyItem } from './interfaces/IPropertyItem';
export { IPropertyItemOptions } from './interfaces/IPropertyItemOptions';
export { IPropertyItemOptionsBlocks } from './interfaces/IPropertyItemOptionsBlocks';
export { IPropertyItemOptionsButton } from './interfaces/IPropertyItemOptionsButton';
export { IPropertyItemOptionsDropdown } from './interfaces/IPropertyItemOptionsDropdown';
export { IPropertyItemOptionsNumber } from './interfaces/IPropertyItemOptionsNumber';
export { IPropertyItemOptionsSubPane } from './interfaces/IPropertyItemOptionsSubPane';
export { IPropertyItemOptionsVector3 } from './interfaces/IPropertyItemOptionsVector3';
export { IPropertyPane } from './interfaces/IPropertyPane';
export { IPropertyPaneOptions } from './interfaces/IPropertyPaneOptions';
export { IRegisterExtensionOptionalParameters } from './interfaces/IRegisterExtensionOptionalParameters';
export { IStatusBarItem } from './interfaces/IStatusBarItem';
export { ModalToolCreationParameters } from './interfaces/ModalToolCreationParameters';
export { bindDataSource } from './functions/bindDataSource';
export { executeLargeOperation } from './functions/executeLargeOperation';
export { getBlockPickerDefaultAllowBlockList } from './functions/getBlockPickerDefaultAllowBlockList';
export { getLocalizationId } from './functions/getLocalizationId';
export { registerEditorExtension } from './functions/registerEditorExtension';
export { editor } from './variables/editor';

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Action, RegisteredAction } from '../index';
/**
* Binds actions to the client and manages their lifetime.
* Action managers are managed on a per player basis since

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ClipboardMirrorAxis, ClipboardRotation, minecraftserver } from '../index';
/**
* Interface used to specify the options when a clipboard item
* is being written to the world

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { CursorControlMode, CursorTargetMode, minecraftserver } from '../index';
/**
* The CursorProperties interface is used to describe the
* properties of the Editor 3D block cursor construct.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EventHandler, IEventToken } from '../index';
/**
* An event that can be subscribed to. You can use the token,
* returned from the subscribe method, to clean up handlers.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EditorInputContext, InputModifier, KeyboardKey, SupportedKeyboardActionTypes } from '../index';
export interface IGlobalInputManager {
registerKeyBinding(
inputContextId: EditorInputContext,

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IMenuCreationParams, NoArgsAction, RegisteredAction } from '../index';
export interface IMenu {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EventSink, IPropertyPane, InputModifier, KeyboardKey, ModalToolLifecycleEventPayload, SupportedKeyboardActionTypes, SupportedMouseActionTypes } from '../index';
export interface IModalTool {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IModalTool, ModalToolCreationParameters } from '../index';
export interface IModalToolContainer {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EDITOR_PANE_PROPERTY_ITEM_TYPE, PropertyBag } from '../index';
export interface IPropertyItem<T extends PropertyBag, Prop extends keyof T & string> {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { OnChangeCallback, PropertyBag } from '../index';
export interface IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItemOptions } from '../index';
export interface IPropertyItemOptionsBlocks extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ButtonVariant, IPropertyItemOptions } from '../index';
export interface IPropertyItemOptionsButton extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IDropdownItem, IPropertyItemOptions } from '../index';
export interface IPropertyItemOptionsDropdown extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItemOptions } from '../index';
export interface IPropertyItemOptionsNumber extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItemOptions, IPropertyPane } from '../index';
export interface IPropertyItemOptionsSubPane extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItemOptions } from '../index';
export interface IPropertyItemOptionsVector3 extends IPropertyItemOptions {
/**
* @remarks

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { EventSink, IActionPropertyItem, IPropertyItem, IPropertyItemOptions, IPropertyItemOptionsBlocks, IPropertyItemOptionsButton, IPropertyItemOptionsDropdown, IPropertyItemOptionsNumber, IPropertyItemOptionsVector3, IPropertyPaneOptions, IVector3PropertyItem, NoArgsAction, PropertyBag, PropertyPaneVisibilityUpdate, RegisteredAction } from '../index';
/**
* Property pane present dynamic content. It can be associated
* with an object and presented with different kind of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* A properties class for the global instance of the logger
* object.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
export interface PlaytestGameOptions {
alwaysDay?: boolean;
difficulty?: minecraftserver.Difficulty;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { MouseRayCastAction, NoArgsAction } from '../index';
/**
* Full set of all possible raw actions
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IDisposable, IPlayerUISession } from '../index';
/**
* Callback type when an extension instance is activated for a
* given player. It is expected to return an array of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { GraphicsSettingsProperty } from '../index';
/**
* Defines type information for graphics settings properties.
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItem, NoArgsAction, PropertyBag, RegisteredAction } from '../index';
/**
* A property item which supports bound actions and replacing
* the bound action

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ActionManager, BedrockEventSubscriptionCache, BuiltInUIManager, EditorStatusBarAlignment, ExtensionContext, IGlobalInputManager, IMenu, IMenuCreationParams, IModalToolContainer, IPlayerLogger, IPropertyPane, IPropertyPaneOptions, IStatusBarItem } from '../index';
/**
* The IPlayerUISession represents the editor user interface
* for a given player and given extension. Extensions

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPropertyItem, PropertyBag } from '../index';
/**
* A property item which supports Vector3 properties
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { MouseActionType, MouseInputType, MouseModifiers } from '../index';
/**
* Mouse properties that provide additional information from
* client event handling

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ActionTypes, MouseProps, Ray } from '../index';
/**
* An action which returns the ray corresponding to a vector
* from the users mouse click in the viewport.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ActionTypes } from '../index';
/**
* An action which needs no additional client side arguments on
* execute

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { PropertyBag } from '../index';
/**
* Callback to execute when a value of a property item is
* updated.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* Ray representing a direction from a set location. This
* location typically corresponds to the location of a mouse

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Action, ActionID } from '../index';
/**
* A registered action is an action that has been registered
* with the action manager system and has a unique ID

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { IPlayerUISession } from '../index';
/**
* Callback type when an extension instance is shutdown for a
* given player. Used for performing any final work or clean up

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { NoArgsAction, RegisteredAction } from '../index';
/**
* Full set of all possible keyboard actions
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { MouseRayCastAction, RegisteredAction } from '../index';
/**
* Full set of all possible mouse actions
*/

View File

@ -1 +1,3 @@
/* IMPORT */ import { MinecraftEditor } from '../index';
export const editor: MinecraftEditor;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { GameTestErrorContext, GameTestErrorType } from '../index';
export class GameTestError extends Error {
private constructor();
context?: GameTestErrorContext;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* Implements a class that can be used for testing sculk
* spreading behaviors. This sculk spreader class can drive the

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
/**
* A simulated player can be used within GameTests to represent
* how a player moves throughout the world and to support

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FenceConnectivity, GameTestError, GameTestSequence, SculkSpreader, SimulatedPlayer, minecraftserver } from '../index';
/**
* Main class for GameTest functions, with helpers and data for
* manipulating the respective test. Note that all methods of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { RegistrationBuilder, Test } from '../index';
/**
* @remarks
* Registers a new GameTest function. This GameTest will become

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { RegistrationBuilder, Test } from '../index';
/**
* @remarks
* Registers a new GameTest function that is designed for

View File

@ -0,0 +1,16 @@
import * as minecraftcommon from '../../translated/common';
import * as minecraftserver from '../../translated/server';
export { minecraftcommon };
export { minecraftserver };
export { GameTestErrorType } from './enums/GameTestErrorType';
export { FenceConnectivity } from './classes/FenceConnectivity';
export { GameTestSequence } from './classes/GameTestSequence';
export { RegistrationBuilder } from './classes/RegistrationBuilder';
export { SculkSpreader } from './classes/SculkSpreader';
export { SimulatedPlayer } from './classes/SimulatedPlayer';
export { Tags } from './classes/Tags';
export { Test } from './classes/Test';
export { GameTestErrorContext } from './interfaces/GameTestErrorContext';
export { GameTestError } from './classes/GameTestError';
export { register } from './functions/register';
export { registerAsync } from './functions/registerAsync';

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserver } from '../index';
export interface GameTestErrorContext {
absolutePosition: minecraftserver.Vector3;
relativePosition: minecraftserver.Vector3;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { HttpRequest, HttpResponse } from '../index';
export class HttpClient {
private constructor();
/**

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { minecraftserveradmin } from '../index';
/**
* Represents an HTTP header - a key/value pair of
* meta-information about a request.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { HttpHeader, HttpRequestMethod, minecraftserveradmin } from '../index';
/**
* Main object for structuring a request.
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { HttpHeader, HttpRequest } from '../index';
/**
* Main object that contains result information from a request.
*/

10
translate-pieces/server-net/index.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import * as minecraftcommon from '../../translated/common';
import * as minecraftserveradmin from '../../translated/server-admin';
export { minecraftcommon };
export { minecraftserveradmin };
export { HttpRequestMethod } from './enums/HttpRequestMethod';
export { HttpClient } from './classes/HttpClient';
export { HttpHeader } from './classes/HttpHeader';
export { HttpRequest } from './classes/HttpRequest';
export { HttpResponse } from './classes/HttpResponse';
export { http } from './variables/http';

View File

@ -1 +1,3 @@
/* IMPORT */ import { HttpClient } from '../index';
export const http: HttpClient;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ActionFormResponse, minecraftserver } from '../index';
/**
* Builds a simple player form with buttons that let the player
* take action.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FormResponse } from '../index';
/**
* Returns data about the player results from a modal action
* form.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FormRejectReason } from '../index';
export class FormRejectError extends Error {
private constructor();
reason: FormRejectReason;

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FormCancelationReason } from '../index';
/**
* Base type for a form response.
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { MessageFormResponse, minecraftserver } from '../index';
/**
* Builds a simple two-button modal dialog.
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FormResponse } from '../index';
/**
* Returns data about the player results from a modal message
* form.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { ModalFormResponse, minecraftserver } from '../index';
/**
* Used to create a fully customizable pop-up form for a
* player.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { FormResponse } from '../index';
/**
* Returns data about player responses to a modal form.
*/

14
translate-pieces/server-ui/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import * as minecraftcommon from '../../translated/common';
import * as minecraftserver from '../../translated/server';
export { minecraftcommon };
export { minecraftserver };
export { FormCancelationReason } from './enums/FormCancelationReason';
export { FormRejectReason } from './enums/FormRejectReason';
export { ActionFormData } from './classes/ActionFormData';
export { ActionFormResponse } from './classes/ActionFormResponse';
export { FormResponse } from './classes/FormResponse';
export { MessageFormData } from './classes/MessageFormData';
export { MessageFormResponse } from './classes/MessageFormResponse';
export { ModalFormData } from './classes/ModalFormData';
export { ModalFormResponse } from './classes/ModalFormResponse';
export { FormRejectError } from './classes/FormRejectError';

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockComponentTypeMap, BlockComponentTypes, BlockPermutation, BlockType, Dimension, Direction, ItemStack, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError, Vector3 } from '../index';
/**
* Represents a block in a dimension. A block represents a
* unique X, Y, and Z within a dimension and get/sets the state

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Block, Component } from '../index';
/**
* Base type for components associated with blocks.
*/

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Block, Dimension } from '../index';
/**
* Contains information regarding an event that impacts a
* specific block.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockEvent, BlockPermutation, Entity } from '../index';
/**
* @beta
* Contains information regarding an explosion that has

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockExplodeAfterEvent } from '../index';
/**
* @beta
* Manages callbacks that are connected to when an explosion

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockComponent, Container, ItemStack } from '../index';
/**
* Represents the inventory of a block in the world. Used with
* blocks like chests.

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockLiquidContainerComponent } from '../index';
/**
* @beta
* Represents a fluid container block that currently contains

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockComponent } from '../index';
/**
* @beta
* For blocks that can contain a liquid (e.g., a cauldron),

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { Vector3 } from '../index';
/**
* @beta
* A BlockLocationIterator returns the next block location of

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockType, ItemStack } from '../index';
/**
* Contains the combination of type {@link BlockType} and
* properties (also sometimes called block state) which

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockComponent, Vector3 } from '../index';
/**
* @beta
* When present, this block has piston-like behavior. Contains

View File

@ -1,3 +1,5 @@
/* IMPORT */ import { BlockLiquidContainerComponent, ItemStack } from '../index';
/**
* @beta
* Represents a fluid container block that currently contains a

Some files were not shown because too many files have changed in this diff Show More