Skip to content

Conversation

wagenet
Copy link
Member

@wagenet wagenet commented May 17, 2022

This consolidates a lot of stuff from @ember/-internals into its relevant packages. Not only is this better organizationally, but it puts us in a better place for correctly building type exports as it reduces the number of potential import locations for the same types.

@wagenet wagenet force-pushed the internals-refactor branch from afc1b91 to a43b72c Compare May 17, 2022 19:02
isArray,
} from './lib/mixins/array';
export { default as Comparable } from './lib/mixins/comparable';
export { NativeArray } from '@ember/array';
Copy link
Member Author

Choose a reason for hiding this comment

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

We re-export here since there are tests that want this to exist in @ember/-internals. These should be revisited in the future.

export { default as ActionHandler } from './lib/mixins/action_handler';
export { default as _ProxyMixin, contentFor as _contentFor } from './lib/mixins/-proxy';
export { default as MutableEnumerable } from './lib/mixins/mutable_enumerable';
export { default as MutableEnumerable } from '@ember/enumerable/mutable';
Copy link
Member Author

Choose a reason for hiding this comment

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

We re-export here since there are tests that want this to exist in @ember/-internals. These should be revisited in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

@wagenet looking at these two comments—can you open an issue tracking it? Maybe an issue tracking both big and small work to be done for getting us to a point where we can publish individual packages (including for types), and just adding items to the list as we discover them until they're done? Or possibly a project doing the same?

@wagenet wagenet force-pushed the internals-refactor branch 3 times, most recently from 401921a to b84d592 Compare May 18, 2022 15:41
@wagenet wagenet force-pushed the internals-refactor branch from 59e7bdb to e2b4008 Compare May 31, 2022 15:35
@sandstrom
Copy link
Contributor

sandstrom commented Aug 14, 2022

Out of curiosity, is there anything holding this PR back? Seems like a lot of good stuff!

@wagenet wagenet force-pushed the internals-refactor branch from e2b4008 to dec0718 Compare August 15, 2022 15:46
@wagenet wagenet requested a review from chriskrycho August 15, 2022 15:46
@wagenet
Copy link
Member Author

wagenet commented Aug 15, 2022

@sandstrom, just waiting on proper review!

@sandstrom
Copy link
Contributor

@wagenet Alright, great! 😄

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

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

I noted a bunch of places where our @module declarations in the docs seem to have been simply wrong, and AFAICT this is one part of why the actual generated module docs are substantially less useful than might have been hoped. Between your reorganization and adding those in, I think it might make a nice win for the docs while we're still on YUIDoc (though a colleague is working on doing the work to transition us to TSDoc-powered docs, almost certainly via TypeDoc). That said… it’s possible these are intentionally only showing the top-level module, which while deeply unhelpful may be important for some other reason at the moment?

cc. @jenweber @locks: do we want to have only (for example) @ember/routing rather than @ember/routing/route for the @module declarations?


A related thought: we should consider whether we might want to introduce a public/private directory, so that you end up with this for input/output structure:

.
├── dist
│   ├── -private
│   │   ├── internal-only.d.ts
│   │   └── internal-only.js
│   └── public
│       ├── index.d.ts
│       ├── index.js
│       ├── other.d.ts
│       └── other.js
└── src
    ├── -private
    │   └── internal-only.ts
    └── public
        ├── index.ts
        └── other.ts

Once this Typedoc issue is resolved, we can theoretically start leveraging package exports maps to make it so consumers cannot use the -private directories (if we so desire), with a very straightforward per-package config:

{
  "exports": {
    ".": "./dist/public/index.js",
    "./package.json": "./package.json",
    "./*": "./dist/public/*.js"
  }
}

import Controller, { inject as injectController } from '@ember/controller';
import { A as emberA, RSVP } from '@ember/-internals/runtime';
import { A as emberA } from '@ember/array';
import { RSVP } from '@ember/-internals/runtime';
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably for a follow-on and/or just needs clarification: is this because we monkey-patch it or similar silliness, such that we cannot use the 'rsvp' import?

Copy link
Member Author

Choose a reason for hiding this comment

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

We've got extra stuff in @ember/-internals/runtime/lib/ext/rsvp.ts. Might still be fine to import from RSVP directly here though.

@wagenet wagenet force-pushed the internals-refactor branch from dec0718 to afdd7ac Compare August 24, 2022 16:56
Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

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

One more tweak, not a blocker!

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

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

Let's do it! …maybe starting by fixing CI? 😂

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants