@embroider/vite 0.2.1-unstable.fad2387 → 0.2.2-unstable.0552afa
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/LICENSE +21 -0
- package/index.d.ts +1 -0
- package/index.mjs +2 -0
- package/package.json +27 -20
- package/src/assets.js +18 -46
- package/src/assets.js.map +1 -1
- package/src/build.d.ts +1 -1
- package/src/build.js +18 -21
- package/src/build.js.map +1 -1
- package/src/classic-ember-support.d.ts +1 -0
- package/src/classic-ember-support.js +9 -0
- package/src/classic-ember-support.js.map +1 -0
- package/src/content-for.js +7 -9
- package/src/content-for.js.map +1 -1
- package/src/ember.d.ts +6 -0
- package/src/ember.js +43 -0
- package/src/ember.js.map +1 -0
- package/src/esbuild-request.d.ts +30 -17
- package/src/esbuild-request.js +104 -61
- package/src/esbuild-request.js.map +1 -1
- package/src/esbuild-resolver.d.ts +1 -1
- package/src/esbuild-resolver.js +132 -95
- package/src/esbuild-resolver.js.map +1 -1
- package/src/hbs.js +60 -106
- package/src/hbs.js.map +1 -1
- package/src/optimize-deps.js +3 -7
- package/src/optimize-deps.js.map +1 -1
- package/src/request.d.ts +15 -18
- package/src/request.js +55 -87
- package/src/request.js.map +1 -1
- package/src/resolver.js +123 -22
- package/src/resolver.js.map +1 -1
- package/src/scripts.js +14 -40
- package/src/scripts.js.map +1 -1
- package/src/template-tag.js +5 -40
- package/src/template-tag.js.map +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Edward Faulkner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/index.d.ts
CHANGED
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/vite",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
3
|
+
"version": "0.2.2-unstable.0552afa",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"default": "./index.mjs",
|
|
8
|
+
"types": "./index.d.ts"
|
|
9
|
+
}
|
|
8
10
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"vite": "^5.2.0",
|
|
13
|
+
"@embroider/core": "^3.4.20-unstable.0552afa"
|
|
11
14
|
},
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@babel/core": "^7.22.9",
|
|
14
|
-
"@
|
|
15
|
-
"@rollup/pluginutils": "^4.1.1",
|
|
17
|
+
"@rollup/pluginutils": "^5.1.0",
|
|
16
18
|
"assert-never": "^1.2.1",
|
|
17
|
-
"content-tag": "^2.0.
|
|
19
|
+
"content-tag": "^2.0.2",
|
|
18
20
|
"debug": "^4.3.2",
|
|
19
21
|
"esbuild": "^0.17.19",
|
|
22
|
+
"fast-glob": "^3.3.2",
|
|
20
23
|
"fs-extra": "^10.0.0",
|
|
21
|
-
"jsdom": "^
|
|
24
|
+
"jsdom": "^25.0.0",
|
|
25
|
+
"send": "^0.18.0",
|
|
22
26
|
"source-map-url": "^0.4.1",
|
|
23
27
|
"terser": "^5.7.0",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
28
|
+
"@embroider/macros": "1.16.10-unstable.0552afa",
|
|
29
|
+
"@embroider/reverse-exports": "0.1.1-unstable.0552afa"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
|
-
"@embroider/core": "3.4.8-unstable.fad2387",
|
|
29
32
|
"@types/babel__core": "^7.20.1",
|
|
30
|
-
"@types/send": "^0.17.4",
|
|
31
33
|
"@types/debug": "^4.1.5",
|
|
32
|
-
"@types/jsdom": "^16.2.11",
|
|
33
34
|
"@types/fs-extra": "^9.0.12",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
35
|
+
"@types/jsdom": "^16.2.11",
|
|
36
|
+
"@types/send": "^0.17.4",
|
|
37
|
+
"rollup": "^4.18.0",
|
|
38
|
+
"vite": "^5.3.3",
|
|
39
|
+
"@embroider/core": "^3.4.20-unstable.0552afa"
|
|
36
40
|
},
|
|
37
41
|
"files": [
|
|
38
42
|
"index.mjs",
|
|
@@ -40,5 +44,8 @@
|
|
|
40
44
|
"src/**/*.js",
|
|
41
45
|
"src/**/*.d.ts",
|
|
42
46
|
"src/**/*.js.map"
|
|
43
|
-
]
|
|
44
|
-
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "jest"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/assets.js
CHANGED
|
@@ -1,37 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.assets = void 0;
|
|
30
|
-
const core_1 = require("@embroider/core");
|
|
31
|
-
const process = __importStar(require("process"));
|
|
32
|
-
const path_1 = require("path");
|
|
33
|
-
const fs_extra_1 = require("fs-extra");
|
|
34
|
-
const send_1 = __importDefault(require("send"));
|
|
1
|
+
import core from '@embroider/core';
|
|
2
|
+
const { ResolverLoader } = core;
|
|
3
|
+
import * as process from 'process';
|
|
4
|
+
import { join, posix } from 'path';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
const { existsSync, readFileSync, lstatSync } = fs;
|
|
7
|
+
import send from 'send';
|
|
35
8
|
function findPublicAsset(relativePath, resolver) {
|
|
36
9
|
var _a;
|
|
37
10
|
const packageCache = resolver.packageCache;
|
|
@@ -40,18 +13,18 @@ function findPublicAsset(relativePath, resolver) {
|
|
|
40
13
|
for (const addon of engine.activeAddons) {
|
|
41
14
|
pkg = packageCache.ownerOfFile(addon.root);
|
|
42
15
|
if (pkg && pkg.meta && pkg.isV2Addon() && pkg.meta['public-assets']) {
|
|
43
|
-
const asset = (_a = Object.entries(pkg.meta['public-assets']).find(([_key, a]) =>
|
|
44
|
-
let local = asset ?
|
|
45
|
-
if (local &&
|
|
16
|
+
const asset = (_a = Object.entries(pkg.meta['public-assets']).find(([_key, a]) => posix.resolve('/', a) === relativePath)) === null || _a === void 0 ? void 0 : _a[0];
|
|
17
|
+
let local = asset ? join(addon.root, asset) : null;
|
|
18
|
+
if (local && existsSync(local)) {
|
|
46
19
|
return local;
|
|
47
20
|
}
|
|
48
21
|
}
|
|
49
22
|
}
|
|
50
23
|
}
|
|
51
24
|
}
|
|
52
|
-
function assets() {
|
|
25
|
+
export function assets() {
|
|
53
26
|
const cwd = process.cwd();
|
|
54
|
-
const resolverLoader = new
|
|
27
|
+
const resolverLoader = new ResolverLoader(cwd);
|
|
55
28
|
let mode = 'build';
|
|
56
29
|
let publicDir = 'public';
|
|
57
30
|
return {
|
|
@@ -67,7 +40,7 @@ function assets() {
|
|
|
67
40
|
if (req.originalUrl && req.originalUrl.length > 1) {
|
|
68
41
|
const assetUrl = findPublicAsset(req.originalUrl.split('?')[0], resolverLoader.resolver);
|
|
69
42
|
if (assetUrl) {
|
|
70
|
-
return (
|
|
43
|
+
return send(req, assetUrl).pipe(res);
|
|
71
44
|
}
|
|
72
45
|
}
|
|
73
46
|
return next();
|
|
@@ -91,18 +64,18 @@ function assets() {
|
|
|
91
64
|
const assets = pkg.meta['public-assets'] || {};
|
|
92
65
|
Object.entries(assets).forEach(([path, dest]) => {
|
|
93
66
|
// do not override app public assets
|
|
94
|
-
if (
|
|
67
|
+
if (existsSync(join(publicDir, dest))) {
|
|
95
68
|
return;
|
|
96
69
|
}
|
|
97
|
-
const filePath =
|
|
98
|
-
if (!
|
|
70
|
+
const filePath = join(pkg.root, path);
|
|
71
|
+
if (!lstatSync(filePath).isFile()) {
|
|
99
72
|
console.log(`Invalid package definition, ${pkg.name} has defined a file "${path}" that is not a file`);
|
|
100
73
|
return;
|
|
101
74
|
}
|
|
102
75
|
this.emitFile({
|
|
103
76
|
type: 'asset',
|
|
104
|
-
source:
|
|
105
|
-
fileName:
|
|
77
|
+
source: readFileSync(filePath),
|
|
78
|
+
fileName: posix.resolve('/', dest).slice(1),
|
|
106
79
|
});
|
|
107
80
|
});
|
|
108
81
|
});
|
|
@@ -111,5 +84,4 @@ function assets() {
|
|
|
111
84
|
},
|
|
112
85
|
};
|
|
113
86
|
}
|
|
114
|
-
exports.assets = assets;
|
|
115
87
|
//# sourceMappingURL=assets.js.map
|
package/src/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["assets.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;AAEhC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AACnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,SAAS,eAAe,CAAC,YAAoB,EAAE,QAAkB;;IAC/D,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC3C,IAAI,GAAG,GAAG,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAEjD,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC9C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AAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;4BAC9C,oCAAoC;4BACpC,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;gCACtC,OAAO;4BACT,CAAC;4BAED,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;4BACtC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;gCAClC,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,CAAC,IAAI,wBAAwB,IAAI,sBAAsB,CAAC,CAAC;gCACvG,OAAO;4BACT,CAAC;4BAED,IAAI,CAAC,QAAQ,CAAC;gCACZ,IAAI,EAAE,OAAO;gCACb,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC;gCAC9B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;6BAC5C,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Resolver } from '@embroider/core';\nimport core from '@embroider/core';\nconst { ResolverLoader } = core;\nimport type { Plugin } from 'vite';\nimport * as process from 'process';\nimport { join, posix } from 'path';\nimport fs from 'fs-extra';\nconst { existsSync, readFileSync, lstatSync } = fs;\nimport send from 'send';\n\nfunction findPublicAsset(relativePath: string, resolver: Resolver) {\n const packageCache = resolver.packageCache;\n let pkg = packageCache.ownerOfFile(relativePath);\n\n for (const engine of resolver.options.engines) {\n for (const addon of engine.activeAddons) {\n pkg = packageCache.ownerOfFile(addon.root);\n if (pkg && pkg.meta && pkg.isV2Addon() && pkg.meta['public-assets']) {\n const asset = Object.entries(pkg.meta['public-assets']).find(\n ([_key, a]) => posix.resolve('/', a) === relativePath\n )?.[0];\n let local = asset ? join(addon.root, asset) : null;\n if (local && existsSync(local)) {\n return local;\n }\n }\n }\n }\n}\n\nexport function assets(): Plugin {\n const cwd = process.cwd();\n const resolverLoader = new ResolverLoader(cwd);\n let mode: 'build' | 'serve' = 'build';\n let publicDir = 'public';\n return {\n name: 'assets',\n enforce: 'post',\n configResolved(options) {\n mode = options.command;\n publicDir = options.publicDir;\n },\n configureServer(server) {\n return () => {\n server.middlewares.use((req, res, next) => {\n if (req.originalUrl && req.originalUrl.length > 1) {\n const assetUrl = findPublicAsset(req.originalUrl.split('?')[0], resolverLoader.resolver);\n if (assetUrl) {\n return send(req, assetUrl).pipe(res as unknown as NodeJS.WritableStream);\n }\n }\n return next();\n });\n };\n },\n buildStart: {\n // we need to wait for the compatBuild plugin's buildStart hook to finish\n // so that the resolver config exists before we try to read it.\n sequential: true,\n order: 'post',\n async handler() {\n if (mode !== 'build') return;\n const engines = resolverLoader.resolver.options.engines;\n for (const engine of engines) {\n const packages = engine.activeAddons.map(a => resolverLoader.resolver.packageCache.ownerOfFile(a.root));\n packages.forEach(pkg => {\n if (!pkg || !pkg.isV2Addon()) return;\n const assets = pkg.meta['public-assets'] || {};\n Object.entries(assets).forEach(([path, dest]) => {\n // do not override app public assets\n if (existsSync(join(publicDir, dest))) {\n return;\n }\n\n const filePath = join(pkg.root, path);\n if (!lstatSync(filePath).isFile()) {\n console.log(`Invalid package definition, ${pkg.name} has defined a file \"${path}\" that is not a file`);\n return;\n }\n\n this.emitFile({\n type: 'asset',\n source: readFileSync(filePath),\n fileName: posix.resolve('/', dest).slice(1),\n });\n });\n });\n }\n },\n },\n };\n}\n"]}
|
package/src/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
export declare function emberBuild(command: string, mode: string): Promise<void>;
|
|
2
|
+
export declare function emberBuild(command: string, mode: string, resolvableExtensions: string[] | undefined): Promise<void>;
|
|
3
3
|
export declare function compatPrebuild(): Plugin;
|
package/src/build.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { fork } from 'child_process';
|
|
2
|
+
export function emberBuild(command, mode, resolvableExtensions) {
|
|
3
|
+
let env = {
|
|
4
|
+
...process.env,
|
|
5
|
+
EMBROIDER_PREBUILD: 'true',
|
|
6
|
+
};
|
|
7
|
+
if (resolvableExtensions) {
|
|
8
|
+
env['EMBROIDER_RESOLVABLE_EXTENSIONS'] = resolvableExtensions === null || resolvableExtensions === void 0 ? void 0 : resolvableExtensions.join(',');
|
|
9
|
+
}
|
|
6
10
|
if (command === 'build') {
|
|
7
11
|
return new Promise((resolve, reject) => {
|
|
8
|
-
const child =
|
|
9
|
-
env: {
|
|
10
|
-
...process.env,
|
|
11
|
-
EMBROIDER_PREBUILD: 'true',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
12
|
+
const child = fork('./node_modules/ember-cli/bin/ember', ['build', '--environment', mode], { env });
|
|
14
13
|
child.on('exit', code => (code === 0 ? resolve() : reject()));
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
return new Promise((resolve, reject) => {
|
|
18
|
-
const child =
|
|
17
|
+
const child = fork('./node_modules/ember-cli/bin/ember', ['build', '--watch', '--environment', mode], {
|
|
19
18
|
silent: true,
|
|
20
|
-
env
|
|
21
|
-
...process.env,
|
|
22
|
-
EMBROIDER_PREBUILD: 'true',
|
|
23
|
-
},
|
|
19
|
+
env,
|
|
24
20
|
});
|
|
25
21
|
child.on('exit', code => (code === 0 ? resolve() : reject(new Error('ember build --watch failed'))));
|
|
26
22
|
child.on('spawn', () => {
|
|
@@ -37,16 +33,18 @@ function emberBuild(command, mode) {
|
|
|
37
33
|
});
|
|
38
34
|
});
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
function compatPrebuild() {
|
|
36
|
+
export function compatPrebuild() {
|
|
42
37
|
let viteCommand;
|
|
43
38
|
let viteMode;
|
|
39
|
+
let resolvableExtensions;
|
|
44
40
|
return {
|
|
45
41
|
name: 'embroider-builder',
|
|
46
42
|
enforce: 'pre',
|
|
47
|
-
config(
|
|
43
|
+
config(config, { mode, command }) {
|
|
44
|
+
var _a;
|
|
48
45
|
viteCommand = command;
|
|
49
46
|
viteMode = mode;
|
|
47
|
+
resolvableExtensions = (_a = config.resolve) === null || _a === void 0 ? void 0 : _a.extensions;
|
|
50
48
|
},
|
|
51
49
|
async buildStart() {
|
|
52
50
|
if (!viteCommand) {
|
|
@@ -55,9 +53,8 @@ function compatPrebuild() {
|
|
|
55
53
|
if (!viteMode) {
|
|
56
54
|
throw new Error(`bug: embroider compatPrebuild did not detect Vite's mode`);
|
|
57
55
|
}
|
|
58
|
-
await emberBuild(viteCommand, viteMode);
|
|
56
|
+
await emberBuild(viteCommand, viteMode, resolvableExtensions);
|
|
59
57
|
},
|
|
60
58
|
};
|
|
61
59
|
}
|
|
62
|
-
exports.compatPrebuild = compatPrebuild;
|
|
63
60
|
//# sourceMappingURL=build.js.map
|
package/src/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,IAAY,EAAE,oBAA0C;IAClG,IAAI,GAAG,GAA2B;QAChC,GAAG,OAAO,CAAC,GAAG;QACd,kBAAkB,EAAE,MAAM;KAC3B,CAAC;IAEF,IAAI,oBAAoB,EAAE,CAAC;QACzB,GAAG,CAAC,iCAAiC,CAAC,GAAG,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3E,CAAC;IAED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C,CAAC;gBAC7B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBACjD,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,IAAI,WAA+B,CAAC;IACpC,IAAI,QAA4B,CAAC;IACjC,IAAI,oBAA0C,CAAC;IAE/C,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,KAAK;QACd,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;;YAC9B,WAAW,GAAG,OAAO,CAAC;YACtB,QAAQ,GAAG,IAAI,CAAC;YAChB,oBAAoB,GAAG,MAAA,MAAM,CAAC,OAAO,0CAAE,UAAU,CAAC;QACpD,CAAC;QACD,KAAK,CAAC,UAAU;YACd,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YACjF,CAAC;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;YAC9E,CAAC;YACD,MAAM,UAAU,CAAC,WAAW,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { fork } from 'child_process';\nimport type { Plugin } from 'vite';\n\nexport function emberBuild(command: string, mode: string, resolvableExtensions: string[] | undefined): Promise<void> {\n let env: Record<string, string> = {\n ...process.env,\n EMBROIDER_PREBUILD: 'true',\n };\n\n if (resolvableExtensions) {\n env['EMBROIDER_RESOLVABLE_EXTENSIONS'] = resolvableExtensions?.join(',');\n }\n\n if (command === 'build') {\n return new Promise((resolve, reject) => {\n const child = fork('./node_modules/ember-cli/bin/ember', ['build', '--environment', mode], { env });\n child.on('exit', code => (code === 0 ? resolve() : reject()));\n });\n }\n return new Promise((resolve, reject) => {\n const child = fork('./node_modules/ember-cli/bin/ember', ['build', '--watch', '--environment', mode], {\n silent: true,\n env,\n });\n child.on('exit', code => (code === 0 ? resolve() : reject(new Error('ember build --watch failed'))));\n child.on('spawn', () => {\n child.stderr?.on('data', data => {\n console.error(data.toString());\n });\n child.stdout!.on('data', data => {\n console.log(data.toString());\n if (data.toString().includes('Build successful')) {\n resolve();\n }\n });\n });\n });\n}\n\nexport function compatPrebuild(): Plugin {\n let viteCommand: string | undefined;\n let viteMode: string | undefined;\n let resolvableExtensions: string[] | undefined;\n\n return {\n name: 'embroider-builder',\n enforce: 'pre',\n config(config, { mode, command }) {\n viteCommand = command;\n viteMode = mode;\n resolvableExtensions = config.resolve?.extensions;\n },\n async buildStart() {\n if (!viteCommand) {\n throw new Error(`bug: embroider compatPrebuild did not detect Vite's command`);\n }\n if (!viteMode) {\n throw new Error(`bug: embroider compatPrebuild did not detect Vite's mode`);\n }\n await emberBuild(viteCommand, viteMode, resolvableExtensions);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function classicEmberSupport(): import("vite").Plugin<any>[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { hbs } from './hbs.js';
|
|
2
|
+
import { scripts } from './scripts.js';
|
|
3
|
+
import { compatPrebuild } from './build.js';
|
|
4
|
+
import { assets } from './assets.js';
|
|
5
|
+
import { contentFor } from './content-for.js';
|
|
6
|
+
export function classicEmberSupport() {
|
|
7
|
+
return [hbs(), scripts(), compatPrebuild(), assets(), contentFor()];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=classic-ember-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classic-ember-support.js","sourceRoot":"","sources":["classic-ember-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,UAAU,mBAAmB;IACjC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { hbs } from './hbs.js';\nimport { scripts } from './scripts.js';\nimport { compatPrebuild } from './build.js';\nimport { assets } from './assets.js';\nimport { contentFor } from './content-for.js';\n\nexport function classicEmberSupport() {\n return [hbs(), scripts(), compatPrebuild(), assets(), contentFor()];\n}\n"]}
|
package/src/content-for.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
function contentFor() {
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
const { readJSONSync } = fs;
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import core from '@embroider/core';
|
|
5
|
+
const { locateEmbroiderWorkingDir } = core;
|
|
6
|
+
export function contentFor() {
|
|
8
7
|
return {
|
|
9
8
|
name: 'embroider-content-for',
|
|
10
9
|
transformIndexHtml(html, { path }) {
|
|
11
|
-
let config =
|
|
10
|
+
let config = readJSONSync(join(locateEmbroiderWorkingDir(process.cwd()), 'content-for.json'));
|
|
12
11
|
let contentsForConfig = config[path];
|
|
13
12
|
for (const [contentType, htmlContent] of Object.entries(contentsForConfig)) {
|
|
14
13
|
html = html.replace(`{{content-for "${contentType}"}}`, `${htmlContent}`);
|
|
@@ -17,5 +16,4 @@ function contentFor() {
|
|
|
17
16
|
},
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
exports.contentFor = contentFor;
|
|
21
19
|
//# sourceMappingURL=content-for.js.map
|
package/src/content-for.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-for.js","sourceRoot":"","sources":["content-for.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-for.js","sourceRoot":"","sources":["content-for.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,MAAM,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;AAE3C,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,IAAI,EAAE,uBAAuB;QAE7B,kBAAkB,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE;YAC/B,IAAI,MAAM,GAAQ,YAAY,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;YACnG,IAAI,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YACrC,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC3E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,WAAW,KAAK,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;YAC5E,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Plugin } from 'vite';\nimport fs from 'fs-extra';\nconst { readJSONSync } = fs;\nimport { join } from 'path';\nimport core from '@embroider/core';\nconst { locateEmbroiderWorkingDir } = core;\n\nexport function contentFor(): Plugin {\n return {\n name: 'embroider-content-for',\n\n transformIndexHtml(html, { path }) {\n let config: any = readJSONSync(join(locateEmbroiderWorkingDir(process.cwd()), 'content-for.json'));\n let contentsForConfig = config[path];\n for (const [contentType, htmlContent] of Object.entries(contentsForConfig)) {\n html = html.replace(`{{content-for \"${contentType}\"}}`, `${htmlContent}`);\n }\n return html;\n },\n };\n}\n"]}
|
package/src/ember.d.ts
ADDED
package/src/ember.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { templateTag } from './template-tag.js';
|
|
2
|
+
import { resolver } from './resolver.js';
|
|
3
|
+
import { mergeConfig } from 'vite';
|
|
4
|
+
import { esBuildResolver } from './esbuild-resolver.js';
|
|
5
|
+
export let extensions = ['.mjs', '.gjs', '.js', '.mts', '.gts', '.ts', '.hbs', '.hbs.js', '.json'];
|
|
6
|
+
export function ember() {
|
|
7
|
+
return [
|
|
8
|
+
templateTag(),
|
|
9
|
+
resolver(),
|
|
10
|
+
{
|
|
11
|
+
name: 'vite-plugin-ember-config',
|
|
12
|
+
async config(config, env) {
|
|
13
|
+
return mergeConfig({
|
|
14
|
+
resolve: {
|
|
15
|
+
extensions,
|
|
16
|
+
},
|
|
17
|
+
optimizeDeps: {
|
|
18
|
+
exclude: ['@embroider/macros'],
|
|
19
|
+
extensions: ['.hbs', '.gjs', '.gts'],
|
|
20
|
+
esbuildOptions: {
|
|
21
|
+
plugins: [esBuildResolver()],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
build: {
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
input: {
|
|
27
|
+
main: 'index.html',
|
|
28
|
+
...(shouldBuildTests(env.mode) ? { tests: 'tests/index.html' } : undefined),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
server: {
|
|
33
|
+
port: 4200,
|
|
34
|
+
},
|
|
35
|
+
}, config);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
function shouldBuildTests(mode) {
|
|
41
|
+
return mode !== 'production' || process.env.FORCE_BUILD_TESTS;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ember.js.map
|
package/src/ember.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ember.js","sourceRoot":"","sources":["ember.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAmC,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,IAAI,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAEnG,MAAM,UAAU,KAAK;IACnB,OAAO;QACL,WAAW,EAAE;QACb,QAAQ,EAAE;QACV;YACE,IAAI,EAAE,0BAA0B;YAChC,KAAK,CAAC,MAAM,CAAC,MAAkB,EAAE,GAAc;gBAC7C,OAAO,WAAW,CAChB;oBACE,OAAO,EAAE;wBACP,UAAU;qBACX;oBAED,YAAY,EAAE;wBACZ,OAAO,EAAE,CAAC,mBAAmB,CAAC;wBAC9B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;wBACpC,cAAc,EAAE;4BACd,OAAO,EAAE,CAAC,eAAe,EAAE,CAAC;yBAC7B;qBACF;oBAED,KAAK,EAAE;wBACL,aAAa,EAAE;4BACb,KAAK,EAAE;gCACL,IAAI,EAAE,YAAY;gCAClB,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;6BAC5E;yBACF;qBACF;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,IAAI;qBACX;iBACF,EACD,MAAM,CACP,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,KAAK,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAChE,CAAC","sourcesContent":["import { templateTag } from './template-tag.js';\nimport { resolver } from './resolver.js';\nimport { mergeConfig, type UserConfig, type ConfigEnv } from 'vite';\nimport { esBuildResolver } from './esbuild-resolver.js';\n\nexport let extensions = ['.mjs', '.gjs', '.js', '.mts', '.gts', '.ts', '.hbs', '.hbs.js', '.json'];\n\nexport function ember() {\n return [\n templateTag(),\n resolver(),\n {\n name: 'vite-plugin-ember-config',\n async config(config: UserConfig, env: ConfigEnv) {\n return mergeConfig(\n {\n resolve: {\n extensions,\n },\n\n optimizeDeps: {\n exclude: ['@embroider/macros'],\n extensions: ['.hbs', '.gjs', '.gts'],\n esbuildOptions: {\n plugins: [esBuildResolver()],\n },\n },\n\n build: {\n rollupOptions: {\n input: {\n main: 'index.html',\n ...(shouldBuildTests(env.mode) ? { tests: 'tests/index.html' } : undefined),\n },\n },\n },\n server: {\n port: 4200,\n },\n },\n config\n );\n },\n },\n ];\n}\n\nfunction shouldBuildTests(mode: string) {\n return mode !== 'production' || process.env.FORCE_BUILD_TESTS;\n}\n"]}
|
package/src/esbuild-request.d.ts
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import core from '@embroider/core';
|
|
2
2
|
import type { ImportKind, OnResolveResult, PluginBuild } from 'esbuild';
|
|
3
|
-
import type { Resolution } from '@embroider/core';
|
|
4
|
-
|
|
3
|
+
import type { PackageCache as _PackageCache, Resolution, ModuleRequest, RequestAdapter } from '@embroider/core';
|
|
4
|
+
type PublicAPI<T> = {
|
|
5
|
+
[K in keyof T]: T[K];
|
|
6
|
+
};
|
|
7
|
+
type PackageCache = PublicAPI<_PackageCache>;
|
|
8
|
+
export declare class EsBuildRequestAdapter implements RequestAdapter<Resolution<OnResolveResult, OnResolveResult>> {
|
|
9
|
+
private packageCache;
|
|
10
|
+
private phase;
|
|
5
11
|
private context;
|
|
6
12
|
private kind;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
static create({ packageCache, phase, build, kind, path, importer, pluginData, }: {
|
|
14
|
+
packageCache: PackageCache;
|
|
15
|
+
phase: 'bundling' | 'other';
|
|
16
|
+
build: PluginBuild;
|
|
17
|
+
kind: ImportKind;
|
|
18
|
+
path: string;
|
|
19
|
+
importer: string | undefined;
|
|
20
|
+
pluginData: Record<string, any> | undefined;
|
|
21
|
+
}): {
|
|
22
|
+
initialState: {
|
|
23
|
+
specifier: string;
|
|
24
|
+
fromFile: string;
|
|
25
|
+
meta: any;
|
|
26
|
+
};
|
|
27
|
+
adapter: EsBuildRequestAdapter;
|
|
28
|
+
} | undefined;
|
|
14
29
|
private constructor();
|
|
15
30
|
get debugType(): string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
withMeta(meta: Record<string, any> | undefined): this;
|
|
20
|
-
notFound(): this;
|
|
21
|
-
resolveTo(resolution: Resolution<OnResolveResult, OnResolveResult>): this;
|
|
22
|
-
defaultResolve(): Promise<Resolution<OnResolveResult, OnResolveResult>>;
|
|
31
|
+
notFoundResponse(request: core.ModuleRequest<core.Resolution<OnResolveResult, OnResolveResult>>): core.Resolution<OnResolveResult, OnResolveResult>;
|
|
32
|
+
virtualResponse(_request: core.ModuleRequest<core.Resolution<OnResolveResult, OnResolveResult>>, virtualFileName: string): core.Resolution<OnResolveResult, OnResolveResult>;
|
|
33
|
+
resolve(request: ModuleRequest<Resolution<OnResolveResult, OnResolveResult>>): Promise<Resolution<OnResolveResult, OnResolveResult>>;
|
|
23
34
|
}
|
|
35
|
+
export declare function writeStatus(id: string, status: 'found' | 'not_found'): void;
|
|
36
|
+
export {};
|