@intlify/bundle-utils 5.3.0 → 5.3.1
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/lib/js.js +9 -6
- package/lib/json.js +9 -6
- package/lib/yaml.js +9 -6
- package/package.json +1 -1
package/lib/js.js
CHANGED
|
@@ -113,12 +113,7 @@ function generateNode(generator, node, options, injector) {
|
|
|
113
113
|
const { forceStringify } = generator.context();
|
|
114
114
|
const codeMaps = new Map();
|
|
115
115
|
const { type, bridge, exportESM, sourceMap, isGlobal, locale, useClassComponent } = options;
|
|
116
|
-
|
|
117
|
-
const componentNamespace = bridge
|
|
118
|
-
? `Component.options`
|
|
119
|
-
: useClassComponent
|
|
120
|
-
? `Component.__o`
|
|
121
|
-
: `Component`;
|
|
116
|
+
const componentNamespace = '_Component';
|
|
122
117
|
(0, estree_walker_1.walk)(node, {
|
|
123
118
|
/**
|
|
124
119
|
* NOTE:
|
|
@@ -144,6 +139,14 @@ function generateNode(generator, node, options, injector) {
|
|
|
144
139
|
: `export default`;
|
|
145
140
|
generator.push(`${exportSyntax} function (Component) {`);
|
|
146
141
|
generator.indent();
|
|
142
|
+
// prettier-ignore
|
|
143
|
+
const componentVariable = bridge
|
|
144
|
+
? `Component.options || Component`
|
|
145
|
+
: useClassComponent
|
|
146
|
+
? `Component.__o || Component`
|
|
147
|
+
: `Component`;
|
|
148
|
+
// prettier-ignore
|
|
149
|
+
generator.pushline(`const ${componentNamespace} = ${componentVariable}`);
|
|
147
150
|
generator.pushline(`${componentNamespace}.${variableName} = ${componentNamespace}.${variableName} || []`);
|
|
148
151
|
generator.push(`${componentNamespace}.${variableName}.push({`);
|
|
149
152
|
generator.indent();
|
package/lib/json.js
CHANGED
|
@@ -81,12 +81,7 @@ function generateNode(generator, node, options, injector) {
|
|
|
81
81
|
const { forceStringify } = generator.context();
|
|
82
82
|
const codeMaps = new Map();
|
|
83
83
|
const { type, bridge, exportESM, sourceMap, isGlobal, locale, useClassComponent } = options;
|
|
84
|
-
|
|
85
|
-
const componentNamespace = bridge
|
|
86
|
-
? `Component.options`
|
|
87
|
-
: useClassComponent
|
|
88
|
-
? `Component.__o`
|
|
89
|
-
: `Component`;
|
|
84
|
+
const componentNamespace = '_Component';
|
|
90
85
|
(0, jsonc_eslint_parser_1.traverseNodes)(node, {
|
|
91
86
|
enterNode(node, parent) {
|
|
92
87
|
switch (node.type) {
|
|
@@ -105,6 +100,14 @@ function generateNode(generator, node, options, injector) {
|
|
|
105
100
|
: `export default`;
|
|
106
101
|
generator.push(`${exportSyntax} function (Component) {`);
|
|
107
102
|
generator.indent();
|
|
103
|
+
// prettier-ignore
|
|
104
|
+
const componentVariable = bridge
|
|
105
|
+
? `Component.options || Component`
|
|
106
|
+
: useClassComponent
|
|
107
|
+
? `Component.__o || Component`
|
|
108
|
+
: `Component`;
|
|
109
|
+
// prettier-ignore
|
|
110
|
+
generator.pushline(`const ${componentNamespace} = ${componentVariable}`);
|
|
108
111
|
generator.pushline(`${componentNamespace}.${variableName} = ${componentNamespace}.${variableName} || []`);
|
|
109
112
|
generator.push(`${componentNamespace}.${variableName}.push({`);
|
|
110
113
|
generator.indent();
|
package/lib/yaml.js
CHANGED
|
@@ -71,12 +71,7 @@ function generateNode(generator, node, options, injector) {
|
|
|
71
71
|
const { forceStringify } = generator.context();
|
|
72
72
|
const codeMaps = new Map();
|
|
73
73
|
const { type, bridge, exportESM, sourceMap, isGlobal, locale, useClassComponent } = options;
|
|
74
|
-
|
|
75
|
-
const componentNamespace = bridge
|
|
76
|
-
? `Component.options`
|
|
77
|
-
: useClassComponent
|
|
78
|
-
? `Component.__o`
|
|
79
|
-
: `Component`;
|
|
74
|
+
const componentNamespace = '_Component';
|
|
80
75
|
(0, yaml_eslint_parser_1.traverseNodes)(node, {
|
|
81
76
|
enterNode(node, parent) {
|
|
82
77
|
switch (node.type) {
|
|
@@ -94,6 +89,14 @@ function generateNode(generator, node, options, injector) {
|
|
|
94
89
|
: `export default`;
|
|
95
90
|
generator.push(`${exportSyntax} function (Component) {`);
|
|
96
91
|
generator.indent();
|
|
92
|
+
// prettier-ignore
|
|
93
|
+
const componentVariable = bridge
|
|
94
|
+
? `Component.options || Component`
|
|
95
|
+
: useClassComponent
|
|
96
|
+
? `Component.__o || Component`
|
|
97
|
+
: `Component`;
|
|
98
|
+
// prettier-ignore
|
|
99
|
+
generator.pushline(`const ${componentNamespace} = ${componentVariable}`);
|
|
97
100
|
generator.pushline(`${componentNamespace}.${variableName} = ${componentNamespace}.${variableName} || []`);
|
|
98
101
|
generator.push(`${componentNamespace}.${variableName}.push({`);
|
|
99
102
|
generator.indent();
|