diff --git a/packages/angular_devkit/build_angular/test/utils.ts b/packages/angular_devkit/build_angular/test/utils.ts index dd4a2df08a4b..826c48524d3a 100644 --- a/packages/angular_devkit/build_angular/test/utils.ts +++ b/packages/angular_devkit/build_angular/test/utils.ts @@ -11,7 +11,7 @@ import { join, normalize } from '@angular-devkit/core'; const devkitRoot = normalize((global as any)._DevKitRoot); // tslint:disable-line:no-any -const workspaceRoot = join(devkitRoot, 'tests/@angular_devkit/build_angular/hello-world-app/'); +const workspaceRoot = join(devkitRoot, 'tests/angular_devkit/build_angular/hello-world-app/'); export const host = new TestProjectHost(workspaceRoot); export const outputPath = normalize('dist'); diff --git a/packages/angular_devkit/build_ng_packagr/src/build/index_spec_large.ts b/packages/angular_devkit/build_ng_packagr/src/build/index_spec_large.ts index f2d66cc77429..d7a6e236b1e6 100644 --- a/packages/angular_devkit/build_ng_packagr/src/build/index_spec_large.ts +++ b/packages/angular_devkit/build_ng_packagr/src/build/index_spec_large.ts @@ -13,7 +13,7 @@ import { tap } from 'rxjs/operators'; const devkitRoot = normalize((global as any)._DevKitRoot); // tslint:disable-line:no-any -const workspaceRoot = join(devkitRoot, 'tests/@angular_devkit/build_ng_packagr/ng-packaged/'); +const workspaceRoot = join(devkitRoot, 'tests/angular_devkit/build_ng_packagr/ng-packaged/'); export const host = new TestProjectHost(workspaceRoot); describe('NgPackagr Builder', () => { diff --git a/packages/angular_devkit/build_webpack/src/test-utils.ts b/packages/angular_devkit/build_webpack/src/test-utils.ts index 78ff4a1dde83..5941213dd574 100644 --- a/packages/angular_devkit/build_webpack/src/test-utils.ts +++ b/packages/angular_devkit/build_webpack/src/test-utils.ts @@ -11,7 +11,7 @@ import { join, normalize } from '@angular-devkit/core'; const devkitRoot = normalize((global as any)._DevKitRoot); // tslint:disable-line:no-any -const basicWorkspaceRoot = join(devkitRoot, 'tests/@angular_devkit/build_webpack/basic-app/'); +const basicWorkspaceRoot = join(devkitRoot, 'tests/angular_devkit/build_webpack/basic-app/'); export const basicHost = new TestProjectHost(basicWorkspaceRoot); -const angularWorkspaceRoot = join(devkitRoot, 'tests/@angular_devkit/build_webpack/angular-app/'); +const angularWorkspaceRoot = join(devkitRoot, 'tests/angular_devkit/build_webpack/angular-app/'); export const angularHost = new TestProjectHost(angularWorkspaceRoot); diff --git a/packages/angular_devkit/core/src/workspace/workspace_spec.ts b/packages/angular_devkit/core/src/workspace/workspace_spec.ts index 13c02b849258..8b69a7ce0aad 100644 --- a/packages/angular_devkit/core/src/workspace/workspace_spec.ts +++ b/packages/angular_devkit/core/src/workspace/workspace_spec.ts @@ -23,7 +23,7 @@ describe('Workspace', () => { const host = new NodeJsSyncHost(); const root = normalize(__dirname); // The content of this JSON object should be kept in sync with the path below: - // tests/@angular_devkit/workspace/angular-workspace.json + // tests/angular_devkit/core/workspace/angular-workspace.json const workspaceJson: WorkspaceSchema = { version: 1, newProjectRoot: './projects', @@ -118,7 +118,7 @@ describe('Workspace', () => { it('loads workspace from host', (done) => { const devkitRoot = normalize((global as any)._DevKitRoot); // tslint:disable-line:no-any - const workspaceRoot = join(devkitRoot, 'tests/@angular_devkit/core/workspace'); + const workspaceRoot = join(devkitRoot, 'tests/angular_devkit/core/workspace'); const workspace = new Workspace(workspaceRoot, host); workspace.loadWorkspaceFromHost(normalize('angular-workspace.json')).pipe( tap((ws) => expect(ws.getProject('app').root).toEqual(workspaceJson.projects['app'].root)), diff --git a/packages/angular_devkit/schematics/tools/file-system-engine-host_spec.ts b/packages/angular_devkit/schematics/tools/file-system-engine-host_spec.ts index 6486b4688a06..0acb0f4fc6f7 100644 --- a/packages/angular_devkit/schematics/tools/file-system-engine-host_spec.ts +++ b/packages/angular_devkit/schematics/tools/file-system-engine-host_spec.ts @@ -17,7 +17,7 @@ describe('FileSystemEngineHost', () => { const devkitRoot = (global as any)._DevKitRoot; const root = path.join( devkitRoot, - 'tests/@angular_devkit/schematics/tools/file-system-engine-host', + 'tests/angular_devkit/schematics/tools/file-system-engine-host', ); it('works', () => { diff --git a/packages/ngtools/webpack/src/paths-plugin.ts b/packages/ngtools/webpack/src/paths-plugin.ts index 2fdbecea7d9d..39d73d9f6325 100644 --- a/packages/ngtools/webpack/src/paths-plugin.ts +++ b/packages/ngtools/webpack/src/paths-plugin.ts @@ -160,15 +160,40 @@ export function resolveWithPaths( const jsFilePath = `${pathNoExtension}.js`; if (host.fileExists(pathNoExtension)) { - // This is mainly for secondary entry points - // ex: 'node_modules/@angular/core/testing.d.ts' -> 'node_modules/@angular/core/testing' - request.request = pathNoExtension; - } else if (host.fileExists(packageRootPath)) { - // Let webpack resolve the correct module format - request.request = pathDirName; - } else if (host.fileExists(jsFilePath)) { + // This is mainly for secondary entry points + // ex: 'node_modules/@angular/core/testing.d.ts' -> 'node_modules/@angular/core/testing' + request.request = pathNoExtension; + } else { + const packageJsonContent = host.readFile(packageRootPath); + let newRequest: string | undefined; + + if (packageJsonContent) { + try { + const packageJson = JSON.parse(packageJsonContent); + + // Let webpack resolve the correct module format IIF there is a module resolution field + // in the package.json. These are all official fields that Angular uses. + if (typeof packageJson.main == 'string' + || typeof packageJson.browser == 'string' + || typeof packageJson.module == 'string' + || typeof packageJson.es2015 == 'string' + || typeof packageJson.fesm5 == 'string' + || typeof packageJson.fesm2015 == 'string') { + newRequest = pathDirName; + } + } catch { + // Ignore exceptions and let it fall through (ie. if package.json file is invalid). + } + } + + if (newRequest === undefined && host.fileExists(jsFilePath)) { // Otherwise, if there is a file with a .js extension use that - request.request = jsFilePath; + newRequest = jsFilePath; + } + + if (newRequest !== undefined) { + request.request = newRequest; + } } callback(null, request); diff --git a/tests/@angular/schematics/assets/1/hello b/tests/@angular/schematics/assets/1/hello deleted file mode 100644 index cc628ccd1074..000000000000 --- a/tests/@angular/schematics/assets/1/hello +++ /dev/null @@ -1 +0,0 @@ -world diff --git a/tests/@angular/schematics/assets/1/sub/directory/file2 b/tests/@angular/schematics/assets/1/sub/directory/file2 deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/@angular/schematics/assets/1/sub/file1 b/tests/@angular/schematics/assets/1/sub/file1 deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/@angular_devkit/build_angular/hello-world-app/.editorconfig b/tests/angular_devkit/build_angular/hello-world-app/.editorconfig similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/.editorconfig rename to tests/angular_devkit/build_angular/hello-world-app/.editorconfig diff --git a/tests/@angular_devkit/build_angular/hello-world-app/.gitignore b/tests/angular_devkit/build_angular/hello-world-app/.gitignore similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/.gitignore rename to tests/angular_devkit/build_angular/hello-world-app/.gitignore diff --git a/tests/@angular_devkit/build_angular/hello-world-app/README.md b/tests/angular_devkit/build_angular/hello-world-app/README.md similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/README.md rename to tests/angular_devkit/build_angular/hello-world-app/README.md diff --git a/tests/@angular_devkit/build_angular/hello-world-app/angular.json b/tests/angular_devkit/build_angular/hello-world-app/angular.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/angular.json rename to tests/angular_devkit/build_angular/hello-world-app/angular.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/browserslist b/tests/angular_devkit/build_angular/hello-world-app/browserslist similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/browserslist rename to tests/angular_devkit/build_angular/hello-world-app/browserslist diff --git a/tests/@angular_devkit/build_angular/hello-world-app/e2e/app.e2e-spec.ts b/tests/angular_devkit/build_angular/hello-world-app/e2e/app.e2e-spec.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/e2e/app.e2e-spec.ts rename to tests/angular_devkit/build_angular/hello-world-app/e2e/app.e2e-spec.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/e2e/app.po.ts b/tests/angular_devkit/build_angular/hello-world-app/e2e/app.po.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/e2e/app.po.ts rename to tests/angular_devkit/build_angular/hello-world-app/e2e/app.po.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/e2e/tsconfig.e2e.json b/tests/angular_devkit/build_angular/hello-world-app/e2e/tsconfig.e2e.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/e2e/tsconfig.e2e.json rename to tests/angular_devkit/build_angular/hello-world-app/e2e/tsconfig.e2e.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/karma.conf.js b/tests/angular_devkit/build_angular/hello-world-app/karma.conf.js similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/karma.conf.js rename to tests/angular_devkit/build_angular/hello-world-app/karma.conf.js diff --git a/tests/@angular_devkit/build_angular/hello-world-app/package.json b/tests/angular_devkit/build_angular/hello-world-app/package.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/package.json rename to tests/angular_devkit/build_angular/hello-world-app/package.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/protractor.conf.js b/tests/angular_devkit/build_angular/hello-world-app/protractor.conf.js similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/protractor.conf.js rename to tests/angular_devkit/build_angular/hello-world-app/protractor.conf.js diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.css b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.css similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.css rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.css diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.html b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.html similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.html rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.html diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.spec.ts b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.spec.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.spec.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.spec.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.ts b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.component.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.component.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.module.ts b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.module.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.module.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.module.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/app/app.server.module.ts b/tests/angular_devkit/build_angular/hello-world-app/src/app/app.server.module.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/app/app.server.module.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/app/app.server.module.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/assets/.gitkeep b/tests/angular_devkit/build_angular/hello-world-app/src/assets/.gitkeep similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/assets/.gitkeep rename to tests/angular_devkit/build_angular/hello-world-app/src/assets/.gitkeep diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/environments/environment.prod.ts b/tests/angular_devkit/build_angular/hello-world-app/src/environments/environment.prod.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/environments/environment.prod.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/environments/environment.prod.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/environments/environment.ts b/tests/angular_devkit/build_angular/hello-world-app/src/environments/environment.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/environments/environment.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/environments/environment.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/favicon.ico b/tests/angular_devkit/build_angular/hello-world-app/src/favicon.ico similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/favicon.ico rename to tests/angular_devkit/build_angular/hello-world-app/src/favicon.ico diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/index.html b/tests/angular_devkit/build_angular/hello-world-app/src/index.html similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/index.html rename to tests/angular_devkit/build_angular/hello-world-app/src/index.html diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/main.server.ts b/tests/angular_devkit/build_angular/hello-world-app/src/main.server.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/main.server.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/main.server.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/main.ts b/tests/angular_devkit/build_angular/hello-world-app/src/main.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/main.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/main.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/polyfills.ts b/tests/angular_devkit/build_angular/hello-world-app/src/polyfills.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/polyfills.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/polyfills.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/spectrum.png b/tests/angular_devkit/build_angular/hello-world-app/src/spectrum.png similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/spectrum.png rename to tests/angular_devkit/build_angular/hello-world-app/src/spectrum.png diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/src/locale/messages.xlf b/tests/angular_devkit/build_angular/hello-world-app/src/src/locale/messages.xlf similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/src/locale/messages.xlf rename to tests/angular_devkit/build_angular/hello-world-app/src/src/locale/messages.xlf diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/styles.css b/tests/angular_devkit/build_angular/hello-world-app/src/styles.css similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/styles.css rename to tests/angular_devkit/build_angular/hello-world-app/src/styles.css diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/test.ts b/tests/angular_devkit/build_angular/hello-world-app/src/test.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/test.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/test.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.app.json b/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.app.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.app.json rename to tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.app.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json b/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json rename to tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.spec.json b/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.spec.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/tsconfig.spec.json rename to tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.spec.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/src/typings.d.ts b/tests/angular_devkit/build_angular/hello-world-app/src/typings.d.ts similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/src/typings.d.ts rename to tests/angular_devkit/build_angular/hello-world-app/src/typings.d.ts diff --git a/tests/@angular_devkit/build_angular/hello-world-app/tsconfig.json b/tests/angular_devkit/build_angular/hello-world-app/tsconfig.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/tsconfig.json rename to tests/angular_devkit/build_angular/hello-world-app/tsconfig.json diff --git a/tests/@angular_devkit/build_angular/hello-world-app/tslint.json b/tests/angular_devkit/build_angular/hello-world-app/tslint.json similarity index 100% rename from tests/@angular_devkit/build_angular/hello-world-app/tslint.json rename to tests/angular_devkit/build_angular/hello-world-app/tslint.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/.gitignore b/tests/angular_devkit/build_ng_packagr/ng-packaged/.gitignore similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/.gitignore rename to tests/angular_devkit/build_ng_packagr/ng-packaged/.gitignore diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/angular.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/angular.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/angular.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/angular.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/karma.conf.js b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/karma.conf.js similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/karma.conf.js rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/karma.conf.js diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/package.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/package.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/package.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/package.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.spec.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.spec.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.spec.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.spec.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.component.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.module.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.module.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.module.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.module.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.spec.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.spec.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.spec.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.spec.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/lib/lib.service.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/test.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/test.ts similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/test.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/test.ts diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.lib.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.lib.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.lib.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.lib.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.spec.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.spec.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.spec.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/tsconfig.spec.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/tsconfig.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/tsconfig.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/tsconfig.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/tsconfig.json diff --git a/tests/@angular_devkit/build_ng_packagr/ng-packaged/tslint.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/tslint.json similarity index 100% rename from tests/@angular_devkit/build_ng_packagr/ng-packaged/tslint.json rename to tests/angular_devkit/build_ng_packagr/ng-packaged/tslint.json diff --git a/tests/@angular_devkit/build_webpack/angular-app/.gitignore b/tests/angular_devkit/build_webpack/angular-app/.gitignore similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/.gitignore rename to tests/angular_devkit/build_webpack/angular-app/.gitignore diff --git a/tests/@angular_devkit/build_webpack/angular-app/angular.json b/tests/angular_devkit/build_webpack/angular-app/angular.json similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/angular.json rename to tests/angular_devkit/build_webpack/angular-app/angular.json diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.css b/tests/angular_devkit/build_webpack/angular-app/src/app/app.component.css similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.css rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.component.css diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.html b/tests/angular_devkit/build_webpack/angular-app/src/app/app.component.html similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.html rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.component.html diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.spec.ts b/tests/angular_devkit/build_webpack/angular-app/src/app/app.component.spec.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.spec.ts rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.component.spec.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.ts b/tests/angular_devkit/build_webpack/angular-app/src/app/app.component.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.component.ts rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.component.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.module.ts b/tests/angular_devkit/build_webpack/angular-app/src/app/app.module.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.module.ts rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.module.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/app/app.server.module.ts b/tests/angular_devkit/build_webpack/angular-app/src/app/app.server.module.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/app/app.server.module.ts rename to tests/angular_devkit/build_webpack/angular-app/src/app/app.server.module.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/assets/.gitkeep b/tests/angular_devkit/build_webpack/angular-app/src/assets/.gitkeep similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/assets/.gitkeep rename to tests/angular_devkit/build_webpack/angular-app/src/assets/.gitkeep diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/environments/environment.prod.ts b/tests/angular_devkit/build_webpack/angular-app/src/environments/environment.prod.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/environments/environment.prod.ts rename to tests/angular_devkit/build_webpack/angular-app/src/environments/environment.prod.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/environments/environment.ts b/tests/angular_devkit/build_webpack/angular-app/src/environments/environment.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/environments/environment.ts rename to tests/angular_devkit/build_webpack/angular-app/src/environments/environment.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/main.ts b/tests/angular_devkit/build_webpack/angular-app/src/main.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/main.ts rename to tests/angular_devkit/build_webpack/angular-app/src/main.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/polyfills.ts b/tests/angular_devkit/build_webpack/angular-app/src/polyfills.ts similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/polyfills.ts rename to tests/angular_devkit/build_webpack/angular-app/src/polyfills.ts diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/src/locale/messages.xlf b/tests/angular_devkit/build_webpack/angular-app/src/src/locale/messages.xlf similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/src/locale/messages.xlf rename to tests/angular_devkit/build_webpack/angular-app/src/src/locale/messages.xlf diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/styles.css b/tests/angular_devkit/build_webpack/angular-app/src/styles.css similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/styles.css rename to tests/angular_devkit/build_webpack/angular-app/src/styles.css diff --git a/tests/@angular_devkit/build_webpack/angular-app/src/tsconfig.app.json b/tests/angular_devkit/build_webpack/angular-app/src/tsconfig.app.json similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/src/tsconfig.app.json rename to tests/angular_devkit/build_webpack/angular-app/src/tsconfig.app.json diff --git a/tests/@angular_devkit/build_webpack/angular-app/tsconfig.json b/tests/angular_devkit/build_webpack/angular-app/tsconfig.json similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/tsconfig.json rename to tests/angular_devkit/build_webpack/angular-app/tsconfig.json diff --git a/tests/@angular_devkit/build_webpack/angular-app/webpack.config.js b/tests/angular_devkit/build_webpack/angular-app/webpack.config.js similarity index 100% rename from tests/@angular_devkit/build_webpack/angular-app/webpack.config.js rename to tests/angular_devkit/build_webpack/angular-app/webpack.config.js diff --git a/tests/@angular_devkit/build_webpack/basic-app/.gitignore b/tests/angular_devkit/build_webpack/basic-app/.gitignore similarity index 100% rename from tests/@angular_devkit/build_webpack/basic-app/.gitignore rename to tests/angular_devkit/build_webpack/basic-app/.gitignore diff --git a/tests/@angular_devkit/build_webpack/basic-app/angular.json b/tests/angular_devkit/build_webpack/basic-app/angular.json similarity index 100% rename from tests/@angular_devkit/build_webpack/basic-app/angular.json rename to tests/angular_devkit/build_webpack/basic-app/angular.json diff --git a/tests/@angular_devkit/build_webpack/basic-app/src/main.js b/tests/angular_devkit/build_webpack/basic-app/src/main.js similarity index 100% rename from tests/@angular_devkit/build_webpack/basic-app/src/main.js rename to tests/angular_devkit/build_webpack/basic-app/src/main.js diff --git a/tests/@angular_devkit/build_webpack/basic-app/webpack.config.js b/tests/angular_devkit/build_webpack/basic-app/webpack.config.js similarity index 100% rename from tests/@angular_devkit/build_webpack/basic-app/webpack.config.js rename to tests/angular_devkit/build_webpack/basic-app/webpack.config.js diff --git a/tests/@angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts b/tests/angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts similarity index 100% rename from tests/@angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts rename to tests/angular_devkit/core/json/schema/serializers/0.0.javascript_spec.ts diff --git a/tests/@angular_devkit/core/json/schema/serializers/0.schema.json b/tests/angular_devkit/core/json/schema/serializers/0.schema.json similarity index 100% rename from tests/@angular_devkit/core/json/schema/serializers/0.schema.json rename to tests/angular_devkit/core/json/schema/serializers/0.schema.json diff --git a/tests/@angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts b/tests/angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts similarity index 100% rename from tests/@angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts rename to tests/angular_devkit/core/json/schema/serializers/1.0.javascript_spec.ts diff --git a/tests/@angular_devkit/core/json/schema/serializers/1.schema.json b/tests/angular_devkit/core/json/schema/serializers/1.schema.json similarity index 100% rename from tests/@angular_devkit/core/json/schema/serializers/1.schema.json rename to tests/angular_devkit/core/json/schema/serializers/1.schema.json diff --git a/tests/@angular_devkit/core/json/schema/serializers/schema_benchmark.json b/tests/angular_devkit/core/json/schema/serializers/schema_benchmark.json similarity index 100% rename from tests/@angular_devkit/core/json/schema/serializers/schema_benchmark.json rename to tests/angular_devkit/core/json/schema/serializers/schema_benchmark.json diff --git a/tests/@angular_devkit/core/workspace/angular-workspace.json b/tests/angular_devkit/core/workspace/angular-workspace.json similarity index 100% rename from tests/@angular_devkit/core/workspace/angular-workspace.json rename to tests/angular_devkit/core/workspace/angular-workspace.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases-dupe/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/aliases-dupe/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases-dupe/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/aliases-dupe/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases-many/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/aliases-many/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases-many/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/aliases-many/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/aliases/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/aliases/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/aliases/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-basic-string/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-basic-string/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-basic-string/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-basic-string/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-basic/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-basic/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-basic/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-basic/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-deep/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-deep/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-deep/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-deep/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-middle/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-middle/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-middle/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-middle/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-multiple/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-multiple/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular-multiple/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular-multiple/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-circular/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-circular/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-deep/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-deep/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-deep/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-deep/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-multiple/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-multiple/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-multiple/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-multiple/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-replace/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extends-replace/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extends-replace/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extends-replace/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extra-properties/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extra-properties/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts b/tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts rename to tests/angular_devkit/schematics/tools/file-system-engine-host/extra-properties/factory.ts diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/hidden-schematics/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/hidden-schematics/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/hidden-schematics/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/hidden-schematics/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases-2/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases-2/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases-2/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases-2/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/invalid-aliases/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts b/tests/angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts rename to tests/angular_devkit/schematics/tools/file-system-engine-host/null-factory.ts diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/private-schematics/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/private-schematics/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/private-schematics/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/private-schematics/collection.json diff --git a/tests/@angular_devkit/schematics/tools/file-system-engine-host/works/collection.json b/tests/angular_devkit/schematics/tools/file-system-engine-host/works/collection.json similarity index 100% rename from tests/@angular_devkit/schematics/tools/file-system-engine-host/works/collection.json rename to tests/angular_devkit/schematics/tools/file-system-engine-host/works/collection.json diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/aotplugin.config.json b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/aotplugin.config.json new file mode 100644 index 000000000000..1f181c28076a --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/aotplugin.config.json @@ -0,0 +1,4 @@ +{ + "tsConfigPath": "./src/tsconfig.json", + "mainPath": "app/main.jit.ts" +} \ No newline at end of file diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/package.json b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/package.json new file mode 100644 index 000000000000..4a2637e90a24 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/package.json @@ -0,0 +1,29 @@ +{ + "name": "test", + "license": "MIT", + "dependencies": { + "@angular/common": "^5.0.0-rc.8", + "@angular/compiler": "^5.0.0-rc.8", + "@angular/compiler-cli": "^5.0.0-rc.8", + "@angular/core": "^5.0.0-rc.8", + "@angular/http": "^5.0.0-rc.8", + "@angular/platform-browser": "^5.0.0-rc.8", + "@angular/platform-browser-dynamic": "^5.0.0-rc.8", + "@angular/platform-server": "^5.0.0-rc.8", + "@angular/router": "^5.0.0-rc.8", + "@ngtools/webpack": "0.0.0", + "core-js": "^2.4.1", + "rxjs": "^5.5.0", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "node-sass": "^4.7.0", + "performance-now": "^0.2.0", + "preprocess-loader": "^0.2.2", + "raw-loader": "^0.5.1", + "sass-loader": "^6.0.0", + "typescript": "~2.4.2", + "webpack": "~4.0.1", + "webpack-cli": "~2.0.9" + } +} diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/app.module.ts b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/app.module.ts new file mode 100644 index 000000000000..1820fbcaf22e --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/app.module.ts @@ -0,0 +1,29 @@ +/** + * @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 { Component, NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { Foo } from 'foo/foo'; + +console.log(Foo); // Make sure it's used. + +@Component({ + selector: 'home-view', + template: 'home!', +}) +export class HomeView {} + +@NgModule({ + declarations: [ + HomeView, + ], + imports: [ + BrowserModule, + ], + bootstrap: [HomeView], +}) +export class AppModule { } diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/main.jit.ts b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/main.jit.ts new file mode 100644 index 000000000000..0a705a5daebb --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/app/main.jit.ts @@ -0,0 +1,5 @@ +import 'core-js/es7/reflect'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; +import {AppModule} from './app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.d.ts b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.d.ts new file mode 100644 index 000000000000..c1e8a56b1a8d --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.d.ts @@ -0,0 +1,9 @@ +/** + * @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 + */ + +export class Foo {} diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.js b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.js new file mode 100644 index 000000000000..77fd187ca683 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/foo.js @@ -0,0 +1,6 @@ + +console.log('NGTOOLS_WEBPACK_TEST_WRONG_FILE'); + +module.exports = { + Foo: () => {}, // Empty "class". +}; diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/package.json b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/package.json new file mode 100644 index 000000000000..df34a12157e2 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/package.json @@ -0,0 +1,3 @@ +{ + "main": "right/foo.js" +} diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/right/foo.js b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/right/foo.js new file mode 100644 index 000000000000..9947c559a8af --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/foo/right/foo.js @@ -0,0 +1,6 @@ + +console.log('NGTOOLS_WEBPACK_TEST_RIGHT_FILE'); + +module.exports = { + Foo: () => {}, // Empty "class". +}; diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/index.html b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/index.html new file mode 100644 index 000000000000..89fb0893c35d --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/index.html @@ -0,0 +1,12 @@ + + + + Document + + + + + + + + diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/tsconfig.json b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/tsconfig.json new file mode 100644 index 000000000000..fd2f8b66e964 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/src/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "es2015", + "moduleResolution": "node", + "target": "es5", + "baseUrl": ".", + "noImplicitAny": false, + "sourceMap": true, + "mapRoot": "", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "lib": [ + "es2017", + "dom" + ], + "outDir": "lib", + "skipLibCheck": true, + "rootDir": ".", + "paths": { + "foo/*": [ + "./foo/*", + "*" + ] + } + }, + "angularCompilerOptions": { + "genDir": "app/generated/", + "entryModule": "app/app.module#AppModule" + } +} diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.config.js b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.config.js new file mode 100644 index 000000000000..5175b36bb722 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.config.js @@ -0,0 +1,45 @@ +/** + * @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 ngToolsWebpack = require('@ngtools/webpack'); +const path = require('path'); + +const flags = require('./webpack.flags.json'); + +const preprocessLoader = 'preprocess-loader' + (flags.DEBUG ? '?+DEBUG' : ''); + + +module.exports = { + resolve: { + extensions: ['.ts', '.js'] + }, + entry: './src/app/main.jit.ts', + output: { + path: path.resolve('./dist'), + publicPath: 'dist/', + filename: 'app.main.js' + }, + plugins: [ + new ngToolsWebpack.AngularCompilerPlugin(require('./aotplugin.config.json')) + ], + module: { + rules: [ + { test: /\.scss$/, loaders: ['raw-loader', 'sass-loader', preprocessLoader] }, + { test: /\.css$/, loader: 'raw-loader' }, + { test: /\.html$/, loaders: ['raw-loader', preprocessLoader] }, + // Use preprocess to remove DEBUG only code. + // @ngtools/webpack must be the first (right most) loader. + { test: /\.ts$/, use: [ + { loader: preprocessLoader }, + { loader: '@ngtools/webpack' } + ] } + ] + }, + devServer: { + historyApiFallback: true + } +}; diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.flags.json b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.flags.json new file mode 100644 index 000000000000..aac05f738dc8 --- /dev/null +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-path-mapping/webpack.flags.json @@ -0,0 +1,3 @@ +{ + "DEBUG": false +} diff --git a/tests/legacy-cli/e2e/tests/packages/webpack/test-path-mapping.ts b/tests/legacy-cli/e2e/tests/packages/webpack/test-path-mapping.ts new file mode 100644 index 000000000000..9e72e6d0d23d --- /dev/null +++ b/tests/legacy-cli/e2e/tests/packages/webpack/test-path-mapping.ts @@ -0,0 +1,13 @@ +import {normalize} from 'path'; +import {createProjectFromAsset} from '../../../utils/assets'; +import {exec} from '../../../utils/process'; +import {expectFileSizeToBeUnder, replaceInFile, expectFileToMatch} from '../../../utils/fs'; + + +export default function(skipCleaning: () => void) { + return Promise.resolve() + .then(() => createProjectFromAsset('webpack/test-app-path-mapping')) + .then(() => exec(normalize('node_modules/.bin/webpack-cli'))) + .then(() => expectFileToMatch('dist/app.main.js', 'NGTOOLS_WEBPACK_TEST_RIGHT_FILE')) + .then(() => skipCleaning()); +}