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

Ambient Directives ♡ Dart Transformers #5129

Closed

Conversation

vsavkin
Copy link
Contributor

@vsavkin vsavkin commented Nov 4, 2015

No description provided.

@vsavkin vsavkin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 4, 2015
@kegluneq
Copy link

kegluneq commented Nov 4, 2015

I think we should change the format by which ambient directives are declared. My suggestions:

  1. The format should be package:<package>/library.dart#CORE_DIRECTIVES where library.dart lives in the lib subdir of <package>
  2. You should be able to specify more then one value as a list
  3. You should be able to specify either an individual Directive or an "alias" (list of Directives)

I'll make comments in the PR for where I think these changes could be made.

@@ -18,6 +18,7 @@ TransformerOptions parseBarbackSettings(BarbackSettings settings) {
config, REFLECT_PROPERTIES_AS_ATTRIBUTES_OLD,
defaultValue: false);
}
var ambientDirectives = config[AMBIENT_DIRECTIVES];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use (and please rename) _readFileList to smooth over differences between single values & Lists

@kegluneq kegluneq added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 4, 2015
@kegluneq kegluneq assigned vsavkin and unassigned kegluneq Nov 4, 2015
@vsavkin vsavkin force-pushed the ambient_directives_transformers branch from b89edce to a3545b5 Compare November 4, 2015 23:59
@kegluneq kegluneq added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Nov 5, 2015
@kegluneq kegluneq assigned kegluneq and unassigned vsavkin Nov 5, 2015
@@ -99,6 +103,49 @@ class _CompileDataCreator {
return new CompileDataResults._(ngMeta, compileData);
}

Future<List<CompileDirectiveMetadata>> _readAmbientDirectives() async {
if (ambientDirectives == null) return [];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: return const []

@kegluneq
Copy link

kegluneq commented Nov 5, 2015

Do you have an objection to point 1 above? If so let's discuss, otherwise PTAL.

@kegluneq kegluneq added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 5, 2015
@kegluneq kegluneq assigned vsavkin and unassigned kegluneq Nov 5, 2015
@vsavkin vsavkin force-pushed the ambient_directives_transformers branch from a3545b5 to 55c7df2 Compare November 5, 2015 01:32
@vsavkin
Copy link
Contributor Author

vsavkin commented Nov 5, 2015

Changed the format to be "package:/library.dart#CORE_DIRECTIVES".

@@ -39,6 +40,10 @@ class TransformerOptions {
/// as attributes on DOM elements, which may aid in application debugging.
final bool reflectPropertiesAsAttributes;

/// A set of directives that will be automatically passed-in to the template compiler
/// Format of an item in the list: angular2/lib/src/core/directives.dart:CORE_DIRECTIVES
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@vsavkin vsavkin force-pushed the ambient_directives_transformers branch from 55c7df2 to 4cae870 Compare November 5, 2015 17:12
return newMetadata.flatten(token);

} else {
logger.warning('Could not resolve ${token} in ${uri}');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a little more detail here:

logger.warning('Could not resolve ambient directive ${token} in ${uri}',
  asset: metaAssetId);

@kegluneq kegluneq added pr_state: LGTM and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Nov 5, 2015
@vsavkin vsavkin force-pushed the ambient_directives_transformers branch from 4cae870 to 731e1ea Compare November 5, 2015 17:24
@vsavkin vsavkin force-pushed the ambient_directives_transformers branch from 731e1ea to 153114e Compare November 5, 2015 17:25
@vsavkin vsavkin added the action: merge The PR is ready for merge by the caretaker label Nov 5, 2015
@mary-poppins
Copy link

Merging PR #5129 on behalf of @vsavkin to branch presubmit-vsavkin-pr-5129.

@mary-poppins mary-poppins removed the action: merge The PR is ready for merge by the caretaker label Nov 5, 2015
@vsavkin vsavkin closed this in 4909fed Nov 5, 2015
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants