diff --git a/.pullapprove.yml b/.pullapprove.yml index e5ec0433d6..54b5a0f874 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -279,6 +279,14 @@ groups: - IgorMinar #fallback - mhevery #fallback + elements: + conditions: + files: + - "packages/elements/*" + users: + - mhevery #primary + - IgorMinar #fallback + benchpress: conditions: files: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a7ca51af1..4278b57160 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -211,6 +211,7 @@ The following is the list of supported scopes: * **compiler** * **compiler-cli** * **core** +* **elements** * **forms** * **http** * **language-service** diff --git a/aio/tools/transforms/angular-api-package/index.js b/aio/tools/transforms/angular-api-package/index.js index 3fa94b3c87..e11b87c34b 100644 --- a/aio/tools/transforms/angular-api-package/index.js +++ b/aio/tools/transforms/angular-api-package/index.js @@ -48,6 +48,7 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage]) 'common/testing/index.ts', 'core/index.ts', 'core/testing/index.ts', + 'elements/index.ts', 'forms/index.ts', 'http/index.ts', 'http/testing/index.ts', diff --git a/aio/tools/transforms/authors-package/api-package.js b/aio/tools/transforms/authors-package/api-package.js index 541d1ac45e..5f07254b22 100644 --- a/aio/tools/transforms/authors-package/api-package.js +++ b/aio/tools/transforms/authors-package/api-package.js @@ -11,15 +11,16 @@ const { API_SOURCE_PATH } = require('../config'); const packageMap = { animations: ['animations/index.ts', 'animations/browser/index.ts', 'animations/browser/testing/index.ts'], - common: ['common/index.ts', 'common/testing/index.ts'], + common: ['common/index.ts', 'common/testing/index.ts', 'common/http/index.ts', 'common/http/testing/index.ts'], core: ['core/index.ts', 'core/testing/index.ts'], + elements: ['elements/index.ts'], forms: ['forms/index.ts'], http: ['http/index.ts', 'http/testing/index.ts'], 'platform-browser': ['platform-browser/index.ts', 'platform-browser/animations/index.ts', 'platform-browser/testing/index.ts'], 'platform-browser-dynamic': ['platform-browser-dynamic/index.ts', 'platform-browser-dynamic/testing/index.ts'], 'platform-server': ['platform-server/index.ts', 'platform-server/testing/index.ts'], 'platform-webworker': ['platform-webworker/index.ts'], - 'platform-webworker-dynamic': 'platform-webworker-dynamic/index.ts', + 'platform-webworker-dynamic': ['platform-webworker-dynamic/index.ts'], router: ['router/index.ts', 'router/testing/index.ts', 'router/upgrade/index.ts'], 'service-worker': ['service-worker/index.ts'], upgrade: ['upgrade/index.ts', 'upgrade/static/index.ts'] diff --git a/build.sh b/build.sh index 654c861b96..2a73041cde 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,8 @@ PACKAGES=(core compiler-cli language-service benchpress - service-worker) + service-worker + elements) TSC_PACKAGES=(compiler-cli language-service diff --git a/packages/elements/index.ts b/packages/elements/index.ts new file mode 100644 index 0000000000..e727e2e8a7 --- /dev/null +++ b/packages/elements/index.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// This file is not used to build this module. It is only used during editing +// by the TypeScript language service and during build for verification. `ngc` +// replaces this file with production index.ts when it rewrites private symbol +// names. + +export * from './public_api'; diff --git a/packages/elements/package.json b/packages/elements/package.json new file mode 100644 index 0000000000..81ee117cd0 --- /dev/null +++ b/packages/elements/package.json @@ -0,0 +1,22 @@ +{ + "name": "@angular/elements", + "version": "0.0.0-PLACEHOLDER", + "description": "Angular - library for using Angular in a web browser", + "main": "./bundles/elements.umd.js", + "module": "./esm5/elements.js", + "es2015": "./esm2015/elements.js", + "typings": "./elements.d.ts", + "author": "angular", + "license": "MIT", + "dependencies": { + "tslib": "^1.7.1" + }, + "peerDependencies": { + "@angular/core": "0.0.0-PLACEHOLDER", + "@angular/platform-browser": "0.0.0-PLACEHOLDER" + }, + "repository": { + "type": "git", + "url": "https://github.com/angular/angular.git" + } +} diff --git a/packages/elements/public_api.ts b/packages/elements/public_api.ts new file mode 100644 index 0000000000..13ea26ff60 --- /dev/null +++ b/packages/elements/public_api.ts @@ -0,0 +1,16 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * @module + * @description + * Entry point for all public APIs of the `elements` package. + */ +export {VERSION} from './src/version'; + +// This file only reexports content of the `src` folder. Keep it that way. diff --git a/packages/elements/rollup.config.js b/packages/elements/rollup.config.js new file mode 100644 index 0000000000..b369a06602 --- /dev/null +++ b/packages/elements/rollup.config.js @@ -0,0 +1,26 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +const resolve = require('rollup-plugin-node-resolve'); +const sourcemaps = require('rollup-plugin-sourcemaps'); + +const globals = { + '@angular/core': 'ng.core', +}; + +module.exports = { + entry: '../../dist/packages-dist/elements/esm5/elements.js', + dest: '../../dist/packages-dist/elements/bundles/elements.umd.js', + format: 'umd', + exports: 'named', + amd: {id: '@angular/elements'}, + moduleName: 'ng.elements', + plugins: [resolve(), sourcemaps()], + external: Object.keys(globals), + globals: globals +}; diff --git a/packages/elements/src/version.ts b/packages/elements/src/version.ts new file mode 100644 index 0000000000..8915bc7c70 --- /dev/null +++ b/packages/elements/src/version.ts @@ -0,0 +1,14 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +import {Version} from '@angular/core'; + +/** + * @experimental + */ +export const VERSION = new Version('0.0.0-PLACEHOLDER'); diff --git a/packages/elements/tsconfig-build.json b/packages/elements/tsconfig-build.json new file mode 100644 index 0000000000..4214dac385 --- /dev/null +++ b/packages/elements/tsconfig-build.json @@ -0,0 +1,27 @@ +{ + "extends": "../tsconfig-build.json", + + "compilerOptions": { + "baseUrl": ".", + "rootDir": ".", + "paths": { + "@angular/common": ["../../dist/packages/common"], + "@angular/core": ["../../dist/packages/core"], + "@angular/platform-browser": ["../../dist/packages/platform-browser"] + }, + "outDir": "../../dist/packages/elements" + }, + + "files": [ + "public_api.ts", + "../../node_modules/zone.js/dist/zone.js.d.ts" + ], + + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "strictMetadataEmit": false, + "skipTemplateCodegen": true, + "flatModuleOutFile": "elements.js", + "flatModuleId": "@angular/elements" + } +} diff --git a/test-main.js b/test-main.js index 6ce3887dab..4f0cd019b3 100644 --- a/test-main.js +++ b/test-main.js @@ -62,6 +62,7 @@ System.config({ '@angular/platform-server': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-webworker': {main: 'index.js', defaultExtension: 'js'}, '@angular/platform-webworker-dynamic': {main: 'index.js', defaultExtension: 'js'}, + '@angular/elements': {main: 'index.js', defaultExtension: 'js'}, } }); diff --git a/tools/cjs-jasmine/index.ts b/tools/cjs-jasmine/index.ts index 3bc4ea2c5e..9e432cf16a 100644 --- a/tools/cjs-jasmine/index.ts +++ b/tools/cjs-jasmine/index.ts @@ -62,6 +62,7 @@ var specFiles: any = '@angular/router/test/integration/bootstrap_spec.*', '@angular/integration_test/symbol_inspector/**', '@angular/upgrade/**', + '@angular/elements/**', '@angular/**/e2e_test/**', 'angular1_router/**', 'payload_tests/**', diff --git a/tools/gulp-tasks/public-api.js b/tools/gulp-tasks/public-api.js index 59d7e14d31..ba75bc06fc 100644 --- a/tools/gulp-tasks/public-api.js +++ b/tools/gulp-tasks/public-api.js @@ -28,7 +28,7 @@ const entrypoints = [ 'dist/packages-dist/service-worker/service-worker.d.ts', 'dist/packages-dist/service-worker/config.d.ts', 'dist/packages-dist/animations/browser.d.ts', 'dist/packages-dist/animations/browser/testing.d.ts', - 'dist/packages-dist/platform-browser/animations.d.ts' + 'dist/packages-dist/platform-browser/animations.d.ts', 'dist/packages-dist/elements/elements.d.ts' ]; const publicApiDir = 'tools/public_api_guard'; diff --git a/tools/public_api_guard/elements/elements.d.ts b/tools/public_api_guard/elements/elements.d.ts new file mode 100644 index 0000000000..ddf6ecf91e --- /dev/null +++ b/tools/public_api_guard/elements/elements.d.ts @@ -0,0 +1,2 @@ +/** @experimental */ +export declare const VERSION: Version; diff --git a/tools/validate-commit-message/commit-message.json b/tools/validate-commit-message/commit-message.json index 13e87f65e8..d00485d60c 100644 --- a/tools/validate-commit-message/commit-message.json +++ b/tools/validate-commit-message/commit-message.json @@ -21,6 +21,7 @@ "compiler", "compiler-cli", "core", + "elements", "forms", "http", "language-service", diff --git a/tools/validate-commit-message/validate-commit-message.spec.js b/tools/validate-commit-message/validate-commit-message.spec.js index 4b13d96071..c80d057088 100644 --- a/tools/validate-commit-message/validate-commit-message.spec.js +++ b/tools/validate-commit-message/validate-commit-message.spec.js @@ -51,19 +51,19 @@ describe('validate-commit-message.js', function() { expect(validateMessage('refactor(docs): something')).toBe(INVALID); ['INVALID COMMIT MSG: "fix(Compiler): something"\n' + ' => ERROR: "Compiler" is not an allowed scope.\n' + - ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', + ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, elements, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', 'INVALID COMMIT MSG: "feat(bah): something"\n' + ' => ERROR: "bah" is not an allowed scope.\n' + - ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', + ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, elements, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', 'INVALID COMMIT MSG: "style(webworker): something"\n' + ' => ERROR: "webworker" is not an allowed scope.\n' + - ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', + ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, elements, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', 'INVALID COMMIT MSG: "refactor(security): something"\n' + ' => ERROR: "security" is not an allowed scope.\n' + - ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', + ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, elements, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog', 'INVALID COMMIT MSG: "refactor(docs): something"\n' + ' => ERROR: "docs" is not an allowed scope.\n' + - ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog'] + ' => SCOPES: aio, animations, bazel, benchpress, common, compiler, compiler-cli, core, elements, forms, http, language-service, platform-browser, platform-browser-dynamic, platform-server, platform-webworker, platform-webworker-dynamic, router, service-worker, upgrade, packaging, changelog'] .forEach((expectedErrorMessage, index) => { expect(expectedErrorMessage).toEqual(errors[index]); });