Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache in Host.getSourceFile #316

Open
unlight opened this issue Mar 30, 2016 · 4 comments
Open

Add cache in Host.getSourceFile #316

unlight opened this issue Mar 30, 2016 · 4 comments

Comments

@unlight
Copy link

unlight commented Mar 30, 2016

text = fs.readFileSync(fileName).toString('utf8');

Expected behavior:
Use cache when reading d.ts files

Actual behavior:
I'm using create project option and trying to build angular2

_tsProject = g.typescript.createProject("tsconfig.json", {
    typescript: require("typescript"),
    outFile: config.isProd ? "app.js" : undefined
});

When I change 1 file /rootproject/src/scripts/services/name-list.service.ts,
I see that all below files from list are reading text = fs.readFileSync(fileName).toString('utf8') is called every time.
I think, this call must be cached.

/rootproject/node_modules/angular2/typings/es6-collections/es6-collections.d.ts
/rootproject/node_modules/angular2/typings/es6-promise/es6-promise.d.ts
/rootproject/typings/browser/ambient/jasmine/index.d.ts
/rootproject/typings/browser/ambient/lodash/index.d.ts
/rootproject/typings/browser/ambient/node/index.d.ts
/rootproject/node_modules/angular2/core.d.ts
/rootproject/node_modules/angular2/src/core/metadata.d.ts
/rootproject/node_modules/angular2/src/core/metadata/di.d.ts
/rootproject/node_modules/angular2/src/facade/lang.d.ts
/rootproject/node_modules/angular2/src/core/di/metadata.d.ts
/rootproject/node_modules/angular2/src/core/metadata/directives.d.ts
/rootproject/node_modules/angular2/src/core/change_detection.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/change_detection.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/differs/iterable_differs.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/change_detector_ref.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/interfaces.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/parser/locals.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/binding_record.d.ts
/rootproject/node_modules/angular2/src/core/reflection/types.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/parser/ast.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/directive_record.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/constants.d.ts
/rootproject/node_modules/angular2/src/core/di.d.ts
/rootproject/node_modules/angular2/src/core/di/decorators.d.ts
/rootproject/node_modules/angular2/src/core/di/forward_ref.d.ts
/rootproject/node_modules/angular2/src/core/di/injector.d.ts
/rootproject/node_modules/angular2/src/core/di/provider.d.ts
/rootproject/node_modules/angular2/src/core/di/key.d.ts
/rootproject/node_modules/angular2/src/core/di/exceptions.d.ts
/rootproject/node_modules/angular2/src/facade/exceptions.d.ts
/rootproject/node_modules/angular2/src/facade/base_wrapped_exception.d.ts
/rootproject/node_modules/angular2/src/facade/exception_handler.d.ts
/rootproject/node_modules/angular2/src/core/di/opaque_token.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/differs/keyvalue_differs.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/differs/default_keyvalue_differ.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/differs/default_iterable_differ.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/parser/lexer.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/parser/parser.d.ts
/rootproject/node_modules/angular2/src/core/reflection/reflection.d.ts
/rootproject/node_modules/angular2/src/core/reflection/reflector.d.ts
/rootproject/node_modules/angular2/src/core/reflection/platform_reflection_capabilities.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/exceptions.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/proto_change_detector.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/event_binding.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/proto_record.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/jit_proto_change_detector.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/dynamic_change_detector.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/abstract_change_detector.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/pipes.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/pipe_transform.d.ts
/rootproject/node_modules/angular2/src/core/change_detection/change_detection_util.d.ts
/rootproject/node_modules/angular2/src/core/metadata/view.d.ts
/rootproject/node_modules/angular2/src/core/util/decorators.d.ts
/rootproject/node_modules/angular2/src/core/util.d.ts
/rootproject/node_modules/angular2/src/core/prod_mode.d.ts
/rootproject/node_modules/angular2/src/facade/facade.d.ts
/rootproject/node_modules/angular2/src/facade/async.d.ts
/rootproject/node_modules/angular2/src/facade/promise.d.ts
/rootproject/node_modules/rxjs/Observable.d.ts
/rootproject/node_modules/rxjs/Observer.d.ts
/rootproject/node_modules/rxjs/Operator.d.ts
/rootproject/node_modules/rxjs/Subscriber.d.ts
/rootproject/node_modules/rxjs/Subscription.d.ts
/rootproject/node_modules/rxjs/Scheduler.d.ts
/rootproject/node_modules/rxjs/scheduler/Action.d.ts
/rootproject/node_modules/rxjs/CoreOperators.d.ts
/rootproject/node_modules/rxjs/observable/ConnectableObservable.d.ts
/rootproject/node_modules/rxjs/Subject.d.ts
/rootproject/node_modules/rxjs/operator/groupBy.d.ts
/rootproject/node_modules/rxjs/Notification.d.ts
/rootproject/node_modules/rxjs/operator/combineLatest.d.ts
/rootproject/node_modules/rxjs/OuterSubscriber.d.ts
/rootproject/node_modules/rxjs/InnerSubscriber.d.ts
/rootproject/node_modules/rxjs/operator/withLatestFrom.d.ts
/rootproject/node_modules/rxjs/operator/zip.d.ts
/rootproject/node_modules/rxjs/operator/buffer.d.ts
/rootproject/node_modules/rxjs/operator/bufferCount.d.ts
/rootproject/node_modules/rxjs/operator/bufferTime.d.ts
/rootproject/node_modules/rxjs/operator/bufferToggle.d.ts
/rootproject/node_modules/rxjs/operator/bufferWhen.d.ts
/rootproject/node_modules/rxjs/operator/window.d.ts
/rootproject/node_modules/rxjs/operator/windowCount.d.ts
/rootproject/node_modules/rxjs/operator/windowTime.d.ts
/rootproject/node_modules/rxjs/operator/windowToggle.d.ts
/rootproject/node_modules/rxjs/operator/windowWhen.d.ts
/rootproject/node_modules/rxjs/operator/concat.d.ts
/rootproject/node_modules/rxjs/operator/merge.d.ts
/rootproject/node_modules/rxjs/observable/BoundCallbackObservable.d.ts
/rootproject/node_modules/rxjs/subject/AsyncSubject.d.ts
/rootproject/node_modules/rxjs/observable/BoundNodeCallbackObservable.d.ts
/rootproject/node_modules/rxjs/observable/DeferObservable.d.ts
/rootproject/node_modules/rxjs/observable/EmptyObservable.d.ts
/rootproject/node_modules/rxjs/observable/ForkJoinObservable.d.ts
/rootproject/node_modules/rxjs/observable/FromObservable.d.ts
/rootproject/node_modules/rxjs/observable/ArrayObservable.d.ts
/rootproject/node_modules/rxjs/observable/FromEventObservable.d.ts
/rootproject/node_modules/rxjs/observable/FromEventPatternObservable.d.ts
/rootproject/node_modules/rxjs/observable/PromiseObservable.d.ts
/rootproject/node_modules/rxjs/observable/IntervalObservable.d.ts
/rootproject/node_modules/rxjs/observable/TimerObservable.d.ts
/rootproject/node_modules/rxjs/operator/race.d.ts
/rootproject/node_modules/rxjs/observable/RangeObservable.d.ts
/rootproject/node_modules/rxjs/observable/NeverObservable.d.ts
/rootproject/node_modules/rxjs/observable/ErrorObservable.d.ts
/rootproject/node_modules/rxjs/observable/dom/AjaxObservable.d.ts
/rootproject/node_modules/rxjs/observable/dom/WebSocketSubject.d.ts
/rootproject/node_modules/angular2/src/core/application_ref.d.ts
/rootproject/node_modules/angular2/src/core/zone/ng_zone.d.ts
/rootproject/node_modules/angular2/src/core/zone/ng_zone_impl.d.ts
/rootproject/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts
/rootproject/node_modules/angular2/src/core/linker/compiler.d.ts
/rootproject/node_modules/angular2/src/core/linker/view_ref.d.ts
/rootproject/node_modules/angular2/src/core/linker/view.d.ts
/rootproject/node_modules/angular2/src/core/linker/element.d.ts
/rootproject/node_modules/angular2/src/core/linker/view_type.d.ts
/rootproject/node_modules/angular2/src/core/linker/element_ref.d.ts
/rootproject/node_modules/angular2/src/core/linker/view_container_ref.d.ts
/rootproject/node_modules/angular2/src/core/linker/template_ref.d.ts
/rootproject/node_modules/angular2/src/core/linker/query_list.d.ts
/rootproject/node_modules/angular2/src/core/linker/interfaces.d.ts
/rootproject/node_modules/angular2/src/core/linker/resolved_metadata_cache.d.ts
/rootproject/node_modules/angular2/src/core/linker/directive_resolver.d.ts
/rootproject/node_modules/angular2/src/core/pipes/pipe_provider.d.ts
/rootproject/node_modules/angular2/src/core/linker/pipe_resolver.d.ts
/rootproject/node_modules/angular2/src/core/render/api.d.ts
/rootproject/node_modules/angular2/src/core/pipes/pipes.d.ts
/rootproject/node_modules/angular2/src/core/linker/view_manager.d.ts
/rootproject/node_modules/angular2/src/core/application_tokens.d.ts
/rootproject/node_modules/angular2/src/core/zone.d.ts
/rootproject/node_modules/angular2/src/core/render.d.ts
/rootproject/node_modules/angular2/src/core/linker.d.ts
/rootproject/node_modules/angular2/src/core/linker/view_resolver.d.ts
/rootproject/node_modules/angular2/src/core/debug/debug_node.d.ts
/rootproject/node_modules/angular2/src/facade/collection.d.ts
/rootproject/node_modules/angular2/src/core/testability/testability.d.ts
/rootproject/node_modules/angular2/src/core/platform_directives_and_pipes.d.ts
/rootproject/node_modules/angular2/src/core/platform_common_providers.d.ts
/rootproject/node_modules/angular2/src/core/application_common_providers.d.ts
/rootproject/node_modules/angular2/common.d.ts
/rootproject/node_modules/angular2/src/common/pipes.d.ts
/rootproject/node_modules/angular2/src/common/pipes/async_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/date_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/json_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/slice_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/lowercase_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/number_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/uppercase_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/replace_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/i18n_plural_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/i18n_select_pipe.d.ts
/rootproject/node_modules/angular2/src/common/pipes/common_pipes.d.ts
/rootproject/node_modules/angular2/src/common/directives.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_class.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_for.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_if.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_style.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_switch.d.ts
/rootproject/node_modules/angular2/src/common/directives/ng_plural.d.ts
/rootproject/node_modules/angular2/src/common/directives/observable_list_diff.d.ts
/rootproject/node_modules/angular2/src/common/directives/core_directives.d.ts
/rootproject/node_modules/angular2/src/common/forms.d.ts
/rootproject/node_modules/angular2/src/common/forms/model.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/validators.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/abstract_control_directive.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/form_interface.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_control.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/control_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_control_group.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/control_container.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_control_name.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_form_control.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_model.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_form_model.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_form.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/default_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/ng_control_status.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/checkbox_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/select_control_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/radio_control_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/directives/number_value_accessor.d.ts
/rootproject/node_modules/angular2/src/common/forms/validators.d.ts
/rootproject/node_modules/angular2/src/common/forms/form_builder.d.ts
/rootproject/node_modules/angular2/src/common/common_directives.d.ts
/rootproject/src/scripts/services/name-list.service.ts
@unlight unlight changed the title Host.getSourceFile is not using cache Add cache in Host.getSourceFile Mar 30, 2016
@unlight
Copy link
Author

unlight commented Mar 30, 2016

Looks like we need to add noExternalResolve: true to prevent this, am I right?

@unlight unlight closed this as completed Mar 30, 2016
@unlight unlight reopened this Mar 30, 2016
@unlight
Copy link
Author

unlight commented Mar 30, 2016

Or maybe possible to expose it as stream similar to .dts and give caching to users (other plugins)?

@unlight
Copy link
Author

unlight commented Apr 1, 2016

Looks same #282

@ivogabe
Copy link
Owner

ivogabe commented Apr 1, 2016

I don't think this is related to #282, though it is somewhat related to #190. When that's implemented, these definition files are apart of the input stream and all files from the input stream are cached and reused.

Though, a cache could also be implemented on the location you pointed out. For me, this isn't worth the work but I would definitely accept PRs on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants