@angular/compiler-cli
Advanced tools
Comparing version 4.0.0-beta.8 to 4.0.0-rc.0
{ | ||
"name": "@angular/compiler-cli", | ||
"version": "4.0.0-beta.8", | ||
"version": "4.0.0-rc.0", | ||
"description": "Angular - the compiler CLI for Node.js", | ||
"main": "index.js", | ||
"typings": "index.d.ts", | ||
"typings": "./typings/index.d.ts", | ||
"bin": { | ||
@@ -12,3 +12,3 @@ "ngc": "./src/main.js", | ||
"dependencies": { | ||
"@angular/tsc-wrapped": "4.0.0-beta.8", | ||
"@angular/tsc-wrapped": "4.0.0-rc.0", | ||
"reflect-metadata": "^0.1.2", | ||
@@ -19,4 +19,4 @@ "minimist": "^1.2.0" | ||
"typescript": "^2.0.2", | ||
"@angular/compiler": "4.0.0-beta.8", | ||
"@angular/core": "4.0.0-beta.8" | ||
"@angular/compiler": "4.0.0-rc.0", | ||
"@angular/core": "4.0.0-rc.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "repository": { |
@@ -61,3 +61,4 @@ /** | ||
i18nFormat: cliOptions.i18nFormat, | ||
locale: cliOptions.locale | ||
locale: cliOptions.locale, | ||
enableLegacyTemplate: options.enableLegacyTemplate !== false, | ||
}).compiler; | ||
@@ -64,0 +65,0 @@ return new CodeGenerator(options, program, tsCompilerHost, aotCompiler, ngCompilerHost); |
@@ -24,3 +24,3 @@ /** | ||
var GENERATED_OR_DTS_FILES = /\.d\.ts$|\.ngfactory\.ts$|\.ngstyle\.ts$/; | ||
var SHALLOW_IMPORT = /^(\w+|(\@\w+\/\w+))$/; | ||
var SHALLOW_IMPORT = /^((\w|-)+|(@(\w|-)+(\/(\w|-)+)+))$/; | ||
var CompilerHost = (function () { | ||
@@ -34,2 +34,4 @@ function CompilerHost(program, options, context) { | ||
this.resolverCache = new Map(); | ||
this.bundleIndexCache = new Map(); | ||
this.bundleIndexNames = new Set(); | ||
// normalize the path so that it never ends with '/'. | ||
@@ -247,3 +249,13 @@ this.basePath = path.normalize(path.join(this.options.basePath, '.')).replace(/\\/g, '/'); | ||
var excludeRegex = this.options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES : GENERATED_FILES; | ||
return !excludeRegex.test(filePath); | ||
if (excludeRegex.test(filePath)) { | ||
return false; | ||
} | ||
if (DTS.test(filePath)) { | ||
// Check for a bundle index. | ||
if (this.hasBundleIndex(filePath)) { | ||
var normalFilePath = path.normalize(filePath); | ||
return this.bundleIndexNames.has(normalFilePath); | ||
} | ||
} | ||
return true; | ||
}; | ||
@@ -271,2 +283,56 @@ CompilerHost.prototype.calculateEmitPath = function (filePath) { | ||
}; | ||
CompilerHost.prototype.hasBundleIndex = function (filePath) { | ||
var _this = this; | ||
var checkBundleIndex = function (directory) { | ||
var result = _this.bundleIndexCache.get(directory); | ||
if (result == null) { | ||
if (path.basename(directory) == 'node_module') { | ||
// Don't look outside the node_modules this package is installed in. | ||
result = false; | ||
} | ||
else { | ||
// A bundle index exists if the typings .d.ts file has a metadata.json that has an | ||
// importAs. | ||
try { | ||
var packageFile = path.join(directory, 'package.json'); | ||
if (_this.context.fileExists(packageFile)) { | ||
// Once we see a package.json file, assume false until it we find the bundle index. | ||
result = false; | ||
var packageContent = JSON.parse(_this.context.readFile(packageFile)); | ||
if (packageContent.typings) { | ||
var typings = path.normalize(path.join(directory, packageContent.typings)); | ||
if (DTS.test(typings)) { | ||
var metadataFile = typings.replace(DTS, '.metadata.json'); | ||
if (_this.context.fileExists(metadataFile)) { | ||
var metadata = JSON.parse(_this.context.readFile(metadataFile)); | ||
if (metadata.importAs) { | ||
_this.bundleIndexNames.add(typings); | ||
result = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
var parent_1 = path.dirname(directory); | ||
if (parent_1 != directory) { | ||
// Try the parent directory. | ||
result = checkBundleIndex(parent_1); | ||
} | ||
else { | ||
result = false; | ||
} | ||
} | ||
} | ||
catch (e) { | ||
// If we encounter any errors assume we this isn't a bundle index. | ||
result = false; | ||
} | ||
} | ||
_this.bundleIndexCache.set(directory, result); | ||
} | ||
return result; | ||
}; | ||
return checkBundleIndex(path.dirname(filePath)); | ||
}; | ||
return CompilerHost; | ||
@@ -273,0 +339,0 @@ }()); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CompilerHost":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"Program"},{"__symbolic":"reference","module":"@angular/tsc-wrapped","name":"AngularCompilerOptions"},{"__symbolic":"error","message":"Could not resolve type","line":37,"character":25,"context":{"typeName":"CompilerHostContext"}}]}],"getCanonicalFileName":[{"__symbolic":"method"}],"moduleNameToFileName":[{"__symbolic":"method"}],"fileNameToModuleName":[{"__symbolic":"method"}],"dotRelative":[{"__symbolic":"method"}],"rewriteGenDirPath":[{"__symbolic":"method"}],"getSourceFile":[{"__symbolic":"method"}],"getMetadataFor":[{"__symbolic":"method"}],"readMetadata":[{"__symbolic":"method"}],"upgradeVersion1Metadata":[{"__symbolic":"method"}],"loadResource":[{"__symbolic":"method"}],"loadSummary":[{"__symbolic":"method"}],"getOutputFileName":[{"__symbolic":"method"}],"isSourceFile":[{"__symbolic":"method"}],"calculateEmitPath":[{"__symbolic":"method"}]}},"CompilerHostContextAdapter":{"__symbolic":"class","members":{"assumeFileExists":[{"__symbolic":"method"}]}},"ModuleResolutionHostAdapter":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"ModuleResolutionHost"}]}],"fileExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}},"NodeCompilerHostContext":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"fileExists":[{"__symbolic":"method"}],"directoryExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"CompilerHost":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"Program"},{"__symbolic":"reference","module":"@angular/tsc-wrapped","name":"AngularCompilerOptions"},{"__symbolic":"error","message":"Could not resolve type","line":37,"character":25,"context":{"typeName":"CompilerHostContext"}}]}],"getCanonicalFileName":[{"__symbolic":"method"}],"moduleNameToFileName":[{"__symbolic":"method"}],"fileNameToModuleName":[{"__symbolic":"method"}],"dotRelative":[{"__symbolic":"method"}],"rewriteGenDirPath":[{"__symbolic":"method"}],"getSourceFile":[{"__symbolic":"method"}],"getMetadataFor":[{"__symbolic":"method"}],"readMetadata":[{"__symbolic":"method"}],"upgradeVersion1Metadata":[{"__symbolic":"method"}],"loadResource":[{"__symbolic":"method"}],"loadSummary":[{"__symbolic":"method"}],"getOutputFileName":[{"__symbolic":"method"}],"isSourceFile":[{"__symbolic":"method"}],"calculateEmitPath":[{"__symbolic":"method"}]}},"CompilerHostContextAdapter":{"__symbolic":"class","members":{"assumeFileExists":[{"__symbolic":"method"}]}},"ModuleResolutionHostAdapter":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"ModuleResolutionHost"}]}],"fileExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}},"NodeCompilerHostContext":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"fileExists":[{"__symbolic":"method"}],"directoryExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CompilerHost":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"Program"},{"__symbolic":"reference","module":"@angular/tsc-wrapped","name":"AngularCompilerOptions"},{"__symbolic":"error","message":"Could not resolve type","line":39,"character":25,"context":{"typeName":"CompilerHostContext"}}]}],"getCanonicalFileName":[{"__symbolic":"method"}],"moduleNameToFileName":[{"__symbolic":"method"}],"fileNameToModuleName":[{"__symbolic":"method"}],"dotRelative":[{"__symbolic":"method"}],"rewriteGenDirPath":[{"__symbolic":"method"}],"getSourceFile":[{"__symbolic":"method"}],"getMetadataFor":[{"__symbolic":"method"}],"readMetadata":[{"__symbolic":"method"}],"upgradeVersion1Metadata":[{"__symbolic":"method"}],"loadResource":[{"__symbolic":"method"}],"loadSummary":[{"__symbolic":"method"}],"getOutputFileName":[{"__symbolic":"method"}],"isSourceFile":[{"__symbolic":"method"}],"calculateEmitPath":[{"__symbolic":"method"}],"hasBundleIndex":[{"__symbolic":"method"}]}},"CompilerHostContextAdapter":{"__symbolic":"class","members":{"assumeFileExists":[{"__symbolic":"method"}]}},"ModuleResolutionHostAdapter":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"ModuleResolutionHost"}]}],"fileExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}},"NodeCompilerHostContext":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"fileExists":[{"__symbolic":"method"}],"directoryExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"CompilerHost":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"Program"},{"__symbolic":"reference","module":"@angular/tsc-wrapped","name":"AngularCompilerOptions"},{"__symbolic":"error","message":"Could not resolve type","line":39,"character":25,"context":{"typeName":"CompilerHostContext"}}]}],"getCanonicalFileName":[{"__symbolic":"method"}],"moduleNameToFileName":[{"__symbolic":"method"}],"fileNameToModuleName":[{"__symbolic":"method"}],"dotRelative":[{"__symbolic":"method"}],"rewriteGenDirPath":[{"__symbolic":"method"}],"getSourceFile":[{"__symbolic":"method"}],"getMetadataFor":[{"__symbolic":"method"}],"readMetadata":[{"__symbolic":"method"}],"upgradeVersion1Metadata":[{"__symbolic":"method"}],"loadResource":[{"__symbolic":"method"}],"loadSummary":[{"__symbolic":"method"}],"getOutputFileName":[{"__symbolic":"method"}],"isSourceFile":[{"__symbolic":"method"}],"calculateEmitPath":[{"__symbolic":"method"}],"hasBundleIndex":[{"__symbolic":"method"}]}},"CompilerHostContextAdapter":{"__symbolic":"class","members":{"assumeFileExists":[{"__symbolic":"method"}]}},"ModuleResolutionHostAdapter":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"typescript","name":"ModuleResolutionHost"}]}],"fileExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}},"NodeCompilerHostContext":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"CompilerHostContextAdapter"},"members":{"fileExists":[{"__symbolic":"method"}],"directoryExists":[{"__symbolic":"method"}],"readFile":[{"__symbolic":"method"}],"readResource":[{"__symbolic":"method"}]}}}}] |
@@ -7,3 +7,4 @@ #!/usr/bin/env node | ||
function extract(ngOptions, cliOptions, program, host) { | ||
return extractor_1.Extractor.create(ngOptions, program, host).extract(cliOptions.i18nFormat); | ||
return extractor_1.Extractor.create(ngOptions, program, host, cliOptions.locale) | ||
.extract(cliOptions.i18nFormat, cliOptions.outFile); | ||
} | ||
@@ -10,0 +11,0 @@ // Entry point |
@@ -26,3 +26,3 @@ /** | ||
} | ||
Extractor.prototype.extract = function (formatName) { | ||
Extractor.prototype.extract = function (formatName, outFile) { | ||
var _this = this; | ||
@@ -34,3 +34,4 @@ // Checks the format and returns the extension | ||
var content = _this.serialize(bundle, ext); | ||
var dstPath = path.join(_this.options.genDir, "messages." + ext); | ||
var dstFile = outFile || "messages." + ext; | ||
var dstPath = path.join(_this.options.genDir, dstFile); | ||
_this.host.writeFile(dstPath, content, false); | ||
@@ -64,3 +65,3 @@ }); | ||
}; | ||
Extractor.create = function (options, program, tsCompilerHost, compilerHostContext, ngCompilerHost) { | ||
Extractor.create = function (options, program, tsCompilerHost, locale, compilerHostContext, ngCompilerHost) { | ||
if (!ngCompilerHost) { | ||
@@ -72,3 +73,3 @@ var usePathMapping = !!options.rootDirs && options.rootDirs.length > 0; | ||
} | ||
var ngExtractor = compiler.Extractor.create(ngCompilerHost).extractor; | ||
var ngExtractor = compiler.Extractor.create(ngCompilerHost, locale || null).extractor; | ||
return new Extractor(options, ngExtractor, tsCompilerHost, ngCompilerHost, program); | ||
@@ -75,0 +76,0 @@ }; |
@@ -92,4 +92,5 @@ /** | ||
// Create the i18n extractor. | ||
var extractor = extractor_1.Extractor.create(options.angularCompilerOptions, options.program, options.host, hostContext); | ||
return extractor.extract(options.i18nFormat); | ||
var locale = options.locale || null; | ||
var extractor = extractor_1.Extractor.create(options.angularCompilerOptions, options.program, options.host, locale, hostContext); | ||
return extractor.extract(options.i18nFormat, options.outFile || null); | ||
}; | ||
@@ -96,0 +97,0 @@ return NgTools_InternalApi_NG_2; |
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
exports.VERSION = new core_1.Version('4.0.0-beta.8'); | ||
exports.VERSION = new core_1.Version('4.0.0-rc.0'); | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"VERSION":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Version"},"arguments":["4.0.0-beta.8"]}}},{"__symbolic":"module","version":1,"metadata":{"VERSION":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Version"},"arguments":["4.0.0-beta.8"]}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"VERSION":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Version"},"arguments":["4.0.0-rc.0"]}}},{"__symbolic":"module","version":1,"metadata":{"VERSION":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Version"},"arguments":["4.0.0-rc.0"]}}}] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158872
50
1318
+ Added@angular/compiler@4.0.0-rc.0(transitive)
+ Added@angular/core@4.0.0-rc.0(transitive)
+ Added@angular/tsc-wrapped@4.0.0-rc.0(transitive)
- Removed@angular/compiler@4.0.0-beta.8(transitive)
- Removed@angular/core@4.0.0-beta.8(transitive)
- Removed@angular/tsc-wrapped@4.0.0-beta.8(transitive)