create-expo 5.1.5 → 5.1.7

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.
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- exports.id = 589;
3
- exports.ids = [589,601];
2
+ exports.id = 536;
3
+ exports.ids = [536,601];
4
4
  exports.modules = {
5
5
 
6
- /***/ 589:
6
+ /***/ 2536:
7
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
8
 
9
9
 
@@ -33,11 +33,11 @@ var prompts = __webpack_require__(6133);
33
33
  var prompts_default = /*#__PURE__*/__webpack_require__.n(prompts);
34
34
  // EXTERNAL MODULE: ../@expo/package-manager/build/index.js
35
35
  var build = __webpack_require__(6268);
36
- // EXTERNAL MODULE: ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
37
- var index_min = __webpack_require__(9337);
38
36
  // EXTERNAL MODULE: ../../node_modules/.pnpm/ora@3.4.0/node_modules/ora/index.js
39
37
  var ora = __webpack_require__(5344);
40
38
  var ora_default = /*#__PURE__*/__webpack_require__.n(ora);
39
+ // EXTERNAL MODULE: ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs + 1 modules
40
+ var dist = __webpack_require__(304);
41
41
  // EXTERNAL MODULE: ./src/log.ts
42
42
  var log = __webpack_require__(1545);
43
43
  ;// CONCATENATED MODULE: ./src/createExpoConfig.ts
@@ -887,7 +887,7 @@ function escapeXMLCharacters(original) {
887
887
  * `getTemplateFilesToRenameAsync()`.
888
888
  *
889
889
  * The file patterns are formatted as glob expressions to be interpreted by
890
- * [glob](https://github.com/isaacs/node-glob). Comments are supported with
890
+ * [tinyglobby](https://github.com/SuperchupuDev/tinyglobby). Comments are supported with
891
891
  * the `#` symbol, both in the plain-text file and string array formats.
892
892
  * Whitespace is trimmed and whitespace-only lines are ignored.
893
893
  *
@@ -935,15 +935,16 @@ renameConfig: userConfig, }) {
935
935
  config = config
936
936
  .map((line) => line.split(/(?<!\\)#/, 2)[0]?.trim() ?? '')
937
937
  .filter((line) => line !== '');
938
- return await (0,index_min/* glob */.TI)(config, {
938
+ return (0,dist/* glob */.TI)(config.map((pattern) => {
939
+ const literalPattern = pattern.startsWith('!') ? `\\${pattern}` : pattern;
940
+ // NOTE(@kitten): tinyglobby has no matchBase option; bare patterns match in every directory.
941
+ return pattern.includes('/') ? literalPattern : `**/${literalPattern}`;
942
+ }), {
939
943
  cwd,
940
- // `true` is consistent with .gitignore. Allows `*.xml` to match .xml files
941
- // in all subdirs.
942
- matchBase: true,
943
944
  dot: true,
944
- // Prevent climbing out of the template directory in case a template
945
- // includes a symlink to an external directory.
946
- follow: false,
945
+ expandDirectories: false,
946
+ // NOTE(@kitten): Renaming must not modify files reached through template symlinks.
947
+ followSymbolicLinks: false,
947
948
  });
948
949
  }
949
950
  /**
@@ -1542,175 +1543,6 @@ async function generateAgentFiles(root) {
1542
1543
  await Promise.all(tasks);
1543
1544
  }
1544
1545
 
1545
- ;// CONCATENATED MODULE: ./src/promptSdkVersion.ts
1546
-
1547
-
1548
-
1549
-
1550
-
1551
-
1552
-
1553
- const promptSdkVersion_debug = __webpack_require__(6675)('expo:init:sdk');
1554
- // SDKs without a `releaseNoteUrl` are canary/in-development. The top-level
1555
- // `expoGoSdkVersion` reports the SDK currently shipping in store Expo Go and
1556
- // is treated as optional — when absent, the "For learning with Expo Go" choice
1557
- // is hidden.
1558
- const VERSIONS_URL = 'https://api.expo.dev/v2/versions';
1559
- async function fetchSdkVersionsAsync() {
1560
- let json;
1561
- try {
1562
- const response = await fetch(VERSIONS_URL);
1563
- if (!response.ok) {
1564
- promptSdkVersion_debug(`versions endpoint returned ${response.status}`);
1565
- return null;
1566
- }
1567
- json = (await response.json());
1568
- }
1569
- catch (error) {
1570
- promptSdkVersion_debug('Failed to fetch versions endpoint:', error);
1571
- return null;
1572
- }
1573
- const sdkVersions = json.sdkVersions ?? {};
1574
- const available = Object.entries(sdkVersions)
1575
- .filter(([, info]) => !!info.releaseNoteUrl && !info.isDeprecated)
1576
- .map(([version]) => parseSdkMajor(version))
1577
- .filter((major) => major != null)
1578
- .sort((a, b) => b - a);
1579
- const latest = available[0];
1580
- if (latest == null) {
1581
- return null;
1582
- }
1583
- return {
1584
- latest,
1585
- expoGoCompatible: parseSdkMajor(json.expoGoSdkVersion),
1586
- available,
1587
- };
1588
- }
1589
- function parseSdkMajor(version) {
1590
- const major = parseInt(version?.split('.')[0] ?? '', 10);
1591
- return Number.isFinite(major) ? major : null;
1592
- }
1593
- /**
1594
- * If the resolved template is an Expo-published template without an explicit
1595
- * SDK tag, prompt the user to pick which Expo SDK to use and return the
1596
- * template name with the chosen SDK tag appended.
1597
- *
1598
- * Returns the template unchanged if the user is non-interactive, the template
1599
- * already targets a specific version, or we can't reach the versions endpoint.
1600
- */
1601
- async function applySdkVersionToTemplateAsync(template, { yes, showAlternatives = true, projectName, }) {
1602
- if (env.env.EXPO_BETA) {
1603
- logCreatingProject(template, projectName);
1604
- return template;
1605
- }
1606
- const [name, tag] = splitNpmNameAndTag(template);
1607
- if (tag) {
1608
- logCreatingProject(template, projectName);
1609
- return template;
1610
- }
1611
- if (!isKnownExpoTemplate(name)) {
1612
- logCreatingProject(template, projectName);
1613
- return template;
1614
- }
1615
- const nonInteractive = yes || env.env.CI || !process.stdin.isTTY;
1616
- // Non-interactive + user explicitly chose a template: fall through to that
1617
- // template's npm `latest` dist-tag. No need to fetch the versions endpoint.
1618
- if (nonInteractive && !showAlternatives) {
1619
- logCreatingProject(template, projectName);
1620
- return template;
1621
- }
1622
- const versions = await fetchSdkVersionsAsync();
1623
- if (!versions) {
1624
- logCreatingProject(template, projectName);
1625
- return template;
1626
- }
1627
- // Non-interactive + default template: pin to the actual latest released SDK.
1628
- if (nonInteractive) {
1629
- const pinned = `${name}@sdk-${versions.latest}`;
1630
- logCreatingProject(pinned, projectName);
1631
- return pinned;
1632
- }
1633
- const selectedSdk = await promptSdkVersionAsync(versions, name, showAlternatives, projectName);
1634
- if (selectedSdk == null) {
1635
- logCreatingProject(template, projectName);
1636
- return template;
1637
- }
1638
- return `${name}@sdk-${selectedSdk}`;
1639
- }
1640
- function logCreatingProject(template, projectName) {
1641
- const subject = projectName ? source_default().cyan(projectName) : 'a project';
1642
- console.log(source_default() `Creating ${subject} using the {cyan ${template}} template.\n`);
1643
- }
1644
- function isKnownExpoTemplate(name) {
1645
- if (ALIASES.includes(name)) {
1646
- return true;
1647
- }
1648
- // Short aliases like `default` and `blank` are expanded to `expo-template-*` later.
1649
- return ALIASES.includes(`expo-template-${name}`);
1650
- }
1651
- async function promptSdkVersionAsync(versions, templateName, showAlternatives, projectName) {
1652
- const { latest, expoGoCompatible, available } = versions;
1653
- const choices = [
1654
- {
1655
- title: `Latest (SDK ${latest})`,
1656
- value: latest,
1657
- description: 'Recommended for most projects',
1658
- },
1659
- ];
1660
- if (expoGoCompatible != null && expoGoCompatible !== latest) {
1661
- choices.push({
1662
- title: `For learning with Expo Go (SDK ${expoGoCompatible})`,
1663
- value: expoGoCompatible,
1664
- description: 'Compatible with Expo Go on App Store and Play Store',
1665
- });
1666
- }
1667
- choices.push({ title: 'Other SDK version…', value: 'other' });
1668
- const { answer } = await prompts_default()({
1669
- type: 'select',
1670
- name: 'answer',
1671
- message: 'Select an Expo SDK version:',
1672
- choices,
1673
- });
1674
- if (answer == null) {
1675
- log/* Log */.tG.log();
1676
- log/* Log */.tG.log(source_default() `Specify the SDK version, example: {cyan --template default@${latest}}`);
1677
- process.exit(1);
1678
- }
1679
- let resolved;
1680
- if (answer !== 'other') {
1681
- resolved = answer;
1682
- }
1683
- else {
1684
- const { sdkAnswer } = await prompts_default()({
1685
- type: 'select',
1686
- name: 'sdkAnswer',
1687
- message: 'Select an SDK version:',
1688
- choices: available.slice(0, 4).map((sdk) => ({
1689
- title: `SDK ${sdk}`,
1690
- value: sdk,
1691
- })),
1692
- });
1693
- if (sdkAnswer == null) {
1694
- log/* Log */.tG.log();
1695
- log/* Log */.tG.log(source_default() `Specify the SDK version, example: {cyan --template default@${latest}}`);
1696
- process.exit(1);
1697
- }
1698
- resolved = sdkAnswer;
1699
- }
1700
- const friendly = templateName.replace(/^expo-template-/, '');
1701
- const subject = projectName ? source_default().cyan(projectName) : 'a project';
1702
- console.log(source_default() `Creating ${subject} using the {cyan ${friendly}} template.`);
1703
- if (showAlternatives) {
1704
- const cmd = (0,resolvePackageManager/* formatSelfCommand */.fZ)();
1705
- console.log();
1706
- console.log(source_default().gray('Tip:'));
1707
- console.log(` ${source_default().gray('•')} ${source_default().gray(cmd)} ${source_default().cyan('--template')} ${source_default().gray('to pick from other templates')}`);
1708
- console.log(` ${source_default().gray('•')} ${source_default().gray(cmd)} ${source_default().cyan('--example')} ${source_default().gray('to explore')} ${source_default().gray.underline('https://github.com/expo/examples')}`);
1709
- }
1710
- console.log();
1711
- return resolved;
1712
- }
1713
-
1714
1546
  ;// CONCATENATED MODULE: ./src/utils/dir.ts
1715
1547
 
1716
1548
  // Any of these files are allowed to exist in the projectRoot
@@ -1806,6 +1638,98 @@ async function resolveProjectRootAsync(input) {
1806
1638
  return projectRoot;
1807
1639
  }
1808
1640
 
1641
+ // EXTERNAL MODULE: external "process"
1642
+ var external_process_ = __webpack_require__(932);
1643
+ ;// CONCATENATED MODULE: ./src/resolveExpoVersions.ts
1644
+ const resolveExpoVersions_debug = __webpack_require__(6675)('expo:versions');
1645
+ /**
1646
+ * The Expo Go versions endpoint, including the root property `expoGoSdkVersion`.
1647
+ * This `expoGoSdkVersion` property tells us what Expo SDK version is compatible with Expo Go on the store.
1648
+ */
1649
+ const EXPO_VERSIONS_URL = 'https://api.expo.dev/v2/versions';
1650
+ /** Resolve the Expo SDK version compatible with Expo Go on the app stores */
1651
+ async function fetchExpoSdkVersions() {
1652
+ return await fetch(EXPO_VERSIONS_URL).then((response) => {
1653
+ if (response.ok)
1654
+ return response.json();
1655
+ resolveExpoVersions_debug('Failed to fetch versions endpoint, received status: %d', response.status);
1656
+ return null;
1657
+ }, (error) => {
1658
+ resolveExpoVersions_debug('Failed to fetch versions endpoint: %O', error);
1659
+ return null;
1660
+ });
1661
+ }
1662
+ /**
1663
+ * Resolve the latest Expo SDK version, and the latest Expo Go-compatible version.
1664
+ * By default, we use the Expo Go-compatible version.
1665
+ * To inform users on how to override this, we need to know both versions.
1666
+ */
1667
+ async function resolveExpoVersions() {
1668
+ const versions = await fetchExpoSdkVersions();
1669
+ if (!versions)
1670
+ return null;
1671
+ const available = Object.entries(versions.sdkVersions ?? {})
1672
+ .filter(([, info]) => !!info.releaseNoteUrl && !info.isDeprecated)
1673
+ .map(([version]) => parseMajorVersion(version))
1674
+ .filter((major) => major != null)
1675
+ .sort((a, b) => a - b);
1676
+ return {
1677
+ latestVersion: available.pop() ?? null,
1678
+ expoGoVersion: parseMajorVersion(versions.expoGoSdkVersion),
1679
+ };
1680
+ }
1681
+ /** Extract the major number from a semver version or range */
1682
+ function parseMajorVersion(semver) {
1683
+ const major = parseInt(semver.split('.', 1).shift() ?? '', 10);
1684
+ return Number.isFinite(major) ? major : null;
1685
+ }
1686
+
1687
+ ;// CONCATENATED MODULE: ./src/resolveTemplate.ts
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+ /**
1695
+ * Resolve the Expo Go compatible template and inform the user.
1696
+ * This only applies to first-party templates, listed in {@link ALIASES}.
1697
+ */
1698
+ async function resolveTemplate({ template, projectName, }) {
1699
+ const [name, version] = splitNpmNameAndTag(template);
1700
+ if (version || external_process_.env.EXPO_BETA || !isExpoTemplate(name)) {
1701
+ console.log(source_default() `Creating {cyan ${projectName}} using the {cyan ${template}} template.`);
1702
+ return template;
1703
+ }
1704
+ const versions = await resolveExpoVersions();
1705
+ if (!versions?.expoGoVersion) {
1706
+ console.log(source_default() `Creating {cyan ${projectName}} using the {cyan ${template}} template.`);
1707
+ return template;
1708
+ }
1709
+ const expoGoTemplate = `${name}@sdk-${versions.expoGoVersion}`;
1710
+ const isLatestVersion = versions.expoGoVersion === versions.latestVersion;
1711
+ console.log(isLatestVersion
1712
+ ? source_default() `Creating {cyan ${projectName}} using the {cyan ${expoGoTemplate}} template.`
1713
+ : source_default() `Creating {cyan ${projectName}} using the Expo Go-compatible {cyan ${expoGoTemplate}} template.`);
1714
+ const cmd = (0,resolvePackageManager/* formatSelfCommand */.fZ)();
1715
+ console.log([
1716
+ '',
1717
+ source_default().dim('Tip:'),
1718
+ isLatestVersion
1719
+ ? null
1720
+ : source_default() ` {dim $ ${cmd} {cyan --template ${name}@latest} to use the latest {bold Expo SDK ${versions.latestVersion}}}`,
1721
+ source_default() ` {dim $ ${cmd} {cyan --template} to pick different templates}`,
1722
+ source_default() ` {dim $ ${cmd} {cyan --example} to explore {underline https://github.com/expo/examples}}`,
1723
+ '',
1724
+ ]
1725
+ .filter((value) => value !== null)
1726
+ .join('\n'));
1727
+ return template;
1728
+ }
1729
+ function isExpoTemplate(name) {
1730
+ return ALIASES.includes(name.startsWith('expo-template-') ? name : `expo-template-${name}`);
1731
+ }
1732
+
1809
1733
  // EXTERNAL MODULE: ./src/telemetry.ts + 2 modules
1810
1734
  var telemetry = __webpack_require__(601);
1811
1735
  // EXTERNAL MODULE: ./src/utils/update-check.ts
@@ -1814,8 +1738,6 @@ var update_check = __webpack_require__(7517);
1814
1738
 
1815
1739
 
1816
1740
 
1817
-
1818
-
1819
1741
  const git_debug = __webpack_require__(6675)('expo:init:git');
1820
1742
  const getPackageJson = () => {
1821
1743
  try {
@@ -1848,30 +1770,13 @@ async function isGitInstalledAsync() {
1848
1770
  async function initGitRepoAsync(root) {
1849
1771
  // Check if git is installed
1850
1772
  if (!(await isGitInstalledAsync())) {
1851
- git_debug(source_default().dim('Unable to initialize Git repo. `git` not in $PATH.'));
1773
+ git_debug('Unable to initialize Git repo. `git` not in $PATH.');
1852
1774
  return false;
1853
1775
  }
1854
1776
  // Check if already inside a git repository
1855
1777
  if (await isInsideGitRepoAsync(root)) {
1856
- // In headless/CI mode, skip by default
1857
- if (env.env.CI) {
1858
- git_debug(source_default().dim('New project is already inside of a Git repo, skipping git init (CI mode).'));
1859
- return false;
1860
- }
1861
- // In interactive mode, prompt the user
1862
- const { answer } = await prompts_default()({
1863
- type: 'confirm',
1864
- name: 'answer',
1865
- message: 'You are creating a project inside of an existing Git repository. Skip initializing a new git repository?',
1866
- initial: true,
1867
- });
1868
- // If user confirms skip (or cancels/ctrl+c which returns undefined), skip git init
1869
- if (answer !== false) {
1870
- git_debug(source_default().dim('User chose to skip git init inside existing repo.'));
1871
- return false;
1872
- }
1873
- // User explicitly chose not to skip, proceed with git init (creates nested repo)
1874
- git_debug(source_default().dim('User chose to initialize git inside existing repo.'));
1778
+ console.log(source_default().dim('Skipped initializing Git repository, already inside one.'));
1779
+ return false;
1875
1780
  }
1876
1781
  const packageJSON = getPackageJson();
1877
1782
  // not in git tree, so let's init
@@ -1883,7 +1788,7 @@ async function initGitRepoAsync(root) {
1883
1788
  stdio: 'ignore',
1884
1789
  cwd: root,
1885
1790
  });
1886
- git_debug(source_default().dim('Initialized a Git repository.'));
1791
+ git_debug('Initialized a Git repository.');
1887
1792
  return true;
1888
1793
  }
1889
1794
  catch (error) {
@@ -2024,9 +1929,8 @@ async function createTemplateAsync(inputPath, props) {
2024
1929
  resolvedTemplate = props.template ?? null;
2025
1930
  }
2026
1931
  const projectRoot = await resolveProjectRootArgAsync(inputPath, props);
2027
- resolvedTemplate = await applySdkVersionToTemplateAsync(resolvedTemplate ?? 'expo-template-default', {
2028
- yes: props.yes,
2029
- showAlternatives: !props.template,
1932
+ resolvedTemplate = await resolveTemplate({
1933
+ template: resolvedTemplate ?? 'default',
2030
1934
  projectName: external_path_default().basename(projectRoot),
2031
1935
  });
2032
1936
  await external_fs_default().promises.mkdir(projectRoot, { recursive: true });
@@ -50,7 +50,7 @@ export declare function extractAndPrepareTemplateAppAsync(projectRoot: string, {
50
50
  * `getTemplateFilesToRenameAsync()`.
51
51
  *
52
52
  * The file patterns are formatted as glob expressions to be interpreted by
53
- * [glob](https://github.com/isaacs/node-glob). Comments are supported with
53
+ * [tinyglobby](https://github.com/SuperchupuDev/tinyglobby). Comments are supported with
54
54
  * the `#` symbol, both in the plain-text file and string array formats.
55
55
  * Whitespace is trimmed and whitespace-only lines are ignored.
56
56
  *