ember-native 2.2.0 → 3.0.0
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/declarations/dom/element-registry.d.ts +1 -1
- package/declarations/dom/native/NativeElementNode.d.ts +3 -3
- package/declarations/dom/nodes/DocumentNode.d.ts +2 -2
- package/declarations/dom/nodes/TextNode.d.ts +2 -0
- package/declarations/dom/nodes/ViewNode.d.ts +1 -1
- package/declarations/instance-initializers/history.d.ts +1 -1
- package/dist/components/InspectorSupport.js +1 -1
- package/dist/dom/native/NativeElementNode.js +3 -0
- package/dist/dom/nodes/TextNode.js +6 -0
- package/dist/services/history.js +1 -1
- package/dist/setup.js +2 -2
- package/dist/utils/babel-plugin.js +1 -1
- package/dist/utils/babel-plugin.ts +15 -16
- package/dist/utils/embroider-template-tag-loader.js +50 -0
- package/dist/utils/embroider-webpack-adapter.js +174 -0
- package/dist/utils/glimmer-env.js +7 -3
- package/dist/utils/webpack.config.js +15 -43
- package/package.json +36 -40
- package/types/globals.d.ts +42 -0
- package/declarations/types/globals.d.ts +0 -56
- package/dist/types/globals.js +0 -2
- package/dist/types/globals.js.map +0 -1
- package/dist/utils/content-tag-loader.js +0 -9
|
@@ -9,7 +9,7 @@ export declare function getViewMeta(elementName: string): {
|
|
|
9
9
|
isUnaryTag: boolean;
|
|
10
10
|
tagNamespace: string;
|
|
11
11
|
canBeLeftOpenTag: boolean;
|
|
12
|
-
component:
|
|
12
|
+
component: any;
|
|
13
13
|
};
|
|
14
14
|
export declare function isKnownView(elementName: string): any;
|
|
15
15
|
export declare function createElement<T extends keyof NativeElementsTagNameMap>(elementName: T): NativeElementsTagNameMap[T];
|
|
@@ -12,8 +12,8 @@ export default class NativeElementNode<T extends ViewBase | null = ViewBase> ext
|
|
|
12
12
|
_meta: ComponentMeta;
|
|
13
13
|
constructor(tagName: string, viewClass: typeof View | null, meta?: ComponentMeta | null);
|
|
14
14
|
setStyle(property: string, value: string | number | null): void;
|
|
15
|
-
get style(): import("@nativescript/core").Style
|
|
16
|
-
set style(v: import("@nativescript/core").Style
|
|
15
|
+
get style(): import("@nativescript/core").Style;
|
|
16
|
+
set style(v: import("@nativescript/core").Style);
|
|
17
17
|
updateText(): void;
|
|
18
18
|
get nativeView(): T;
|
|
19
19
|
set nativeView(view: T);
|
|
@@ -44,5 +44,5 @@ export default class NativeElementNode<T extends ViewBase | null = ViewBase> ext
|
|
|
44
44
|
width: number;
|
|
45
45
|
height: number;
|
|
46
46
|
right?: undefined;
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
48
|
}
|
|
@@ -14,7 +14,7 @@ class InspectorSupport extends Component {
|
|
|
14
14
|
constructor(...args) {
|
|
15
15
|
super(...args);
|
|
16
16
|
_defineProperty(this, "setupInspector", () => {
|
|
17
|
-
|
|
17
|
+
const i = setInterval(() => {
|
|
18
18
|
const viewInspection = globalThis.EmberInspector?.viewDebug?.viewInspection;
|
|
19
19
|
if (viewInspection && this.tooltip) {
|
|
20
20
|
this.tooltip.querySelector = () => {
|
|
@@ -283,6 +283,9 @@ class NativeElementNode extends ElementNode {
|
|
|
283
283
|
parentView._removeView(childView);
|
|
284
284
|
}
|
|
285
285
|
} else if (parentView instanceof View) {
|
|
286
|
+
if (childNode.parentNode !== parentNode) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
286
289
|
parentView._removeView(childView);
|
|
287
290
|
} else ;
|
|
288
291
|
}
|
package/dist/services/history.js
CHANGED
|
@@ -17,7 +17,7 @@ let HistoryService = (_dec = service('ember-native/native-router'), _class = cla
|
|
|
17
17
|
});
|
|
18
18
|
_defineProperty(this, "back", () => {
|
|
19
19
|
const h = this.stack.pop();
|
|
20
|
-
if (h
|
|
20
|
+
if (h?.from) {
|
|
21
21
|
const from = h.from;
|
|
22
22
|
this.stack = [...this.stack];
|
|
23
23
|
const transition = this.nativeRouter.transitionTo(from.name, from.params?.['model'], {
|
package/dist/setup.js
CHANGED
|
@@ -25,14 +25,14 @@ function setup() {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
handleBackburnerErrors();
|
|
28
|
-
SimpleDynamicAttribute.prototype.set = function (dom, value
|
|
28
|
+
SimpleDynamicAttribute.prototype.set = function (dom, value) {
|
|
29
29
|
const {
|
|
30
30
|
name,
|
|
31
31
|
namespace
|
|
32
32
|
} = this.attribute;
|
|
33
33
|
dom.__setAttribute(name, value, namespace);
|
|
34
34
|
};
|
|
35
|
-
SimpleDynamicAttribute.prototype.update = function (value
|
|
35
|
+
SimpleDynamicAttribute.prototype.update = function (value) {
|
|
36
36
|
const normalizedValue = value;
|
|
37
37
|
const {
|
|
38
38
|
element: element,
|
|
@@ -152,7 +152,7 @@ export default function hotReplaceAst(babel) {
|
|
|
152
152
|
visitor: {
|
|
153
153
|
Program(path, state) {
|
|
154
154
|
var _a;
|
|
155
|
-
if (!hotAstProcessor.meta.importVar) {
|
|
155
|
+
if (!hotAstProcessor.meta.importVar || !hotAstProcessor.meta.importBindings) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
if (process.env['EMBER_HMR_ENABLED'] !== 'true') {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { parse, type PluginObj } from '@babel/core';
|
|
2
|
-
import type * as BabelTypesNamespace from '@babel/types';
|
|
3
|
-
import type { Program, Statement } from '@babel/types';
|
|
4
2
|
import type * as Babel from '@babel/core';
|
|
3
|
+
import type { types } from '@babel/core';
|
|
5
4
|
import * as glimmer from '@glimmer/syntax';
|
|
6
5
|
import { ASTv1, type NodeVisitor, WalkerPath } from '@glimmer/syntax';
|
|
7
6
|
import { ImportUtil } from 'babel-import-util';
|
|
@@ -25,7 +24,7 @@ class HotAstProcessor {
|
|
|
25
24
|
locals: Set<string>;
|
|
26
25
|
importVar: any;
|
|
27
26
|
importBindings: Set<string>;
|
|
28
|
-
babelProgram?: Program;
|
|
27
|
+
babelProgram?: types.Program;
|
|
29
28
|
};
|
|
30
29
|
didCreateImportClass: boolean = false;
|
|
31
30
|
|
|
@@ -82,7 +81,7 @@ class HotAstProcessor {
|
|
|
82
81
|
}: {
|
|
83
82
|
importVar: string;
|
|
84
83
|
importBindings: Set<string>;
|
|
85
|
-
babelProgram: Program;
|
|
84
|
+
babelProgram: types.Program;
|
|
86
85
|
}) {
|
|
87
86
|
const findImport = function findImport(specifier: string) {
|
|
88
87
|
return babelProgram.body.find(
|
|
@@ -127,7 +126,7 @@ class HotAstProcessor {
|
|
|
127
126
|
) {
|
|
128
127
|
return;
|
|
129
128
|
}
|
|
130
|
-
const original = node.original.split('.')[0]
|
|
129
|
+
const original = node.original.split('.')[0];
|
|
131
130
|
if (original === 'this') return;
|
|
132
131
|
if (original.startsWith('@')) return;
|
|
133
132
|
if (original === 'block') return;
|
|
@@ -171,7 +170,7 @@ class HotAstProcessor {
|
|
|
171
170
|
element: ASTv1.ElementNode,
|
|
172
171
|
p: WalkerPath<ASTv1.ElementNode>,
|
|
173
172
|
) => {
|
|
174
|
-
const original = element.tag.split('.')[0]
|
|
173
|
+
const original = element.tag.split('.')[0];
|
|
175
174
|
if (findBlockParams(original, p)) return;
|
|
176
175
|
if (importVar) {
|
|
177
176
|
if (findImport(original)) {
|
|
@@ -199,7 +198,7 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
199
198
|
},
|
|
200
199
|
visitor: {
|
|
201
200
|
Program(path, state) {
|
|
202
|
-
if (!hotAstProcessor.meta.importVar) {
|
|
201
|
+
if (!hotAstProcessor.meta.importVar || !hotAstProcessor.meta.importBindings) {
|
|
203
202
|
return;
|
|
204
203
|
}
|
|
205
204
|
if (process.env['EMBER_HMR_ENABLED'] !== 'true') {
|
|
@@ -208,8 +207,8 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
208
207
|
if (state.filename?.includes('node_modules')) {
|
|
209
208
|
return;
|
|
210
209
|
}
|
|
211
|
-
const util = new ImportUtil(babel, path);
|
|
212
|
-
const tracked = util.import(path, '@glimmer/tracking', 'tracked');
|
|
210
|
+
const util = new ImportUtil(babel as any, path as any);
|
|
211
|
+
const tracked = util.import(path as any, '@glimmer/tracking', 'tracked');
|
|
213
212
|
const klass = t.classExpression(
|
|
214
213
|
path.scope.generateUidIdentifier('Imports'),
|
|
215
214
|
null,
|
|
@@ -233,22 +232,22 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
233
232
|
|
|
234
233
|
const varDeclaration =
|
|
235
234
|
path.node.body.findIndex(
|
|
236
|
-
(e
|
|
235
|
+
(e) =>
|
|
237
236
|
e.type === 'VariableDeclaration' &&
|
|
238
|
-
(e.declarations[0]
|
|
237
|
+
(e.declarations[0].id as any).name ===
|
|
239
238
|
hotAstProcessor.meta.importVar,
|
|
240
239
|
) + 1;
|
|
241
240
|
|
|
242
241
|
const lastImportIndex =
|
|
243
242
|
[...path.node.body].findLastIndex(
|
|
244
|
-
(e
|
|
243
|
+
(e) =>
|
|
245
244
|
e.type === 'ImportDeclaration',
|
|
246
245
|
) + 1;
|
|
247
246
|
|
|
248
247
|
path.node.body.splice(
|
|
249
248
|
Math.max(varDeclaration, lastImportIndex),
|
|
250
249
|
0,
|
|
251
|
-
assign as
|
|
250
|
+
assign as any,
|
|
252
251
|
);
|
|
253
252
|
|
|
254
253
|
const findImport = function findImport(specifier: string) {
|
|
@@ -263,7 +262,7 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
263
262
|
for (const imp of bindings) {
|
|
264
263
|
const importDeclaration = findImport(
|
|
265
264
|
imp,
|
|
266
|
-
) as
|
|
265
|
+
) as any;
|
|
267
266
|
if (!importDeclaration) {
|
|
268
267
|
console.log('could not find import for ', imp);
|
|
269
268
|
continue;
|
|
@@ -281,7 +280,7 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
281
280
|
configFile: false,
|
|
282
281
|
},
|
|
283
282
|
);
|
|
284
|
-
const accept = ast
|
|
283
|
+
const accept = ast.program.body;
|
|
285
284
|
ifHotStatements.push(...accept);
|
|
286
285
|
}
|
|
287
286
|
const ifHot = t.ifStatement(
|
|
@@ -291,7 +290,7 @@ export default function hotReplaceAst(babel: typeof Babel) {
|
|
|
291
290
|
),
|
|
292
291
|
t.blockStatement([...ifHotStatements]),
|
|
293
292
|
);
|
|
294
|
-
path.node.body.push(ifHot);
|
|
293
|
+
path.node.body.push(ifHot as any);
|
|
295
294
|
path.scope.crawl();
|
|
296
295
|
},
|
|
297
296
|
},
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webpack loader that uses @embroider/vite's templateTag plugin
|
|
3
|
+
* to transform .gts/.gjs files
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let templateTagPlugin;
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const { templateTag } = require('@embroider/vite');
|
|
10
|
+
templateTagPlugin = templateTag();
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.warn('Failed to load @embroider/vite templateTag plugin:', e.message);
|
|
13
|
+
console.warn('Falling back to content-tag-loader');
|
|
14
|
+
// Fallback to content-tag-loader
|
|
15
|
+
module.exports = require('./content-tag-loader.js');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = function embroiderTemplateTagLoader(source) {
|
|
20
|
+
const callback = this.async();
|
|
21
|
+
const id = this.resourcePath;
|
|
22
|
+
|
|
23
|
+
// Create a minimal context for the plugin
|
|
24
|
+
const context = {
|
|
25
|
+
parse: (code) => ({ code }),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Call the transform hook from the templateTag plugin
|
|
29
|
+
Promise.resolve()
|
|
30
|
+
.then(() => {
|
|
31
|
+
if (templateTagPlugin.transform) {
|
|
32
|
+
return templateTagPlugin.transform.call(context, source, id);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
})
|
|
36
|
+
.then((result) => {
|
|
37
|
+
if (result && result.code) {
|
|
38
|
+
// Return just the code, like content-tag-loader does
|
|
39
|
+
// This avoids the .inputSourceMap error with babel-loader
|
|
40
|
+
callback(null, result.code);
|
|
41
|
+
} else {
|
|
42
|
+
// If no transformation, pass through
|
|
43
|
+
callback();
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.catch((error) => {
|
|
47
|
+
console.error('Template tag transformation error:', error);
|
|
48
|
+
callback(error);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webpack adapter for @embroider/vite plugins
|
|
3
|
+
*
|
|
4
|
+
* This adapter allows using @embroider/vite's resolver() and templateTag() plugins
|
|
5
|
+
* in webpack builds, similar to how they're used in rollup.config.mjs
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const { existsSync, statSync } = require("fs");
|
|
11
|
+
const { resolve: resolvePath } = require("path");
|
|
12
|
+
|
|
13
|
+
function tryExtensions(basePath, extensions = ['js', 'ts', 'gts', '.gjs']) {
|
|
14
|
+
// Try with extensions first
|
|
15
|
+
basePath = basePath
|
|
16
|
+
.replace('.js', '')
|
|
17
|
+
.replace('.ts', '')
|
|
18
|
+
.replace('.gjs', '')
|
|
19
|
+
.replace('.gts', '')
|
|
20
|
+
.replace('file://', '');
|
|
21
|
+
for (const ext of extensions) {
|
|
22
|
+
const fullPath = `${basePath}.${ext}`;
|
|
23
|
+
if (existsSync(fullPath)) {
|
|
24
|
+
try {
|
|
25
|
+
const stats = statSync(fullPath);
|
|
26
|
+
if (stats.isFile()) {
|
|
27
|
+
return fs.realpathSync(fullPath);
|
|
28
|
+
}
|
|
29
|
+
// eslint-disable-next-line no-unused-vars
|
|
30
|
+
} catch (e) {
|
|
31
|
+
// Continue to next extension
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Try index files
|
|
37
|
+
for (const ext of extensions) {
|
|
38
|
+
const indexPath = resolvePath(basePath, `index.${ext}`);
|
|
39
|
+
if (existsSync(indexPath)) {
|
|
40
|
+
try {
|
|
41
|
+
const stats = statSync(indexPath);
|
|
42
|
+
if (stats.isFile()) {
|
|
43
|
+
return indexPath;
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line no-unused-vars
|
|
46
|
+
} catch (e) {
|
|
47
|
+
// Continue to next extension
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Creates a webpack resolver plugin that uses @embroider/vite's resolver
|
|
56
|
+
*/
|
|
57
|
+
function createResolverPlugin() {
|
|
58
|
+
let resolverPlugin;
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const { resolver } = require('@embroider/vite');
|
|
62
|
+
resolverPlugin = resolver();
|
|
63
|
+
} catch (e) {
|
|
64
|
+
console.warn('Failed to load @embroider/vite resolver plugin:', e.message);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return class EmbroiderResolverPlugin {
|
|
69
|
+
apply(resolver) {
|
|
70
|
+
const target = resolver.ensureHook('resolved');
|
|
71
|
+
|
|
72
|
+
resolver
|
|
73
|
+
.getHook('described-resolve')
|
|
74
|
+
.tapAsync('EmbroiderResolverPlugin', (request, resolveContext, callback) => {
|
|
75
|
+
const issuer = request.context?.issuer || request.path;
|
|
76
|
+
|
|
77
|
+
if (!request.context?.issuer) {
|
|
78
|
+
callback();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Create a context compatible with vite plugins
|
|
83
|
+
// The resolver expects a context with a resolve method
|
|
84
|
+
const context = {
|
|
85
|
+
resolve: async (spec, from) => {
|
|
86
|
+
// Return a simple object with id property
|
|
87
|
+
// Let webpack handle the actual resolution
|
|
88
|
+
const res = tryExtensions(spec);
|
|
89
|
+
if (res) {
|
|
90
|
+
return { id: res };
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
if (spec.startsWith('ember-source')) {
|
|
94
|
+
return { id: fs.realpathSync(require.resolve(spec)) };
|
|
95
|
+
}
|
|
96
|
+
from = fs.realpathSync(from);
|
|
97
|
+
return { id: fs.realpathSync(require.resolve(spec, { paths: [path.dirname(from)] })) };
|
|
98
|
+
// eslint-disable-next-line no-unused-vars
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Call resolveId from the resolver plugin
|
|
106
|
+
Promise.resolve()
|
|
107
|
+
.then(() => {
|
|
108
|
+
if (resolverPlugin.resolveId) {
|
|
109
|
+
return resolverPlugin.resolveId.call(context, request.request, issuer, {});
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
})
|
|
113
|
+
.then((result) => {
|
|
114
|
+
if (result && result.id) {
|
|
115
|
+
// Embroider resolved it - continue with the resolved path
|
|
116
|
+
const obj = {
|
|
117
|
+
...request,
|
|
118
|
+
request: result.id,
|
|
119
|
+
path: result.id
|
|
120
|
+
};
|
|
121
|
+
resolver.doResolve(target, obj, null, resolveContext, callback);
|
|
122
|
+
} else {
|
|
123
|
+
// Embroider couldn't resolve it - let the next plugin try
|
|
124
|
+
callback();
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
// eslint-disable-next-line no-unused-vars
|
|
128
|
+
.catch((error) => {
|
|
129
|
+
callback();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Configures webpack to use @embroider/vite plugins via adapters
|
|
138
|
+
*/
|
|
139
|
+
module.exports = function configureEmbroiderWebpackAdapter(webpack) {
|
|
140
|
+
const ResolverPlugin = createResolverPlugin();
|
|
141
|
+
|
|
142
|
+
webpack.chainWebpack((config) => {
|
|
143
|
+
// Add resolver plugin if available
|
|
144
|
+
if (ResolverPlugin) {
|
|
145
|
+
config.resolve
|
|
146
|
+
.plugin('embroider-resolver')
|
|
147
|
+
.use(ResolverPlugin);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Configure .gts/.gjs file handling using the embroider-template-tag-loader
|
|
151
|
+
// This loader wraps @embroider/vite's templateTag() plugin
|
|
152
|
+
const loaderPath = path.resolve(__dirname, 'embroider-template-tag-loader.js');
|
|
153
|
+
|
|
154
|
+
config.module
|
|
155
|
+
.rule('gts/gjs')
|
|
156
|
+
.test(/\.g[jt]s$/)
|
|
157
|
+
.use('babel-loader')
|
|
158
|
+
.loader('babel-loader')
|
|
159
|
+
.end()
|
|
160
|
+
.use('embroider-template-tag-loader')
|
|
161
|
+
.loader(loaderPath)
|
|
162
|
+
.end();
|
|
163
|
+
|
|
164
|
+
// Configure regular .js/.ts files
|
|
165
|
+
config.module
|
|
166
|
+
.rule('js/ts')
|
|
167
|
+
.test(/\.([jt]s)$/)
|
|
168
|
+
.use('babel-loader')
|
|
169
|
+
.loader('babel-loader')
|
|
170
|
+
.end();
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
module.exports.createResolverPlugin = createResolverPlugin;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const DEBUG = true;
|
|
2
|
+
const CI = false;
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
DEBUG,
|
|
6
|
+
CI,
|
|
7
|
+
}
|
|
@@ -1,55 +1,27 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
1
|
|
|
2
|
+
/**
|
|
3
|
+
* Configures webpack for ember-native using @embroider/vite adapter
|
|
4
|
+
*
|
|
5
|
+
* This configuration uses @embroider/vite plugins via the webpack adapter
|
|
6
|
+
* with automatic fallback to custom loaders if unavailable.
|
|
7
|
+
*/
|
|
4
8
|
module.exports = (webpack) => {
|
|
9
|
+
try {
|
|
10
|
+
const configureAdapter = require('./embroider-webpack-adapter.js');
|
|
11
|
+
configureAdapter(webpack);
|
|
12
|
+
console.log('✓ Using @embroider/vite webpack adapter');
|
|
13
|
+
} catch (e) {
|
|
14
|
+
console.warn('⚠ Failed to load embroider adapter, using fallback loaders:', e.message);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Configure @glimmer/env alias (still needed)
|
|
5
18
|
webpack.chainWebpack((config) => {
|
|
6
|
-
const glimmerDirs = fs.readdirSync(
|
|
7
|
-
path.resolve(
|
|
8
|
-
process.cwd(),
|
|
9
|
-
'./node_modules/ember-source/dist/packages/@glimmer',
|
|
10
|
-
),
|
|
11
|
-
);
|
|
12
|
-
for (const glimmerDir of glimmerDirs) {
|
|
13
|
-
config.resolve.alias.set(
|
|
14
|
-
`@glimmer/${glimmerDir}`,
|
|
15
|
-
`ember-source/dist/packages/@glimmer/${glimmerDir}`,
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
// change the "@" alias to "app/libs"
|
|
19
|
-
config.resolve.alias.set('@ember', 'ember-source/dist/packages/@ember');
|
|
20
|
-
config.resolve.alias.set('ember', 'ember-source/dist/packages/ember');
|
|
21
|
-
config.resolve.alias.set(
|
|
22
|
-
'@glimmer/component',
|
|
23
|
-
'@glimmer/component/addon/index.ts',
|
|
24
|
-
);
|
|
25
19
|
config.resolve.alias.set(
|
|
26
20
|
'@glimmer/env',
|
|
27
21
|
require.resolve('./glimmer-env.js'),
|
|
28
22
|
);
|
|
29
23
|
});
|
|
30
24
|
|
|
31
|
-
webpack.chainWebpack((config) => {
|
|
32
|
-
// add a new rule for *.something files
|
|
33
|
-
config.module
|
|
34
|
-
.rule('gts/gjs')
|
|
35
|
-
.test(/\.g[jt]s$/)
|
|
36
|
-
.use('babel-loader')
|
|
37
|
-
.loader('babel-loader')
|
|
38
|
-
.end()
|
|
39
|
-
.use('gjs-loader')
|
|
40
|
-
.loader(require.resolve('./content-tag-loader.js'))
|
|
41
|
-
.end();
|
|
42
|
-
|
|
43
|
-
config.module
|
|
44
|
-
.rule('js/ts')
|
|
45
|
-
.test(/\.([jt]s)$/)
|
|
46
|
-
.use('fix-glimmer-content-owner')
|
|
47
|
-
.loader(require.resolve('./fix-glimmer-content-owner.js'))
|
|
48
|
-
.end()
|
|
49
|
-
.use('babel-loader')
|
|
50
|
-
.loader('babel-loader');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
25
|
webpack.chainWebpack((config) => {
|
|
54
26
|
config.plugin('DefinePlugin').tap((args) => {
|
|
55
27
|
Object.assign(args[0], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "the Ember framework with Nativescript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -19,28 +19,23 @@
|
|
|
19
19
|
],
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@glimmer/component": "*",
|
|
22
|
-
"@glimmer/reference": "*",
|
|
23
|
-
"@glimmer/runtime": "*",
|
|
24
|
-
"@glimmer/tracking": "*",
|
|
25
|
-
"@glimmer/validator": "*",
|
|
26
22
|
"@nativescript/core": "*",
|
|
27
23
|
"ember-modifier": "*",
|
|
28
24
|
"ember-source": "*",
|
|
29
25
|
"loader.js": "*"
|
|
30
26
|
},
|
|
31
27
|
"dependencies": {
|
|
32
|
-
"@babel/core": "^7.27.
|
|
28
|
+
"@babel/core": "^7.27.7",
|
|
33
29
|
"@babel/plugin-syntax-decorators": "^7.22.5",
|
|
34
30
|
"@ember/render-modifiers": "^3.0.0",
|
|
35
31
|
"@ember/string": "^4.0.0",
|
|
36
|
-
"@ember/test-waiters": "^4.
|
|
37
|
-
"@embroider/addon-shim": "^1.10.
|
|
38
|
-
"@eslint/js": "^9.
|
|
32
|
+
"@ember/test-waiters": "^4.1.1",
|
|
33
|
+
"@embroider/addon-shim": "^1.10.2",
|
|
34
|
+
"@eslint/js": "^9.28.0",
|
|
39
35
|
"@glimmer/component": "^2.0.0",
|
|
40
|
-
"@glimmer/tracking": "^1.1.2",
|
|
41
36
|
"@rollup/plugin-alias": "^5.1.0",
|
|
42
37
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
43
|
-
"@types/node": "^
|
|
38
|
+
"@types/node": "^24.1.0",
|
|
44
39
|
"astroturf": "^1.2.0",
|
|
45
40
|
"ember-cli-babel": "^8.2.0",
|
|
46
41
|
"ember-cli-htmlbars": "^6.2.0",
|
|
@@ -57,26 +52,24 @@
|
|
|
57
52
|
"rollup-plugin-styles": "^4.0.0"
|
|
58
53
|
},
|
|
59
54
|
"devDependencies": {
|
|
60
|
-
"@babel/types": "^7.
|
|
55
|
+
"@babel/types": "^7.28.5",
|
|
56
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
61
57
|
"@ember/optional-features": "^2.0.0",
|
|
62
|
-
"@embroider/addon-dev": "^8.0
|
|
58
|
+
"@embroider/addon-dev": "^8.1.0",
|
|
63
59
|
"@embroider/compat": "^4.1.0",
|
|
64
|
-
"@embroider/core": "^4.
|
|
65
|
-
"@embroider/macros": "^1.
|
|
60
|
+
"@embroider/core": "^4.2.8",
|
|
61
|
+
"@embroider/macros": "^1.18.1",
|
|
66
62
|
"@embroider/shared-internals": "^3.0.0",
|
|
67
|
-
"@embroider/
|
|
68
|
-
"@embroider/
|
|
69
|
-
"@
|
|
70
|
-
"@glimmer/reference": "^0.94.8",
|
|
71
|
-
"@glimmer/runtime": "^0.94.10",
|
|
63
|
+
"@embroider/vite": "^1.4.2",
|
|
64
|
+
"@embroider/util": "^1.13.3",
|
|
65
|
+
"@embroider/webpack": "^4.1.1",
|
|
72
66
|
"@glimmer/syntax": "^0.94.9",
|
|
73
|
-
"@glimmer/validator": "^0.94.8",
|
|
74
67
|
"@glint/core": "^1.5.0",
|
|
75
68
|
"@glint/environment-ember-loose": "^1.5.0",
|
|
76
69
|
"@glint/environment-ember-template-imports": "^1.5.0",
|
|
77
70
|
"@glint/template": "^1.5.0",
|
|
78
|
-
"@nativescript/core": "^8.9.
|
|
79
|
-
"@release-it-plugins/lerna-changelog": "^
|
|
71
|
+
"@nativescript/core": "^8.9.7",
|
|
72
|
+
"@release-it-plugins/lerna-changelog": "^8.0.1",
|
|
80
73
|
"@rollup/plugin-babel": "^6.0.3",
|
|
81
74
|
"@tsconfig/ember": "^3.0.8",
|
|
82
75
|
"@types/babel__core": "^7.20.5",
|
|
@@ -84,44 +77,46 @@
|
|
|
84
77
|
"@types/qunit": "^2.19.5",
|
|
85
78
|
"@types/qunit-dom": "^0.7.0",
|
|
86
79
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
|
87
|
-
"@typescript-eslint/parser": "^8.
|
|
80
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
81
|
+
"typescript-eslint": "^8.38.0",
|
|
88
82
|
"babel-import-util": "^3.0.0",
|
|
89
83
|
"babel-plugin-ember-template-compilation": "^3.0.0",
|
|
90
84
|
"bower": "^1.8.8",
|
|
85
|
+
"globals": "^16.5.0",
|
|
91
86
|
"broccoli": "^3.4.2",
|
|
92
87
|
"broccoli-asset-rev": "^3.0.0",
|
|
93
|
-
"concurrently": "^9.
|
|
88
|
+
"concurrently": "^9.2.0",
|
|
94
89
|
"content-tag": "^4.0.0",
|
|
95
90
|
"css-loader": "^7.1.2",
|
|
96
91
|
"ember-eslint-parser": "^0.5.9",
|
|
97
92
|
"ember-modifier": "^4.2.0",
|
|
98
|
-
"ember-source": "^6.
|
|
99
|
-
"ember-template-lint": "^7.
|
|
100
|
-
"eslint": "^
|
|
93
|
+
"ember-source": "^6.6.0",
|
|
94
|
+
"ember-template-lint": "^7.9.1",
|
|
95
|
+
"eslint": "^9.27.0",
|
|
101
96
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
102
|
-
"eslint-config-prettier": "^10.1.
|
|
97
|
+
"eslint-config-prettier": "^10.1.8",
|
|
103
98
|
"eslint-plugin-ember": "^12.3.1",
|
|
104
99
|
"eslint-plugin-ember-template-lint": "^0.21.0",
|
|
105
|
-
"eslint-plugin-n": "^17.
|
|
100
|
+
"eslint-plugin-n": "^17.21.3",
|
|
106
101
|
"eslint-plugin-node": "^11.1.0",
|
|
107
|
-
"eslint-plugin-prettier": "^5.
|
|
102
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
108
103
|
"eslint-plugin-qunit": "^8.1.1",
|
|
109
104
|
"fix-bad-declaration-output": "^1.1.4",
|
|
110
105
|
"loader.js": "^4.7.0",
|
|
111
106
|
"nativescript-ui-listview": "^15.2.3",
|
|
112
|
-
"prettier": "^3.
|
|
113
|
-
"prettier-plugin-ember-template-tag": "^2.0
|
|
107
|
+
"prettier": "^3.6.2",
|
|
108
|
+
"prettier-plugin-ember-template-tag": "^2.1.0",
|
|
114
109
|
"qunit": "^2.19.4",
|
|
115
110
|
"qunit-dom": "^3.4.0",
|
|
116
111
|
"release-it": "^15.10.3",
|
|
117
|
-
"rollup": "^4.
|
|
118
|
-
"rollup-plugin-copy": "^3.
|
|
112
|
+
"rollup": "^4.46.3",
|
|
113
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
119
114
|
"router_js": "^8.0.6",
|
|
120
|
-
"sass": "^1.
|
|
121
|
-
"sass-embedded": "^1.
|
|
115
|
+
"sass": "^1.89.2",
|
|
116
|
+
"sass-embedded": "^1.90.0",
|
|
122
117
|
"sass-loader": "^16.0.4",
|
|
123
|
-
"typescript": "^5.
|
|
124
|
-
"typescript-plugin-css-modules": "^5.0
|
|
118
|
+
"typescript": "^5.9.2",
|
|
119
|
+
"typescript-plugin-css-modules": "^5.2.0",
|
|
125
120
|
"yui": "^3.18.1"
|
|
126
121
|
},
|
|
127
122
|
"publishConfig": {
|
|
@@ -155,6 +150,7 @@
|
|
|
155
150
|
"types": "./declarations/*.d.ts",
|
|
156
151
|
"default": "./dist/*.js"
|
|
157
152
|
},
|
|
153
|
+
"./utils/*": "./dist/utils/*",
|
|
158
154
|
"./addon-main.js": "./addon-main.cjs"
|
|
159
155
|
},
|
|
160
156
|
"typesVersions": {
|
|
@@ -165,7 +161,7 @@
|
|
|
165
161
|
}
|
|
166
162
|
},
|
|
167
163
|
"scripts": {
|
|
168
|
-
"build": "
|
|
164
|
+
"build": "pnpm build:js && pnpm build:utils && pnpm build:types",
|
|
169
165
|
"build:js": "rollup --config",
|
|
170
166
|
"build:utils": "cd utils && tsc --project tsconfig.json",
|
|
171
167
|
"build:types": "glint --declaration && npx fix-bad-declaration-output './declarations/**/*.d.ts'",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.scss';
|
|
2
|
+
|
|
3
|
+
type AnyFunction = (...args: any) => any;
|
|
4
|
+
|
|
5
|
+
// Add global functions
|
|
6
|
+
declare global {
|
|
7
|
+
const __inspectorSendEvent: AnyFunction;
|
|
8
|
+
const __decorate: AnyFunction;
|
|
9
|
+
const __metadata: AnyFunction;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare namespace globalThis {
|
|
13
|
+
const __inspectorSendEvent: AnyFunction;
|
|
14
|
+
const __decorate: AnyFunction;
|
|
15
|
+
const __metadata: AnyFunction;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Add properties to globalThis
|
|
19
|
+
interface Window {
|
|
20
|
+
define: AnyFunction;
|
|
21
|
+
requirejs: AnyFunction;
|
|
22
|
+
requireModule: AnyFunction;
|
|
23
|
+
Element: any;
|
|
24
|
+
Node: any;
|
|
25
|
+
__metadata: AnyFunction;
|
|
26
|
+
__decorate: AnyFunction;
|
|
27
|
+
__inspectorSendEvent: AnyFunction;
|
|
28
|
+
emberDebugInjected: boolean;
|
|
29
|
+
MessageChannel: MessageChannel;
|
|
30
|
+
postMessage: AnyFunction;
|
|
31
|
+
triggerEvent: AnyFunction;
|
|
32
|
+
EmberInspector: any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Document {
|
|
36
|
+
nodeMap: any;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module 'loader.js' {
|
|
40
|
+
const require: AnyFunction;
|
|
41
|
+
const define: AnyFunction;
|
|
42
|
+
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
declare module '*.scss';
|
|
2
|
-
type AnyFunction = (...args: any) => any;
|
|
3
|
-
declare namespace globalThis {
|
|
4
|
-
var define: AnyFunction;
|
|
5
|
-
var requirejs: AnyFunction;
|
|
6
|
-
var requireModule: AnyFunction;
|
|
7
|
-
var Element: import('../dom/nodes/ElementNode.ts').default;
|
|
8
|
-
var Node: import('../dom/nodes/ElementNode.ts').default;
|
|
9
|
-
var __metadata: AnyFunction;
|
|
10
|
-
var __decorate: AnyFunction;
|
|
11
|
-
var __inspectorSendEvent: AnyFunction;
|
|
12
|
-
var emberDebugInjected: boolean;
|
|
13
|
-
var MessageChannel: MessageChannel;
|
|
14
|
-
var postMessage: AnyFunction;
|
|
15
|
-
var triggerEvent: AnyFunction;
|
|
16
|
-
var EmberInspector: any;
|
|
17
|
-
}
|
|
18
|
-
interface Document {
|
|
19
|
-
nodeMap: any;
|
|
20
|
-
}
|
|
21
|
-
declare module 'loader.js' {
|
|
22
|
-
const require: AnyFunction;
|
|
23
|
-
const define: AnyFunction;
|
|
24
|
-
}
|
|
25
|
-
interface HTMLElementTagNameMap {
|
|
26
|
-
'rad-list-view': import('../dom/native/NativeElementNode').default<import('nativescript-ui-listview').RadListView>;
|
|
27
|
-
'list-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ListView>;
|
|
28
|
-
'html-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').HtmlView>;
|
|
29
|
-
'scroll-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ScrollView>;
|
|
30
|
-
'text-field': import('../dom/native/NativeElementNode').default<import('@nativescript/core').TextField>;
|
|
31
|
-
'text-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').TextView>;
|
|
32
|
-
'web-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').WebView>;
|
|
33
|
-
'content-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ContentView>;
|
|
34
|
-
'tab-view': import('../dom/native/NativeElementNode').default<import('@nativescript/core').TabView>;
|
|
35
|
-
'tab-view-item': import('../dom/native/NativeElementNode').default<import('@nativescript/core').TabViewItem>;
|
|
36
|
-
switch: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Switch>;
|
|
37
|
-
'formatted-string': import('../dom/native/NativeElementNode').default<import('@nativescript/core').FormattedString>;
|
|
38
|
-
frame: import('../dom/native/FrameElement.ts').default;
|
|
39
|
-
page: import('../dom/native/PageElement.ts').default;
|
|
40
|
-
span: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Span>;
|
|
41
|
-
'action-bar': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ActionBar>;
|
|
42
|
-
'action-item': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ActionItem>;
|
|
43
|
-
comment: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Placeholder>;
|
|
44
|
-
button: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Button>;
|
|
45
|
-
'navigation-button': import('../dom/native/NativeElementNode').default<import('@nativescript/core').NavigationButton>;
|
|
46
|
-
image: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Image>;
|
|
47
|
-
label: import('../dom/native/NativeElementNode').default<import('@nativescript/core').Label>;
|
|
48
|
-
'list-picker': import('../dom/native/NativeElementNode').default<import('@nativescript/core').ListPicker>;
|
|
49
|
-
'date-picker': import('../dom/native/NativeElementNode').default<import('@nativescript/core').DatePicker>;
|
|
50
|
-
'dock-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').DockLayout>;
|
|
51
|
-
'wrap-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').WrapLayout>;
|
|
52
|
-
'stack-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').StackLayout>;
|
|
53
|
-
'grid-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').GridLayout>;
|
|
54
|
-
'flexbox-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').FlexboxLayout>;
|
|
55
|
-
'absolute-layout': import('../dom/native/NativeElementNode').default<import('@nativescript/core').AbsoluteLayout>;
|
|
56
|
-
}
|
package/dist/types/globals.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globals.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|