Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: lib/src/runner/runtime_utils.dart

Issue 1486473002: Convert dart_utils.js to input_sdk/lib/_internal/utils.dart (#310) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebased Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/compiler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// JS runtime files utilities used by dartdevrun. 5 /// JS runtime files utilities used by dartdevrun.
6 library dev_compiler.src.runner.runtime_utils; 6 library dev_compiler.src.runner.runtime_utils;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 import 'package:path/path.dart'; 11 import 'package:path/path.dart';
12 12
13 import '../compiler.dart' show defaultRuntimeFiles; 13 import '../compiler.dart' show defaultRuntimeFiles;
14 import '../options.dart'; 14 import '../options.dart';
15 import 'file_utils.dart'; 15 import 'file_utils.dart';
16 16
17 /// In node.js / io.js, these modules need to be aliased globally 17 /// In node.js / io.js, these modules need to be aliased globally
18 /// (e.g. `var foo = require('./path/to/foo.js')`). 18 /// (e.g. `var foo = require('./path/to/foo.js')`).
19 /// TODO(ochafik): Investigate alternative module / alias patterns. 19 /// TODO(ochafik): Investigate alternative module / alias patterns.
20 const _ALIASED_RUNTIME_FILES = const { 20 const _ALIASED_RUNTIME_FILES = const {
21 'dart_library.js': 'dart_library', 21 'dart_library.js': 'dart_library',
22 'dart_utils.js': 'dart_utils', 22 'dart/_utils.js': 'dart_utils',
23 }; 23 };
24 24
25 /// If [path] is a runtime file with an alias, returns that alias, otherwise 25 /// If [path] is a runtime file with an alias, returns that alias, otherwise
26 /// returns null. 26 /// returns null.
27 String getRuntimeFileAlias(CompilerOptions options, File file) => 27 String getRuntimeFileAlias(CompilerOptions options, File file) =>
28 file.absolute.path.startsWith(_getRuntimeDir(options).absolute.path) 28 file.absolute.path.startsWith(_getRuntimeDir(options).absolute.path)
29 ? _ALIASED_RUNTIME_FILES[basename(file.path)] 29 ? _ALIASED_RUNTIME_FILES[basename(file.path)]
30 : null; 30 : null;
31 31
32 Directory _getRuntimeDir(CompilerOptions options) => new Directory( 32 Directory _getRuntimeDir(CompilerOptions options) => new Directory(
(...skipping 15 matching lines...) Expand all
48 return files 48 return files
49 ..sort((File a, File b) { 49 ..sort((File a, File b) {
50 int pa = getPriorityIndex(a), pb = getPriorityIndex(b); 50 int pa = getPriorityIndex(a), pb = getPriorityIndex(b);
51 return pa != pb ? (pa - pb) : a.path.compareTo(b.path); 51 return pa != pb ? (pa - pb) : a.path.compareTo(b.path);
52 }); 52 });
53 } 53 }
54 54
55 /// TODO(ochafik): Split / reuse [AbstractCompiler.getModuleName]. 55 /// TODO(ochafik): Split / reuse [AbstractCompiler.getModuleName].
56 String getMainModuleName(CompilerOptions options) => 56 String getMainModuleName(CompilerOptions options) =>
57 basename(withoutExtension(options.inputs.single)); 57 basename(withoutExtension(options.inputs.single));
OLDNEW
« no previous file with comments | « lib/src/compiler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698