Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
gitCreateRC: gitTasks.createRC,
gitRecompile: gitTasks.recompile,
gitUpdateGithubPages: gitTasks.updateGithubPages,
typings: typings.typings,
typings: gulp.series(typings.typings, typings.msgTypings),
package: packageTasks.package,
checkLicenses: licenseTasks.checkLicenses
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"main": "./index.js",
"umd": "./blockly.min.js",
"unpkg": "./blockly.min.js",
"types": "./blockly.d.ts",
"types": "./index.d.ts",
"browser": {
"./node.js": "./browser.js",
"./core.js": "./core-browser.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/gulpfiles/package_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function packageReadme() {
* The bundled declaration file is referenced in package.json in the types property.
*/
function packageDTS() {
return gulp.src('./typings/blockly.d.ts')
return gulp.src(['./typings/*.d.ts', './typings/msg/*.d.ts'], {base: './typings'})
.pipe(gulp.dest(`${packageDistribution}`));
};

Expand Down
19 changes: 16 additions & 3 deletions scripts/gulpfiles/typings.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function typings() {
});

const srcs = [
'typings/parts/blockly-header.d.ts',
'typings/parts/blockly-interfaces.d.ts',
'typings/templates/blockly-header.template',
'typings/templates/blockly-interfaces.template',
`${tmpDir}/core/**`,
`${tmpDir}/core/components/**`,
`${tmpDir}/core/components/tree/**`,
Expand All @@ -86,6 +86,19 @@ function typings() {
});
};

// Generates the TypeScript definition files (d.ts) for Blockly locales.
function msgTypings(cb) {
const template = fs.readFileSync(path.join('typings/templates/msg.template'), 'utf-8');
const msgFiles = fs.readdirSync(path.join('msg', 'json'));
msgFiles.forEach(msg => {
const localeName = msg.substring(0, msg.indexOf('.json'));
const msgTypings = template.slice().replace(/<%= locale %>/gi, localeName);
fs.writeFileSync(path.join('typings', 'msg', localeName + '.d.ts'), msgTypings, 'utf-8');
})
cb();
}

module.exports = {
typings: typings
typings: typings,
msgTypings: msgTypings
};
15 changes: 15 additions & 0 deletions typings/blocks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for Blockly Blocks.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="core.d.ts" />

import * as Blockly from './core';
export = Blockly.Blocks;
15 changes: 15 additions & 0 deletions typings/core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for Blockly core.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="blockly.d.ts" />

import * as Blockly from './blockly';
export = Blockly;
15 changes: 15 additions & 0 deletions typings/dart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Dart generator.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="core.d.ts" />

import * as Blockly from './core';
export = Blockly.Generator;
22 changes: 22 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for Blockly.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="core.d.ts" />
/// <reference path="blocks.d.ts" />
/// <reference path="javascript.d.ts" />
/// <reference path="msg/en.d.ts" />

import * as Blockly from './core';
import './blocks';
import './javascript';
import './msg/en';

export = Blockly;
15 changes: 15 additions & 0 deletions typings/javascript.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the JavaScript generator.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="core.d.ts" />

import * as Blockly from './core';
export = Blockly.Generator;
15 changes: 15 additions & 0 deletions typings/lua.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Lua generator.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="core.d.ts" />

import * as Blockly from './core';
export = Blockly.Generator;
16 changes: 16 additions & 0 deletions typings/msg/ab.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly ab locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/ar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly ar locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/az.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly az locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/ba.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly ba locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/bcc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly bcc locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/be-tarask.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly be-tarask locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/be.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly be locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/bg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly bg locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/bn.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly bn locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/br.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly br locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/ca.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly ca locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly constants locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/cs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly cs locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

16 changes: 16 additions & 0 deletions typings/msg/da.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Type definitions for the Blockly da locale.
* @author samelh@google.com (Sam El-Husseini)
*/

/// <reference path="msg.d.ts" />

import BlocklyMsg = Blockly.Msg;
export = BlocklyMsg;

Loading