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

Update release-deps #2070

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Update release-deps #2070

wants to merge 1 commit into from

Conversation

NullVoxPopuli
Copy link
Collaborator

No description provided.

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Aug 21, 2024

Something seems convinced that @ember/string is a v1 addon.
that's sometimes true, but not always. 🤔

A module tried to resolve "@ember/string" and didn't find it (v1 package without auto-import)

OR maybe I'm reading it wrong, and it's saying that "a module" is a v1 addon, and that v1 addon needs auto-import.

ah-ha!

running with vite reveals that the problem comes from ember-data:


 [plugin embroider-esbuild-resolver]

    node_modules/.embroider/rewritten-packages/@ember-data/serializer.de043e00/node_modules/@ember-data/serializer/embedded-records-mixin-d75385ff.js:4:25:
      4 │ import { camelize } from '@ember/string';
        ╵                          ~~~~~~~~~~~~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/@embroider/vite/src/esbuild-resolver.js:51:18:
      51 │             build.onResolve({ filter: /./ }, async ({ path, importer, pluginData, kind }) => {
         ╵                   ~~~~~~~~~

Here is the package.json for @ember-data/serializer@5.3:

here
{
  "name": "@ember-data/serializer",
  "version": "5.3.0",
  "description": "Provides Legacy JSON, JSON:API and REST Implementations of the Serializer Interface for use with @ember-data/store",
  "keywords": [
    "ember-addon"
  ],
  "repository": {
    "type": "git",
    "url": "git+ssh://git@github.com:emberjs/data.git",
    "directory": "packages/serializer"
  },
  "license": "MIT",
  "author": "",
  "directories": {},
  "ember-addon": {
    "main": "addon-main.js",
    "type": "addon",
    "version": 1
  },
  "files": [
    "blueprints",
    "addon-main.js",
    "addon",
    "README.md",
    "LICENSE.md",
    "ember-data-logo-dark.svg",
    "ember-data-logo-light.svg"
  ],
  "peerDependencies": {
    "@ember/string": "^3.1.1",
    "ember-inflector": "^4.0.2"
  },
  "dependenciesMeta": {
    "@ember-data/private-build-infra": {
      "injected": true
    },
    "@ember/string": {
      "injected": true
    }
  },
  "dependencies": {
    "@ember-data/private-build-infra": "5.3.0",
    "@embroider/macros": "^1.13.1",
    "ember-cli-babel": "^8.0.0",
    "ember-cli-test-info": "^1.0.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.22.15",
    "@babel/core": "^7.22.19",
    "@babel/plugin-proposal-decorators": "^7.22.15",
    "@babel/plugin-transform-class-properties": "^7.22.5",
    "@babel/plugin-transform-private-methods": "^7.22.5",
    "@babel/plugin-transform-runtime": "^7.22.15",
    "@babel/plugin-transform-typescript": "^7.22.15",
    "@babel/preset-env": "^7.22.15",
    "@babel/preset-typescript": "^7.22.15",
    "@babel/runtime": "^7.22.15",
    "@ember-data/store": "5.3.0",
    "@embroider/addon-dev": "^4.1.0",
    "@glimmer/component": "^1.1.2",
    "@rollup/plugin-babel": "^6.0.3",
    "@rollup/plugin-node-resolve": "^15.2.1",
    "ember-source": "~5.2.0",
    "rollup": "^3.29.1",
    "tslib": "^2.6.2",
    "typescript": "^5.2.2",
    "walk-sync": "^3.0.0",
    "webpack": "^5.88.2"
  },
  "engines": {
    "node": "16.* || >= 18.*"
  },
  "volta": {
    "extends": "../../package.json"
  },
  "packageManager": "pnpm@8.7.5",
  "scripts": {
    "build": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
    "start": "rollup --config --watch"
  }
}

This is a v1 addon, and there is no ember-auto-import..

Now, this is only an issue when an app tries to use @ember/string @ v4 (a v2 addon).

Ideally, I would think we allow a duplicate to occur, and have ember-data use @ember/string @ v3, and the app just uses v4 -- I wonder if this is something that will be fixed by the removal of the written stuff?

For ember-data, specifically, it appears that 5.4 (currently alpha) is a v2 addon, https://github.com/emberjs/data/blob/main/packages/serializer/package.json#L25 (and they dropped @ember/string).

But updating to newer ember-data would work around the problem.

There are some PRs to widen the range of @ember/string in ember-data:

But they'd probably need to be backported to 5.3 and 4.12 -- which means that any package that depends on @ember/string or ember-inflector will need to also declare ember-auto-import.
(Though, this is a bit of unknown territory for me, because peers with v1 addons are / were not common)

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

Successfully merging this pull request may close these issues.

1 participant