@cedarjs/internal 6.0.0 → 7.0.0-canary.2982

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/internal",
3
- "version": "6.0.0",
3
+ "version": "7.0.0-canary.2982",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -121,14 +121,14 @@
121
121
  "@babel/parser": "7.29.8",
122
122
  "@babel/plugin-transform-typescript": "^7.26.8",
123
123
  "@babel/traverse": "7.29.8",
124
- "@cedarjs/api": "6.0.0",
125
- "@cedarjs/babel-config": "6.0.0",
126
- "@cedarjs/cli-helpers": "6.0.0",
127
- "@cedarjs/graphql-server": "6.0.0",
128
- "@cedarjs/project-config": "6.0.0",
129
- "@cedarjs/router": "6.0.0",
130
- "@cedarjs/structure": "6.0.0",
131
- "@cedarjs/utils": "6.0.0",
124
+ "@cedarjs/api": "7.0.0-canary.2982",
125
+ "@cedarjs/babel-config": "7.0.0-canary.2982",
126
+ "@cedarjs/cli-helpers": "7.0.0-canary.2982",
127
+ "@cedarjs/graphql-server": "7.0.0-canary.2982",
128
+ "@cedarjs/project-config": "7.0.0-canary.2982",
129
+ "@cedarjs/router": "7.0.0-canary.2982",
130
+ "@cedarjs/structure": "7.0.0-canary.2982",
131
+ "@cedarjs/utils": "7.0.0-canary.2982",
132
132
  "@graphql-codegen/add": "6.0.1",
133
133
  "@graphql-codegen/cli": "6.3.1",
134
134
  "@graphql-codegen/client-preset": "5.3.0",
@@ -166,7 +166,7 @@
166
166
  "vite-tsconfig-paths": "^6.1.1"
167
167
  },
168
168
  "devDependencies": {
169
- "@cedarjs/framework-tools": "6.0.0",
169
+ "@cedarjs/framework-tools": "7.0.0-canary.2982",
170
170
  "@jridgewell/trace-mapping": "0.3.31",
171
171
  "@oxc-project/types": "^0.144.0",
172
172
  "concurrently": "9.2.4",
@@ -1,33 +0,0 @@
1
- /**
2
- * For ESM projects using esbuild with `bundle: false`, rewrites extensionless
3
- * relative imports to include `.js` extension so that Node's ESM resolver can
4
- * locate the compiled output files at runtime.
5
- *
6
- * Handles both static imports (`from '../lib/db'`) and dynamic imports
7
- * (`import('../lib/db')`).
8
- *
9
- * Always outputs `.js` because esbuild with `loader: 'js'` compiles all source
10
- * files (`.ts`, `.tsx`, `.jsx`) to `.js` output. For a source file `api/src/lib/db.ts`
11
- * or `api/src/lib/db.tsx`, the output is always `api/dist/lib/db.js`, so all
12
- * import specifiers must use `.js` at runtime.
13
- *
14
- * This replaces the `resolvePath` hook in `babel-plugin-module-resolver` for
15
- * the standalone esbuild build path (`runCedarBabelTransformsPlugin`), which
16
- * was previously responsible for this extension-appending behaviour. Vite
17
- * and Rollup resolve extensions themselves during bundling; only the esbuild
18
- * `bundle: false` path needs explicit extension suffixes in the source.
19
- *
20
- * It is a plain function called inline — not an esbuild plugin — following
21
- * the same pattern as `applySrcAlias`, `applyTsconfigPaths`, etc.
22
- *
23
- * Also handles Cedar SDL files whose names include a compound extension:
24
- * `contacts.sdl.ts` compiles to `contacts.sdl.js`, so an import specifier
25
- * `../graphql/contacts.sdl` (generated by applyImportDir's glob expansion)
26
- * is rewritten to `../graphql/contacts.sdl.js`.
27
- *
28
- * Example: in `api/src/functions/graphql.ts` importing `../lib/db`, this
29
- * rewrites it to `../lib/db.js` when `api/src/lib/db.ts` (or `db.tsx`)
30
- * exists on disk.
31
- */
32
- export declare function applyEsmExtensions(code: string, fromFile: string): string;
33
- //# sourceMappingURL=esm-extensions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esm-extensions.d.ts","sourceRoot":"","sources":["../../src/build/esm-extensions.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiEzE"}
@@ -1,37 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- function applyEsmExtensions(code, fromFile) {
4
- const fromDir = path.dirname(fromFile);
5
- const rewriteImportPath = (importPath, preservePrefix, preserveSuffix) => {
6
- const existingExt = path.extname(importPath);
7
- const absImport = path.join(fromDir, importPath);
8
- if (existingExt && existingExt !== ".js" && existingExt !== ".jsx") {
9
- if (fs.existsSync(absImport + ".ts") || fs.existsSync(absImport + ".js") || fs.existsSync(absImport + ".tsx") || fs.existsSync(absImport + ".jsx")) {
10
- return preservePrefix + importPath + ".js" + preserveSuffix;
11
- }
12
- return preservePrefix + importPath + preserveSuffix;
13
- }
14
- const base = existingExt ? importPath.slice(0, -existingExt.length) : importPath;
15
- const absBase = path.join(fromDir, base);
16
- if (fs.existsSync(absBase + ".ts") || fs.existsSync(absBase + ".js") || fs.existsSync(absBase + ".tsx") || fs.existsSync(absBase + ".jsx")) {
17
- return preservePrefix + base + ".js" + preserveSuffix;
18
- }
19
- return preservePrefix + importPath + preserveSuffix;
20
- };
21
- let result = code.replace(
22
- /\bfrom\s+(['"])(\.\.?\/[^'"]+)\1/g,
23
- (match, quote, importPath) => {
24
- return `from ${rewriteImportPath(importPath, quote, quote)}`;
25
- }
26
- );
27
- result = result.replace(
28
- /\bimport\s*\(\s*(['"])(\.\.?\/[^'"]+)\1\s*\)/g,
29
- (match, quote, importPath) => {
30
- return `import(${rewriteImportPath(importPath, quote, quote)})`;
31
- }
32
- );
33
- return result;
34
- }
35
- export {
36
- applyEsmExtensions
37
- };