Skip to content

Commit

Permalink
refactor(blocks): Migrate blocks/blocks.js to TypeScript (#7193)
Browse files Browse the repository at this point in the history
* refactor(blocks): Auto-migration of blocks/blocks.js to ts

* fix(blocks): Manually migrate & fix types in blocks.ts

* fix(build): Update location of blocks/blocks.ts exports object

* fix(blocks): Remove lint

* chore(blocks): Format
  • Loading branch information
cpcallen authored Jun 21, 2023
1 parent ec71261 commit b6e0842
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 49 deletions.
48 changes: 0 additions & 48 deletions blocks/blocks.js

This file was deleted.

46 changes: 46 additions & 0 deletions blocks/blocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.libraryBlocks');

import * as colour from './colour.js';
import * as lists from './lists.js';
import * as logic from './logic.js';
import * as loops from './loops.js';
import * as math from './math.js';
import * as procedures from './procedures.js';
import * as texts from './text.js';
import * as variables from './variables.js';
import * as variablesDynamic from './variables_dynamic.js';
import type {BlockDefinition} from '../core/blocks.js';

export {
colour,
lists,
loops,
math,
procedures,
texts,
variables,
variablesDynamic,
};

/**
* A dictionary of the block definitions provided by all the
* Blockly.libraryBlocks.* modules.
*/
export const blocks: {[key: string]: BlockDefinition} = Object.assign(
{},
colour.blocks,
lists.blocks,
logic.blocks,
loops.blocks,
math.blocks,
procedures.blocks,
variables.blocks,
variablesDynamic.blocks
);
2 changes: 1 addition & 1 deletion scripts/gulpfiles/build_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const chunks = [
{
name: 'blocks',
entry: path.join(TSC_OUTPUT_DIR, 'blocks', 'blocks.js'),
exports: 'module$exports$Blockly$libraryBlocks',
exports: 'module$build$src$blocks$blocks',
scriptExport: 'Blockly.libraryBlocks',
},
{
Expand Down

0 comments on commit b6e0842

Please sign in to comment.